mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-01 19:47:37 +03:00
fix(scanner): support ID3v2 embedded images in WAV files
Fix #3867 Signed-off-by: Deluan <deluan@navidrome.org>
This commit is contained in:
parent
b386981b7f
commit
3f9d173495
1 changed files with 13 additions and 12 deletions
|
@ -201,41 +201,42 @@ int taglib_read(const FILENAME_CHAR_T *filename, unsigned long id) {
|
||||||
char has_cover(const TagLib::FileRef f) {
|
char has_cover(const TagLib::FileRef f) {
|
||||||
char hasCover = 0;
|
char hasCover = 0;
|
||||||
// ----- MP3
|
// ----- MP3
|
||||||
if (TagLib::MPEG::File *
|
if (TagLib::MPEG::File * mp3File{dynamic_cast<TagLib::MPEG::File *>(f.file())}) {
|
||||||
mp3File{dynamic_cast<TagLib::MPEG::File *>(f.file())}) {
|
|
||||||
if (mp3File->ID3v2Tag()) {
|
if (mp3File->ID3v2Tag()) {
|
||||||
const auto &frameListMap{mp3File->ID3v2Tag()->frameListMap()};
|
const auto &frameListMap{mp3File->ID3v2Tag()->frameListMap()};
|
||||||
hasCover = !frameListMap["APIC"].isEmpty();
|
hasCover = !frameListMap["APIC"].isEmpty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ----- FLAC
|
// ----- FLAC
|
||||||
else if (TagLib::FLAC::File *
|
else if (TagLib::FLAC::File * flacFile{dynamic_cast<TagLib::FLAC::File *>(f.file())}) {
|
||||||
flacFile{dynamic_cast<TagLib::FLAC::File *>(f.file())}) {
|
|
||||||
hasCover = !flacFile->pictureList().isEmpty();
|
hasCover = !flacFile->pictureList().isEmpty();
|
||||||
}
|
}
|
||||||
// ----- MP4
|
// ----- MP4
|
||||||
else if (TagLib::MP4::File *
|
else if (TagLib::MP4::File * mp4File{dynamic_cast<TagLib::MP4::File *>(f.file())}) {
|
||||||
mp4File{dynamic_cast<TagLib::MP4::File *>(f.file())}) {
|
|
||||||
auto &coverItem{mp4File->tag()->itemMap()["covr"]};
|
auto &coverItem{mp4File->tag()->itemMap()["covr"]};
|
||||||
TagLib::MP4::CoverArtList coverArtList{coverItem.toCoverArtList()};
|
TagLib::MP4::CoverArtList coverArtList{coverItem.toCoverArtList()};
|
||||||
hasCover = !coverArtList.isEmpty();
|
hasCover = !coverArtList.isEmpty();
|
||||||
}
|
}
|
||||||
// ----- Ogg
|
// ----- Ogg
|
||||||
else if (TagLib::Ogg::Vorbis::File *
|
else if (TagLib::Ogg::Vorbis::File * vorbisFile{dynamic_cast<TagLib::Ogg::Vorbis::File *>(f.file())}) {
|
||||||
vorbisFile{dynamic_cast<TagLib::Ogg::Vorbis::File *>(f.file())}) {
|
|
||||||
hasCover = !vorbisFile->tag()->pictureList().isEmpty();
|
hasCover = !vorbisFile->tag()->pictureList().isEmpty();
|
||||||
}
|
}
|
||||||
// ----- Opus
|
// ----- Opus
|
||||||
else if (TagLib::Ogg::Opus::File *
|
else if (TagLib::Ogg::Opus::File * opusFile{dynamic_cast<TagLib::Ogg::Opus::File *>(f.file())}) {
|
||||||
opusFile{dynamic_cast<TagLib::Ogg::Opus::File *>(f.file())}) {
|
|
||||||
hasCover = !opusFile->tag()->pictureList().isEmpty();
|
hasCover = !opusFile->tag()->pictureList().isEmpty();
|
||||||
}
|
}
|
||||||
// ----- WMA
|
// ----- WMA
|
||||||
if (TagLib::ASF::File *
|
else if (TagLib::ASF::File * asfFile{dynamic_cast<TagLib::ASF::File *>(f.file())}) {
|
||||||
asfFile{dynamic_cast<TagLib::ASF::File *>(f.file())}) {
|
|
||||||
const TagLib::ASF::Tag *tag{asfFile->tag()};
|
const TagLib::ASF::Tag *tag{asfFile->tag()};
|
||||||
hasCover = tag && tag->attributeListMap().contains("WM/Picture");
|
hasCover = tag && tag->attributeListMap().contains("WM/Picture");
|
||||||
}
|
}
|
||||||
|
// ----- WAV
|
||||||
|
else if (TagLib::RIFF::WAV::File * wavFile{ dynamic_cast<TagLib::RIFF::WAV::File*>(f.file()) }) {
|
||||||
|
if (wavFile->hasID3v2Tag()) {
|
||||||
|
const auto& frameListMap{ wavFile->ID3v2Tag()->frameListMap() };
|
||||||
|
hasCover = !frameListMap["APIC"].isEmpty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return hasCover;
|
return hasCover;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue