Merge pull request #912 from whatdoineed2do/m4a-track-year-equal0-bugfix

MP4 - setTrack()/setYear() accepts 0 to remove the tag
This commit is contained in:
Scott Wheeler 2019-08-26 23:32:44 +02:00 committed by GitHub
commit b124e621fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -805,13 +805,23 @@ MP4::Tag::setGenre(const String &value)
void
MP4::Tag::setYear(unsigned int value)
{
d->items["\251day"] = StringList(String::number(value));
if (value == 0) {
d->items.erase("\251day");
}
else {
d->items["\251day"] = StringList(String::number(value));
}
}
void
MP4::Tag::setTrack(unsigned int value)
{
d->items["trkn"] = MP4::Item(value, 0);
if (value == 0) {
d->items.erase("trkn");
}
else {
d->items["trkn"] = MP4::Item(value, 0);
}
}
bool MP4::Tag::isEmpty() const