Add support for more original year tags.

This commit is contained in:
Eduardo Sánchez Muñoz 2015-07-01 00:50:19 +02:00
parent c46fb5eec7
commit 8dd4506697
1 changed files with 26 additions and 0 deletions

View File

@ -193,6 +193,9 @@ void TagReader::ReadFile(const QString& filename,
if (!map["TDOR"].isEmpty())
song->set_originalyear(
map["TDOR"].front()->toString().substr(0, 4).toInt());
else if (!map["TORY"].isEmpty())
song->set_originalyear(
map["TORY"].front()->toString().substr(0, 4).toInt());
if (!map["USLT"].isEmpty()) {
Decode(map["USLT"].front()->toString(), nullptr,
@ -317,6 +320,12 @@ void TagReader::ReadFile(const QString& filename,
Decode(items["\251grp"].toStringList().toString(" "), nullptr,
song->mutable_grouping());
}
if (items.contains("----:com.apple.iTunes:ORIGINAL YEAR"))
song->set_originalyear(
TStringToQString(items["----:com.apple.iTunes:ORIGINAL YEAR"]
.toStringList().toString('\n')).left(4).toInt());
Decode(mp4_tag->comment(), nullptr, song->mutable_comment());
}
}
@ -357,6 +366,20 @@ void TagReader::ReadFile(const QString& filename,
}
}
}
if (attributes_map.contains("WM/OriginalReleaseTime")) {
const TagLib::ASF::AttributeList& attributes =
attributes_map["WM/OriginalReleaseTime"];
if (!attributes.isEmpty())
song->set_originalyear(
TStringToQString(attributes.front().toString()).left(4).toInt());
} else if (attributes_map.contains("WM/OriginalReleaseYear")) {
const TagLib::ASF::AttributeList& attributes =
attributes_map["WM/OriginalReleaseYear"];
if (!attributes.isEmpty())
song->set_originalyear(
TStringToQString(attributes.front().toString()).left(4).toInt());
}
}
#endif
else if (tag) {
@ -496,6 +519,9 @@ void TagReader::ParseOggTag(const TagLib::Ogg::FieldListMap& map,
if (!map["ORIGINALDATE"].isEmpty())
song->set_originalyear(
TStringToQString(map["ORIGINALDATE"].front()).left(4).toInt());
else if (!map["ORIGINALYEAR"].isEmpty())
song->set_originalyear(
TStringToQString(map["ORIGINALYEAR"].front()).toInt());
if (!map["BPM"].isEmpty())
song->set_bpm(TStringToQString(map["BPM"].front()).trimmed().toFloat());