KristoforMaynard / music-tag

Simple interface to edit audio file metadata
MIT License
125 stars 19 forks source link

Removing custom tags #43

Open DziubanMaciej opened 1 year ago

DziubanMaciej commented 1 year ago

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.

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.