Some files may contain custom tags, which are not hardcoded in the library. For example I encountered a file with "album artist" instead of "albumartist". Or I can just insert "abc" tag in a program like Picard or mp3tag to test a completely random tag name.
Removing them with f.remove_tag(tag_name) doesn't work. For "album artist", the tag is still in the file after saving. For "abc", a KeyError is raised during lookup in AudioFile.tag_map, which does not contain "abc" entry, even though there is a tag named like that in the audio file.
Some files may contain custom tags, which are not hardcoded in the library. For example I encountered a file with "album artist" instead of "albumartist". Or I can just insert "abc" tag in a program like Picard or mp3tag to test a completely random tag name.
Removing them with
f.remove_tag(tag_name)
doesn't work. For "album artist", the tag is still in the file after saving. For "abc", aKeyError
is raised during lookup inAudioFile.tag_map
, which does not contain "abc" entry, even though there is a tag named like that in the audio file.I found a workaround based on https://github.com/KristoforMaynard/music-tag/issues/28:
del f.mfile.tags[tag_name]
However, it doesn't look like the expected usage of the API.