diff --git a/adapters/taglib/end_to_end_test.go b/adapters/taglib/end_to_end_test.go index fb4fd023c..525adedbf 100644 --- a/adapters/taglib/end_to_end_test.go +++ b/adapters/taglib/end_to_end_test.go @@ -279,11 +279,7 @@ var _ = Describe("Extractor", func() { Describe("tags", func() { DescribeTable("test metadata tags across files, and special cases", func(file string, tags ...string) { mf := parseTestFile("tests/fixtures/" + file) - metadataTags := mf.Tags[model.TagMetadataTag] - Expect(metadataTags).To(HaveLen(len(tags))) - for _, tag := range tags { - Expect(mf.Tags[model.TagMetadataTag]).To(ContainElement(tag)) - } + Expect(mf.Tags[model.TagMetadataTag]).To(ConsistOf(tags)) }, // weirder cases Entry("file with multiple tags", "ape-v1-v2.mp3", "ape", "id3v1", "id3v2"), diff --git a/adapters/taglib/taglib_wrapper.cpp b/adapters/taglib/taglib_wrapper.cpp index 1d918483a..762d7085c 100644 --- a/adapters/taglib/taglib_wrapper.cpp +++ b/adapters/taglib/taglib_wrapper.cpp @@ -189,14 +189,14 @@ int taglib_read(const FILENAME_CHAR_T *filename, unsigned long id) { if (m4afile->hasMP4Tag()) { goPutTagType(id, MP4_TAG); has_tag = true; - } - const auto itemListMap = m4afile->tag()->itemMap(); - for (const auto item: itemListMap) { - char *key = const_cast(item.first.toCString(true)); - for (const auto value: item.second.toStringList()) { - char *val = const_cast(value.toCString(true)); - goPutM4AStr(id, key, val); + const auto itemListMap = m4afile->tag()->itemMap(); + for (const auto item: itemListMap) { + char *key = const_cast(item.first.toCString(true)); + for (const auto value: item.second.toStringList()) { + char *val = const_cast(value.toCString(true)); + goPutM4AStr(id, key, val); + } } } } @@ -204,19 +204,22 @@ int taglib_read(const FILENAME_CHAR_T *filename, unsigned long id) { // WMA/ASF files may have additional tags not captured by the PropertyMap interface TagLib::ASF::File *asfFile(dynamic_cast(f.file())); if (asfFile != NULL) { - goPutTagType(id, ASF_TAG); - has_tag = true; - const TagLib::ASF::Tag *asfTags{asfFile->tag()}; - const auto itemListMap = asfTags->attributeListMap(); - for (const auto item : itemListMap) { - char *key = const_cast(item.first.toCString(true)); - for (auto j = item.second.begin(); - j != item.second.end(); ++j) { + if (asfTags != NULL) { + goPutTagType(id, ASF_TAG); + has_tag = true; - char *val = const_cast(j->toString().toCString(true)); - goPutStr(id, key, val); + const auto itemListMap = asfTags->attributeListMap(); + for (const auto item : itemListMap) { + char *key = const_cast(item.first.toCString(true)); + + for (auto j = item.second.begin(); + j != item.second.end(); ++j) { + + char *val = const_cast(j->toString().toCString(true)); + goPutStr(id, key, val); + } } } } @@ -303,7 +306,7 @@ char has_cover(const TagLib::FileRef f) { hasCover = !frameListMap["APIC"].isEmpty(); } } - // ----- AIFF + // ----- AIFF else if (TagLib::RIFF::AIFF::File * aiffFile{ dynamic_cast(f.file())}) { if (aiffFile->hasID3v2Tag()) { const auto& frameListMap{ aiffFile->tag()->frameListMap() }; diff --git a/resources/mappings.yaml b/resources/mappings.yaml index 7d32a5397..3fbdfb8be 100644 --- a/resources/mappings.yaml +++ b/resources/mappings.yaml @@ -202,7 +202,7 @@ main: # Additional tags. You can add new tags without the need to modify the code. They will be available as fields # for smart playlists additional: - # Internal tag type, reprentes medatada tag(s) found in the file + # Internal tag type, represents metadata tag(s) found in the file tags: aliases: [ __tags ] asin: