Class: TagLib::ID3v2::Tag

Inherits:
Tag
  • Object
show all
Defined in:
lib/TagLib_doc.rb

Overview

The main class in the ID3v2 implementation. .

This is the main class in the ID3v2 implementation. It serves two functions. This first, as is obvious from the public API, is to provide a container for the other ID3v2 related classes. In addition, through the read() and parse() protected methods, it provides the most basic level of parsing. In these methods the ID3v2 tag is extracted from the file and split into data components.ID3v2 tags have several parts, TagLib attempts to provide an interface for them all. header(), footer() and extendedHeader() corespond to those data structures in the ID3v2 standard and the APIs for the classes that they return attempt to reflect this.Also ID3v2 tags are built up from a list of frames, which are in turn have a header and a list of fields. TagLib provides two ways of accessing the list of frames that are in a given ID3v2 tag. The first is simply via the frameList() method. This is just a list of pointers to the frames. The second is a map from the frame type – i.e. "COMM" for comments – and a list of frames of that type. (In some cases ID3v2 allows for multiple frames of the same type, hence this being a map to a list rather than just a map to an individual frame.)More information on the structure of frames can be found in the ID3v2::Frame class.read() and parse() pass binary data to the other ID3v2 class structures, they do not handle parsing of flags or fields, for instace. Those are handled by similar functions within those classes.All pointers to data structures within the tag will become invalid when the tag is destroyed. Dealing with the nasty details of ID3v2 is not for the faint of heart and should not be done without much meditation on the spec. It's rather long, but if you're planning on messing with this class and others that deal with the details of ID3v2 (rather than the nice, safe, abstract TagLib::Tag and friends), it's worth your time to familiarize yourself with said spec (which is distrubuted with the TagLib sources). TagLib tries to do most of the work, but with a little luck, you can still convince it to generate invalid ID3v2 tags. The APIs for ID3v2 assume a working knowledge of ID3v2 structure. You're been warned.

Instance Method Summary collapse

Instance Method Details

#addFrame(frame) ⇒ Object

Add a frame to the tag. At this point the tag takes ownership of the frame and will handle freeing its memory.Using this method will invalidate any pointers on the list returned by frameList()



2719
2720
# File 'lib/TagLib_doc.rb', line 2719

def addFrame(frame)
end

#albumObject

Returns the album name; if no album name is present in the tag String::null will be returned.



2696
2697
# File 'lib/TagLib_doc.rb', line 2696

def album()
end

#album=Object



2698
2699
# File 'lib/TagLib_doc.rb', line 2698

def album=()
end

#artistObject

Returns the artist name; if no artist name is present in the tag String::null will be returned.



2662
2663
# File 'lib/TagLib_doc.rb', line 2662

def artist()
end

#artist=Object



2666
2667
# File 'lib/TagLib_doc.rb', line 2666

def artist=()
end

#commentObject

Returns the track comment; if no comment is present in the tag String::null will be returned.



2676
2677
# File 'lib/TagLib_doc.rb', line 2676

def comment()
end

#comment=Object



2689
2690
# File 'lib/TagLib_doc.rb', line 2689

def comment=()
end

#empty?Boolean

Returns:

  • (Boolean)


2691
2692
# File 'lib/TagLib_doc.rb', line 2691

def empty?()
end

#frameList(frameID) ⇒ Object

Returns the frame list for frames with the id frameID or an empty list if there are no frames of that type. This is just a convenience and is equivalent to:frameListMap(); frameListMap()



2647
2648
# File 'lib/TagLib_doc.rb', line 2647

def frameList(frameID)
end

#frameListMapObject

Returns a reference to the frame list map. This is an FrameListMap of all of the frames in the tag.This is the most convenient structure for accessing the tag's frames. Many frame types allow multiple instances of the same frame type so this is a map of lists. In most cases however there will only be a single frame of a certain type.Let's say for instance that you wanted to access the frame for total beats per minute – the TBPM frame.TagLib::MPEG::Filef("foo.mp3");

//ChecktomakesurethatithasanID3v2tag

if(f.ID3v2Tag()){

//Getthelistofframesforaspecificframetype

TagLib::ID3v2::FrameListl=f.ID3v2Tag()->frameListMap();

if(!l.isEmpty()) std::cout<<l.front()->toString()<<std::endl; } You should not modify this data structure directly, instead use addFrame() and removeFrame(). frameList()



2751
2752
# File 'lib/TagLib_doc.rb', line 2751

def frameListMap()
end

#genreObject

Returns the genre name; if no genre is present in the tag String::null will be returned.



2713
2714
# File 'lib/TagLib_doc.rb', line 2713

def genre()
end

#genre=Object



2721
2722
# File 'lib/TagLib_doc.rb', line 2721

def genre=()
end

#headerObject

Returns a pointer to the tag's header.



2633
2634
# File 'lib/TagLib_doc.rb', line 2633

def header()
end

#isEmptyObject

Returns true if the tag does not contain any data. This should be reimplemented in subclasses that provide more than the basic tagging abilities in this class.



2708
2709
# File 'lib/TagLib_doc.rb', line 2708

def isEmpty()
end

#removeFrame(frame, del = true) ⇒ Object

Remove a frame from the tag. If del is true the frame's memory will be freed; if it is false, it must be deleted by the user.Using this method will invalidate any pointers on the list returned by frameList()



2682
2683
# File 'lib/TagLib_doc.rb', line 2682

def removeFrame(frame,del = true)
end

#setAlbum(s) ⇒ Object

Sets the album to s. If s is String::null then this value will be cleared.



2703
2704
# File 'lib/TagLib_doc.rb', line 2703

def setAlbum(s)
end

#setArtist(s) ⇒ Object

Sets the artist to s. If s is String::null then this value will be cleared.



2671
2672
# File 'lib/TagLib_doc.rb', line 2671

def setArtist(s)
end

#setComment(s) ⇒ Object

Sets the comment to s. If s is String::null then this value will be cleared.



2726
2727
# File 'lib/TagLib_doc.rb', line 2726

def setComment(s)
end

#setGenre(s) ⇒ Object

Sets the genre to s. If s is String::null then this value will be cleared. For tag formats that use a fixed set of genres, the appropriate value will be selected based on a string comparison. A list of available genres for those formats should be available in that type's implementation.



2623
2624
# File 'lib/TagLib_doc.rb', line 2623

def setGenre(s)
end

#setTitle(s) ⇒ Object

Sets the title to s. If s is String::null then this value will be cleared.



2640
2641
# File 'lib/TagLib_doc.rb', line 2640

def setTitle(s)
end

#setTrack(i) ⇒ Object

Sets the track to i. If s is 0 then this value will be cleared.



2687
2688
# File 'lib/TagLib_doc.rb', line 2687

def setTrack(i)
end

#setYear(i) ⇒ Object

Sets the year to i. If s is 0 then this value will be cleared.



2657
2658
# File 'lib/TagLib_doc.rb', line 2657

def setYear(i)
end

#titleObject

Returns the track name; if no track name is present in the tag String::null will be returned.



2628
2629
# File 'lib/TagLib_doc.rb', line 2628

def title()
end

#title=Object



2635
2636
# File 'lib/TagLib_doc.rb', line 2635

def title=()
end

#trackObject

Returns the track number; if there is no track number set, this will return 0.



2731
2732
# File 'lib/TagLib_doc.rb', line 2731

def track()
end

#track=Object



2618
2619
# File 'lib/TagLib_doc.rb', line 2618

def track=()
end

#yearObject

Returns the year; if there is no year set, this will return 0.



2652
2653
# File 'lib/TagLib_doc.rb', line 2652

def year()
end

#year=Object



2664
2665
# File 'lib/TagLib_doc.rb', line 2664

def year=()
end