Skip to content

Commit

Permalink
Workaround original date parsing with taglib, fixes #506
Browse files Browse the repository at this point in the history
  • Loading branch information
epoupon committed Aug 16, 2024
1 parent 1c98775 commit 6494f3f
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/libs/metadata/impl/TagLibTagReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,27 @@ namespace lms::metadata
TagLib::MP4::CoverArtList coverArtList{ coverItem.toCoverArtList() };
if (!coverArtList.isEmpty())
_hasEmbeddedCover = true;

if (!_propertyMap.contains("ORIGINALDATE"))
{
// For now:
// * TagLib 2.0 only parses ----:com.apple.iTunes:ORIGINALDATE
// / TagLib <2.0 only parses ----:com.apple.iTunes:originaldate
const auto& tags{ mp4File->tag()->itemMap() };
for (const auto& origDateString : { "----:com.apple.iTunes:originaldate", "----:com.apple.iTunes:ORIGINALDATE" })
{
auto itOrigDateTag{ tags.find(origDateString) };
if (itOrigDateTag != std::cend(tags))
{
const TagLib::StringList dates{ itOrigDateTag->second.toStringList() };
if (!dates.isEmpty())
{
_propertyMap["ORIGINALDATE"] = dates.front();
break;
}
}
}
}
}
// MPC
else if (TagLib::MPC::File * mpcFile{ dynamic_cast<TagLib::MPC::File*>(_file.file()) })
Expand Down

0 comments on commit 6494f3f

Please sign in to comment.