TagLib: Implement Composer tag support
Most of the reading was already there, it just didn't expose it to the player. Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This commit is contained in:
parent
b9121be6e8
commit
248718c967
16 changed files with 128 additions and 0 deletions
|
@ -139,6 +139,13 @@ String APE::Tag::artist() const
|
||||||
return d->itemListMap["ARTIST"].values().toString();
|
return d->itemListMap["ARTIST"].values().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String APE::Tag::composer() const
|
||||||
|
{
|
||||||
|
if(!d->itemListMap["COMPOSER"].isEmpty())
|
||||||
|
return d->itemListMap["COMPOSER"].values().toString();
|
||||||
|
return String();
|
||||||
|
}
|
||||||
|
|
||||||
String APE::Tag::album() const
|
String APE::Tag::album() const
|
||||||
{
|
{
|
||||||
if(d->itemListMap["ALBUM"].isEmpty())
|
if(d->itemListMap["ALBUM"].isEmpty())
|
||||||
|
@ -247,6 +254,11 @@ void APE::Tag::setArtist(const String &s)
|
||||||
addValue("ARTIST", s, true);
|
addValue("ARTIST", s, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void APE::Tag::setComposer(const String &s)
|
||||||
|
{
|
||||||
|
addValue("COMPOSER", s, true);
|
||||||
|
}
|
||||||
|
|
||||||
void APE::Tag::setAlbum(const String &s)
|
void APE::Tag::setAlbum(const String &s)
|
||||||
{
|
{
|
||||||
addValue("ALBUM", s, true);
|
addValue("ALBUM", s, true);
|
||||||
|
|
|
@ -90,6 +90,7 @@ namespace TagLib {
|
||||||
virtual String title() const;
|
virtual String title() const;
|
||||||
virtual String albumartist() const;
|
virtual String albumartist() const;
|
||||||
virtual String artist() const;
|
virtual String artist() const;
|
||||||
|
virtual String composer() const;
|
||||||
virtual String album() const;
|
virtual String album() const;
|
||||||
virtual String unsyncedlyrics() const;
|
virtual String unsyncedlyrics() const;
|
||||||
virtual String comment() const;
|
virtual String comment() const;
|
||||||
|
@ -107,6 +108,7 @@ namespace TagLib {
|
||||||
virtual void setTitle(const String &s);
|
virtual void setTitle(const String &s);
|
||||||
virtual void setAlbumArtist(const String &s);
|
virtual void setAlbumArtist(const String &s);
|
||||||
virtual void setArtist(const String &s);
|
virtual void setArtist(const String &s);
|
||||||
|
virtual void setComposer(const String &s);
|
||||||
virtual void setAlbum(const String &s);
|
virtual void setAlbum(const String &s);
|
||||||
virtual void setUnsyncedlyrics(const String &s);
|
virtual void setUnsyncedlyrics(const String &s);
|
||||||
virtual void setComment(const String &s);
|
virtual void setComment(const String &s);
|
||||||
|
|
|
@ -67,6 +67,13 @@ String ASF::Tag::artist() const
|
||||||
return d->artist;
|
return d->artist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String ASF::Tag::composer() const
|
||||||
|
{
|
||||||
|
if(d->attributeListMap.contains("WM/Composer"))
|
||||||
|
return d->attributeListMap["WM/Composer"][0].toString();
|
||||||
|
return String();
|
||||||
|
}
|
||||||
|
|
||||||
String ASF::Tag::album() const
|
String ASF::Tag::album() const
|
||||||
{
|
{
|
||||||
if(d->attributeListMap.contains("WM/AlbumTitle"))
|
if(d->attributeListMap.contains("WM/AlbumTitle"))
|
||||||
|
@ -183,6 +190,11 @@ void ASF::Tag::setArtist(const String &value)
|
||||||
d->artist = value;
|
d->artist = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ASF::Tag::setComposer(const String &value)
|
||||||
|
{
|
||||||
|
setAttribute("WM/Composer", value);
|
||||||
|
}
|
||||||
|
|
||||||
void ASF::Tag::setCopyright(const String &value)
|
void ASF::Tag::setCopyright(const String &value)
|
||||||
{
|
{
|
||||||
d->copyright = value;
|
d->copyright = value;
|
||||||
|
|
|
@ -64,6 +64,11 @@ namespace TagLib {
|
||||||
*/
|
*/
|
||||||
virtual String artist() const;
|
virtual String artist() const;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Returns the composer name.
|
||||||
|
*/
|
||||||
|
virtual String composer() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Returns the album name; if no album name is present in the tag
|
* Returns the album name; if no album name is present in the tag
|
||||||
* String::null will be returned.
|
* String::null will be returned.
|
||||||
|
@ -133,6 +138,11 @@ namespace TagLib {
|
||||||
*/
|
*/
|
||||||
virtual void setArtist(const String &s);
|
virtual void setArtist(const String &s);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Sets the composer to \a s.
|
||||||
|
*/
|
||||||
|
virtual void setComposer(const String &s);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Sets the album to \a s. If \a s is String::null then this value will be
|
* Sets the album to \a s. If \a s is String::null then this value will be
|
||||||
* cleared.
|
* cleared.
|
||||||
|
|
|
@ -69,6 +69,11 @@ String Mod::Tag::artist() const
|
||||||
return String();
|
return String();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String Mod::Tag::composer() const
|
||||||
|
{
|
||||||
|
return String();
|
||||||
|
}
|
||||||
|
|
||||||
String Mod::Tag::album() const
|
String Mod::Tag::album() const
|
||||||
{
|
{
|
||||||
return String();
|
return String();
|
||||||
|
@ -152,6 +157,10 @@ void Mod::Tag::setArtist(const String &)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Mod::Tag::setComposer(const String &)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void Mod::Tag::setAlbum(const String &)
|
void Mod::Tag::setAlbum(const String &)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,6 +67,11 @@ namespace TagLib {
|
||||||
*/
|
*/
|
||||||
virtual String artist() const;
|
virtual String artist() const;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Not supported by module files. Therefore always returns String::null.
|
||||||
|
*/
|
||||||
|
virtual String composer() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Not supported by module files. Therefore always returns String::null.
|
* Not supported by module files. Therefore always returns String::null.
|
||||||
*/
|
*/
|
||||||
|
@ -163,6 +168,11 @@ namespace TagLib {
|
||||||
*/
|
*/
|
||||||
virtual void setArtist(const String &artist);
|
virtual void setArtist(const String &artist);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Not supported by module files and therefore ignored.
|
||||||
|
*/
|
||||||
|
virtual void setComposer(const String &composer);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Not supported by module files and therefore ignored.
|
* Not supported by module files and therefore ignored.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -142,6 +142,11 @@ String ID3v1::Tag::artist() const
|
||||||
return d->artist;
|
return d->artist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String ID3v1::Tag::composer() const
|
||||||
|
{
|
||||||
|
return String();
|
||||||
|
}
|
||||||
|
|
||||||
String ID3v1::Tag::album() const
|
String ID3v1::Tag::album() const
|
||||||
{
|
{
|
||||||
return d->album;
|
return d->album;
|
||||||
|
@ -221,6 +226,10 @@ void ID3v1::Tag::setArtist(const String &s)
|
||||||
d->artist = s;
|
d->artist = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ID3v1::Tag::setComposer(const String &s)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void ID3v1::Tag::setAlbum(const String &s)
|
void ID3v1::Tag::setAlbum(const String &s)
|
||||||
{
|
{
|
||||||
d->album = s;
|
d->album = s;
|
||||||
|
|
|
@ -138,6 +138,7 @@ namespace TagLib {
|
||||||
virtual String title() const;
|
virtual String title() const;
|
||||||
virtual String albumartist() const;
|
virtual String albumartist() const;
|
||||||
virtual String artist() const;
|
virtual String artist() const;
|
||||||
|
virtual String composer() const;
|
||||||
virtual String album() const;
|
virtual String album() const;
|
||||||
virtual String comment() const;
|
virtual String comment() const;
|
||||||
virtual String unsyncedlyrics() const;
|
virtual String unsyncedlyrics() const;
|
||||||
|
@ -155,6 +156,7 @@ namespace TagLib {
|
||||||
virtual void setTitle(const String &s);
|
virtual void setTitle(const String &s);
|
||||||
virtual void setAlbumArtist(const String &s);
|
virtual void setAlbumArtist(const String &s);
|
||||||
virtual void setArtist(const String &s);
|
virtual void setArtist(const String &s);
|
||||||
|
virtual void setComposer(const String &s);
|
||||||
virtual void setAlbum(const String &s);
|
virtual void setAlbum(const String &s);
|
||||||
virtual void setComment(const String &s);
|
virtual void setComment(const String &s);
|
||||||
virtual void setUnsyncedlyrics(const String &s);
|
virtual void setUnsyncedlyrics(const String &s);
|
||||||
|
|
|
@ -163,6 +163,13 @@ String ID3v2::Tag::albumartist() const
|
||||||
return String();
|
return String();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String ID3v2::Tag::composer() const
|
||||||
|
{
|
||||||
|
if(!d->frameListMap["TCOM"].isEmpty())
|
||||||
|
return d->frameListMap["TCOM"].front()->toString();
|
||||||
|
return String();
|
||||||
|
}
|
||||||
|
|
||||||
String ID3v2::Tag::album() const
|
String ID3v2::Tag::album() const
|
||||||
{
|
{
|
||||||
if(!d->frameListMap["TALB"].isEmpty())
|
if(!d->frameListMap["TALB"].isEmpty())
|
||||||
|
@ -352,6 +359,11 @@ void ID3v2::Tag::setAlbumArtist(const String &s)
|
||||||
setTextFrame("TPE2", s);
|
setTextFrame("TPE2", s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ID3v2::Tag::setComposer(const String &s)
|
||||||
|
{
|
||||||
|
setTextFrame("TCOM", s);
|
||||||
|
}
|
||||||
|
|
||||||
void ID3v2::Tag::setAlbum(const String &s)
|
void ID3v2::Tag::setAlbum(const String &s)
|
||||||
{
|
{
|
||||||
setTextFrame("TALB", s);
|
setTextFrame("TALB", s);
|
||||||
|
|
|
@ -159,6 +159,7 @@ namespace TagLib {
|
||||||
virtual String title() const;
|
virtual String title() const;
|
||||||
virtual String albumartist() const;
|
virtual String albumartist() const;
|
||||||
virtual String artist() const;
|
virtual String artist() const;
|
||||||
|
virtual String composer() const;
|
||||||
virtual String album() const;
|
virtual String album() const;
|
||||||
virtual String comment() const;
|
virtual String comment() const;
|
||||||
virtual String unsyncedlyrics() const;
|
virtual String unsyncedlyrics() const;
|
||||||
|
@ -179,6 +180,7 @@ namespace TagLib {
|
||||||
virtual void setTitle(const String &s);
|
virtual void setTitle(const String &s);
|
||||||
virtual void setAlbumArtist(const String &s);
|
virtual void setAlbumArtist(const String &s);
|
||||||
virtual void setArtist(const String &s);
|
virtual void setArtist(const String &s);
|
||||||
|
virtual void setComposer(const String &s);
|
||||||
virtual void setAlbum(const String &s);
|
virtual void setAlbum(const String &s);
|
||||||
virtual void setComment(const String &s);
|
virtual void setComment(const String &s);
|
||||||
virtual void setUnsyncedlyrics(const String &s);
|
virtual void setUnsyncedlyrics(const String &s);
|
||||||
|
|
|
@ -103,6 +103,11 @@ String RIFF::Info::Tag::artist() const
|
||||||
return fieldText("IART");
|
return fieldText("IART");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String RIFF::Info::Tag::composer() const
|
||||||
|
{
|
||||||
|
return fieldText("IMUS");
|
||||||
|
}
|
||||||
|
|
||||||
String RIFF::Info::Tag::album() const
|
String RIFF::Info::Tag::album() const
|
||||||
{
|
{
|
||||||
return fieldText("IPRD");
|
return fieldText("IPRD");
|
||||||
|
@ -182,6 +187,11 @@ void RIFF::Info::Tag::setArtist(const String &s)
|
||||||
setFieldText("IART", s);
|
setFieldText("IART", s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RIFF::Info::Tag::setComposer(const String &s)
|
||||||
|
{
|
||||||
|
setFieldText("IMUS", s);
|
||||||
|
}
|
||||||
|
|
||||||
void RIFF::Info::Tag::setAlbum(const String &s)
|
void RIFF::Info::Tag::setAlbum(const String &s)
|
||||||
{
|
{
|
||||||
setFieldText("IPRD", s);
|
setFieldText("IPRD", s);
|
||||||
|
|
|
@ -105,6 +105,7 @@ namespace TagLib {
|
||||||
virtual String title() const;
|
virtual String title() const;
|
||||||
virtual String albumartist() const;
|
virtual String albumartist() const;
|
||||||
virtual String artist() const;
|
virtual String artist() const;
|
||||||
|
virtual String composer() const;
|
||||||
virtual String album() const;
|
virtual String album() const;
|
||||||
virtual String unsyncedlyrics() const;
|
virtual String unsyncedlyrics() const;
|
||||||
virtual String comment() const;
|
virtual String comment() const;
|
||||||
|
@ -122,6 +123,7 @@ namespace TagLib {
|
||||||
virtual void setTitle(const String &s);
|
virtual void setTitle(const String &s);
|
||||||
virtual void setAlbumArtist(const String &s);
|
virtual void setAlbumArtist(const String &s);
|
||||||
virtual void setArtist(const String &s);
|
virtual void setArtist(const String &s);
|
||||||
|
virtual void setComposer(const String &s);
|
||||||
virtual void setAlbum(const String &s);
|
virtual void setAlbum(const String &s);
|
||||||
virtual void setUnsyncedlyrics(const String &s);
|
virtual void setUnsyncedlyrics(const String &s);
|
||||||
virtual void setComment(const String &s);
|
virtual void setComment(const String &s);
|
||||||
|
|
|
@ -49,6 +49,7 @@ bool Tag::isEmpty() const
|
||||||
return (title().isEmpty() &&
|
return (title().isEmpty() &&
|
||||||
albumartist().isEmpty() &&
|
albumartist().isEmpty() &&
|
||||||
artist().isEmpty() &&
|
artist().isEmpty() &&
|
||||||
|
composer().isEmpty() &&
|
||||||
album().isEmpty() &&
|
album().isEmpty() &&
|
||||||
unsyncedlyrics().isEmpty() &&
|
unsyncedlyrics().isEmpty() &&
|
||||||
comment().isEmpty() &&
|
comment().isEmpty() &&
|
||||||
|
@ -67,6 +68,8 @@ PropertyMap Tag::properties() const
|
||||||
map["ALBUMARTIST"].append(albumartist());
|
map["ALBUMARTIST"].append(albumartist());
|
||||||
if(!(artist().isEmpty()))
|
if(!(artist().isEmpty()))
|
||||||
map["ARTIST"].append(artist());
|
map["ARTIST"].append(artist());
|
||||||
|
if(!(composer().isEmpty()))
|
||||||
|
map["COMPOSER"].append(composer());
|
||||||
if(!(album().isEmpty()))
|
if(!(album().isEmpty()))
|
||||||
map["ALBUM"].append(album());
|
map["ALBUM"].append(album());
|
||||||
if(!(unsyncedlyrics().isEmpty()))
|
if(!(unsyncedlyrics().isEmpty()))
|
||||||
|
@ -116,6 +119,12 @@ PropertyMap Tag::setProperties(const PropertyMap &origProps)
|
||||||
} else
|
} else
|
||||||
setArtist(String());
|
setArtist(String());
|
||||||
|
|
||||||
|
if(properties.contains("COMPOSER")) {
|
||||||
|
setComposer(properties["COMPOSER"].front());
|
||||||
|
oneValueSet.append("COMPOSER");
|
||||||
|
} else
|
||||||
|
setComposer(String());
|
||||||
|
|
||||||
if(properties.contains("ALBUM")) {
|
if(properties.contains("ALBUM")) {
|
||||||
setAlbum(properties["ALBUM"].front());
|
setAlbum(properties["ALBUM"].front());
|
||||||
oneValueSet.append("ALBUM");
|
oneValueSet.append("ALBUM");
|
||||||
|
@ -199,6 +208,7 @@ void Tag::duplicate(const Tag *source, Tag *target, bool overwrite) // static
|
||||||
target->setTitle(source->title());
|
target->setTitle(source->title());
|
||||||
target->setAlbumArtist(source->albumartist());
|
target->setAlbumArtist(source->albumartist());
|
||||||
target->setArtist(source->artist());
|
target->setArtist(source->artist());
|
||||||
|
target->setComposer(source->composer());
|
||||||
target->setAlbum(source->album());
|
target->setAlbum(source->album());
|
||||||
target->setUnsyncedlyrics(source->unsyncedlyrics());
|
target->setUnsyncedlyrics(source->unsyncedlyrics());
|
||||||
target->setComment(source->comment());
|
target->setComment(source->comment());
|
||||||
|
@ -214,6 +224,8 @@ void Tag::duplicate(const Tag *source, Tag *target, bool overwrite) // static
|
||||||
target->setAlbumArtist(source->albumartist());
|
target->setAlbumArtist(source->albumartist());
|
||||||
if(target->artist().isEmpty())
|
if(target->artist().isEmpty())
|
||||||
target->setArtist(source->artist());
|
target->setArtist(source->artist());
|
||||||
|
if(target->composer().isEmpty())
|
||||||
|
target->setComposer(source->composer());
|
||||||
if(target->album().isEmpty())
|
if(target->album().isEmpty())
|
||||||
target->setAlbum(source->album());
|
target->setAlbum(source->album());
|
||||||
if(target->unsyncedlyrics().isEmpty())
|
if(target->unsyncedlyrics().isEmpty())
|
||||||
|
|
|
@ -96,6 +96,12 @@ namespace TagLib {
|
||||||
*/
|
*/
|
||||||
virtual String artist() const = 0;
|
virtual String artist() const = 0;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Returns the composer name; if no composer name is present in the tag
|
||||||
|
* String::null will be returned.
|
||||||
|
*/
|
||||||
|
virtual String composer() const = 0;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Returns the album name; if no album name is present in the tag
|
* Returns the album name; if no album name is present in the tag
|
||||||
* String::null will be returned.
|
* String::null will be returned.
|
||||||
|
@ -191,6 +197,12 @@ namespace TagLib {
|
||||||
*/
|
*/
|
||||||
virtual void setArtist(const String &s) = 0;
|
virtual void setArtist(const String &s) = 0;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Sets the composer to \a s. If \a s is String::null then this value will be
|
||||||
|
* cleared.
|
||||||
|
*/
|
||||||
|
virtual void setComposer(const String &s) = 0;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Sets the album to \a s. If \a s is String::null then this value will be
|
* Sets the album to \a s. If \a s is String::null then this value will be
|
||||||
* cleared.
|
* cleared.
|
||||||
|
|
|
@ -181,6 +181,11 @@ String TagUnion::artist() const
|
||||||
stringUnion(artist);
|
stringUnion(artist);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String TagUnion::composer() const
|
||||||
|
{
|
||||||
|
stringUnion(composer);
|
||||||
|
}
|
||||||
|
|
||||||
String TagUnion::album() const
|
String TagUnion::album() const
|
||||||
{
|
{
|
||||||
stringUnion(album);
|
stringUnion(album);
|
||||||
|
@ -261,6 +266,11 @@ void TagUnion::setArtist(const String &s)
|
||||||
setUnion(Artist, s);
|
setUnion(Artist, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TagUnion::setComposer(const String &s)
|
||||||
|
{
|
||||||
|
setUnion(Composer, s);
|
||||||
|
}
|
||||||
|
|
||||||
void TagUnion::setAlbum(const String &s)
|
void TagUnion::setAlbum(const String &s)
|
||||||
{
|
{
|
||||||
setUnion(Album, s);
|
setUnion(Album, s);
|
||||||
|
|
|
@ -62,6 +62,7 @@ namespace TagLib {
|
||||||
virtual String title() const;
|
virtual String title() const;
|
||||||
virtual String albumartist() const;
|
virtual String albumartist() const;
|
||||||
virtual String artist() const;
|
virtual String artist() const;
|
||||||
|
virtual String composer() const;
|
||||||
virtual String album() const;
|
virtual String album() const;
|
||||||
virtual String unsyncedlyrics() const;
|
virtual String unsyncedlyrics() const;
|
||||||
virtual String comment() const;
|
virtual String comment() const;
|
||||||
|
@ -79,6 +80,7 @@ namespace TagLib {
|
||||||
virtual void setTitle(const String &s);
|
virtual void setTitle(const String &s);
|
||||||
virtual void setAlbumArtist(const String &s);
|
virtual void setAlbumArtist(const String &s);
|
||||||
virtual void setArtist(const String &s);
|
virtual void setArtist(const String &s);
|
||||||
|
virtual void setComposer(const String &s);
|
||||||
virtual void setAlbum(const String &s);
|
virtual void setAlbum(const String &s);
|
||||||
virtual void setUnsyncedlyrics(const String &s);
|
virtual void setUnsyncedlyrics(const String &s);
|
||||||
virtual void setComment(const String &s);
|
virtual void setComment(const String &s);
|
||||||
|
|
Loading…
Reference in a new issue