Now correctly detects embedded WMA covers

This commit is contained in:
emeric
2019-10-26 15:27:47 +02:00
parent c9ffbd125c
commit 55d9220ae4
3 changed files with 18 additions and 5 deletions
+5 -4
View File
@@ -51,7 +51,7 @@ getAlbum(const MetadataMap& metadataMap)
res = Album{*album, ""};
auto albumMBID {findFirstValueOf(metadataMap, {"MUSICBRAINZ ALBUM ID", "MUSICBRAINZ_ALBUMID"})};
auto albumMBID {findFirstValueOf(metadataMap, {"MUSICBRAINZ ALBUM ID", "MUSICBRAINZ_ALBUMID", "MUSICBRAINZ/ALBUM ID"})};
if (!albumMBID)
return res;
@@ -72,7 +72,7 @@ getAlbumArtists(const MetadataMap& metadataMap)
Artist artist {*name, ""};
auto mbid {findFirstValueOf(metadataMap, {"MUSICBRAINZ ALBUM ARTIST ID"})};
auto mbid {findFirstValueOf(metadataMap, {"MUSICBRAINZ ALBUM ARTIST ID", "MUSICBRAINZ/ALBUM ARTIST ID"})};
if (mbid)
artist.musicBrainzArtistID = *mbid;
@@ -97,7 +97,7 @@ getArtists(const MetadataMap& metadataMap)
std::vector<std::string> artistMBIDs;
{
auto mbids {findFirstValueOf(metadataMap, {"MUSICBRAINZ ARTIST ID", "MUSICBRAINZ_ARTISTID"})};
auto mbids {findFirstValueOf(metadataMap, {"MUSICBRAINZ ARTIST ID", "MUSICBRAINZ_ARTISTID", "MUSICBRAINZ/ARTIST ID"})};
if (mbids)
artistMBIDs = splitString(*mbids, "/");
}
@@ -195,7 +195,8 @@ AvFormat::parse(const std::filesystem::path& p, bool debug)
}
else if (tag == "MUSICBRAINZ RELEASE TRACK ID"
|| tag == "MUSICBRAINZ_RELEASETRACKID"
|| tag == "MUSICBRAINZ_TRACKID")
|| tag == "MUSICBRAINZ_TRACKID"
|| tag == "MUSICBRAINZ/TRACK ID")
{
track.musicBrainzTrackID = value;
}
+9 -1
View File
@@ -22,6 +22,7 @@
#include <taglib/fileref.h>
#include <taglib/tag.h>
#include <taglib/tpropertymap.h>
#include <taglib/asffile.h>
#include <taglib/mpegfile.h>
#include <taglib/id3v2tag.h>
@@ -177,8 +178,15 @@ TagLibParser::parse(const std::filesystem::path& p, bool debug)
// Not that good embedded pictures handling
// WMA
if (TagLib::ASF::File *asfFile {dynamic_cast<TagLib::ASF::File*>(f.file())})
{
const TagLib::ASF::Tag* tag {static_cast<TagLib::ASF::Tag*>(asfFile->tag())};
if (tag && tag->attributeListMap().contains("WM/Picture"))
track.hasCover = true;
}
// MP3
if (TagLib::MPEG::File *mp3File {dynamic_cast<TagLib::MPEG::File*>(f.file())})
else if (TagLib::MPEG::File *mp3File {dynamic_cast<TagLib::MPEG::File*>(f.file())})
{
if (mp3File->ID3v2Tag())
{