KristoforMaynard / music-tag

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

Can't remove a tag #35

Closed VikasRana closed 1 year ago

VikasRana commented 1 year ago

This is what f.mfile loads: {'copyright': ['2023 Viper Recordings'], 'comment': [''], 'compilation': ['1'], 'title': ['Rituals VIP'], 'album': ['Viper Presents: Annual 2023'], 'disctotal': ['01'], 'date': ['2023'], 'discnumber': ['1'], 'tracktotal': ['26'], 'albumartist': ['VA'], 'tracknumber': ['2'], 'year': ['2023'], 'genre': ['Drum & Bass'], 'artist': ['Millbrook']}

I want to remove 'date': ['2023']

I am doing del f['date'] f.remove_tag('date') f.save()

Error I'm getting: Traceback (most recent call last): File ".\test.py", line 6, in <module> del f['date'] File "C:\Python39\lib\site-packages\music_tag\file.py", line 609, in __delitem__ self.remove_tag(norm_key) File "C:\Python39\lib\site-packages\music_tag\file.py", line 555, in remove_tag tmap = self.tag_map[norm_key] KeyError: 'date'

KristoforMaynard commented 1 year ago

This tool has no concept of "date". You will need to remove it using the mutagen interface. Try something like del f.mfile['date'].