Logo Search packages:      
Sourcecode: f-spot version File versions  Download package

abstract Tag TagLib::File::GetTag ( TagTypes  type,
bool  create 
) [pure virtual, inherited]

Gets a tag of a specified type from the current instance, optionally creating a new tag if possible.

type A TagLib.TagTypes value indicating the type of tag to read.
create A bool value specifying whether or not to try and create the tag if one is not found.
A Tag object containing the tag that was found in or added to the current instance. If no matching tag was found and none was created, is returned.

Passing to create does not guarantee the tag will be created. For example, trying to create an ID3v2 tag on an OGG Vorbis file will always fail.

It is safe to assume that if is not returned, the returned tag can be cast to the appropriate type.

The following example sets the mood of a file to several tag types.

string [] SetMoods (TagLib.File file, params string[] moods)
                  TagLib.Id3v2.Tag id3 = file.GetTag (TagLib.TagTypes.Id3v2, true);
                  if (id3 != null)
                     id3.SetTextFrame ("TMOO", moods);

                  TagLib.Asf.Tag asf = file.GetTag (TagLib.TagTypes.Asf, true);
                  if (asf != null)
                     asf.SetDescriptorStrings (moods, "WM/Mood", "Mood");

                  TagLib.Ape.Tag ape = file.GetTag (TagLib.TagTypes.Ape);
                  if (ape != null)
                     ape.SetValue ("MOOD", moods);

Whatever tag types you want...

Implemented in TagLib::Aac::File, TagLib::Aiff::File, TagLib::Ape::File, TagLib::Asf::File, TagLib::Flac::File, TagLib::MusePack::File, TagLib::Mpeg::AudioFile, TagLib::Mpeg::File, TagLib::Mpeg4::File, TagLib::Riff::File, and TagLib::WavPack::File.

Referenced by TagLib::Image::File::EnsureAvailableTags(), ExtractProperties(), TagLib::Tiff::File::ExtractProperties(), TagLib::Tiff::Cr2::File::ExtractProperties(), TagLib::Riff::File::File(), TagLib::Aiff::File::File(), TagLib::WavPack::File::GetTag(), TagLib::Mpeg::File::GetTag(), TagLib::MusePack::File::GetTag(), TagLib::Flac::File::GetTag(), TagLib::File::GetTag(), TagLib::Ape::File::GetTag(), TagLib::Aac::File::GetTag(), TagLib::WavPack::File::ReadEnd(), TagLib::Mpeg::File::ReadEnd(), TagLib::MusePack::File::ReadEnd(), TagLib::Flac::File::ReadEnd(), TagLib::Ape::File::ReadEnd(), TagLib::Aac::File::ReadEnd(), TagLib::Png::File::ReadiTXtChunk(), TagLib::Png::File::ReadtEXtChunk(), TagLib::Png::File::ReadzTXtChunk(), TagLib::Jpeg::File::RenderCOMSegment(), TagLib::Gif::File::RenderGifCommentBlock(), TagLib::Png::File::RenderKeywordChunks(), and TagLib::Flac::File::Save().

Generated by  Doxygen 1.6.0   Back to index