Try to read track also from TRACKNUM and year from YEAR.

Patch by David Bishop
BUG:144396


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@994811 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
This commit is contained in:
Lukáš Lalinský
2009-07-11 13:17:06 +00:00
parent 59e35efc1b
commit 5e1eb18df9
3 changed files with 78 additions and 6 deletions

View File

@ -103,16 +103,20 @@ String Ogg::XiphComment::genre() const
TagLib::uint Ogg::XiphComment::year() const
{
if(d->fieldListMap["DATE"].isEmpty())
return 0;
return d->fieldListMap["DATE"].front().toInt();
if(!d->fieldListMap["DATE"].isEmpty())
return d->fieldListMap["DATE"].front().toInt();
if(!d->fieldListMap["YEAR"].isEmpty())
return d->fieldListMap["YEAR"].front().toInt();
return 0;
}
TagLib::uint Ogg::XiphComment::track() const
{
if(d->fieldListMap["TRACKNUMBER"].isEmpty())
return 0;
return d->fieldListMap["TRACKNUMBER"].front().toInt();
if(!d->fieldListMap["TRACKNUMBER"].isEmpty())
return d->fieldListMap["TRACKNUMBER"].front().toInt();
if(!d->fieldListMap["TRACKNUM"].isEmpty())
return d->fieldListMap["TRACKNUM"].front().toInt();
return 0;
}
void Ogg::XiphComment::setTitle(const String &s)
@ -142,6 +146,7 @@ void Ogg::XiphComment::setGenre(const String &s)
void Ogg::XiphComment::setYear(uint i)
{
removeField("YEAR");
if(i == 0)
removeField("DATE");
else
@ -150,6 +155,7 @@ void Ogg::XiphComment::setYear(uint i)
void Ogg::XiphComment::setTrack(uint i)
{
removeField("TRACKNUM");
if(i == 0)
removeField("TRACKNUMBER");
else