mutagen
mutagen copied to clipboard
Cannot edit comments
I cannot edit the comments in mp3 files. Is there a way of doing this or is it something that could be added?
@George-Ogden Hi! Of course, you can! Take a look on example below:
from mutagen.id3 import ID3, COMM
mp3_file = r"D:\tmp\tmp_mp3\Track 09.mp3"
try:
id3v2_3 = ID3(mp3_file, translate=False, load_v1=False)
except mutagen.id3.ID3NoHeaderError:
# No ID3 header found; creating a new tag
id3v2_3 = ID3()
comment_field = u"Your long long long comment for ID3v2.3"
# Empty 'desc' is important to display in players
id3v2_3.add(COMM(encoding=3, lang='eng', desc='', text=comment_field))
id3v2_3.save(mp3_file, v2_version=3, v1=2)
If you still want to add short comment for ID3v1 as well - you can add this lines before comment_field
v1_comment = u"Your short comment for v1"
id3v2_3["COMM"] = COMM(encoding=3, lang='eng', desc='ID3v1 Comment', text=v1_comment)
I hope this will help! :)
I don't see any todo here. The user question got answered. Closing.