I am running mutagen 1.2. When I run the code on Windows I get a different result than on Linux. The key of the COMM frame in the dictionary of frames is different. Here is example code:
#!python
from mutagen.id3 import ID3, COMM
def creat(file):
audio = ID3(file)
audio.add(COMM(desc="iTunNORM", lang="eng", text="000", encoding=3))
audio.save()
file = 'muta.mp3'
creat(file)
audio = ID3(file)
print(audio)
# on Windows this outputs:
# {u'COMM:iTunNORM:eng': COMM(encoding=3, lang='eng', desc=u'iTunNORM', text=[u'000']), 'TIT2': TIT2(encoding=0, text=[u'test'])}
# on Linux this outputs:
# {u"COMM:iTunNORM:'eng'": COMM(encoding=3, lang='eng', desc=u'iTunNORM', text=[u'000']), 'TIT2': TIT2(encoding=0, text=[u'test'])}
# in the key, there are single quotes around eng for Linux but not for Windows
if audio.get(u"COMM:iTunNORM:'eng'"):
print('on linux')
if audio.get(u"COMM:iTunNORM:eng"):
print('on windows')
Original comment byDaniel Plachotich (Bitbucket: danpla, GitHub: danpla):
Mutagen 1.2 is very outdated. It uses %r to represent lang
(f580734) while newer versions use %s. That's why you got extra quotes.
Simply update mutagen to the recent version on Linux.
Originally reported by: Anonymous
I am running mutagen 1.2. When I run the code on Windows I get a different result than on Linux. The key of the COMM frame in the dictionary of frames is different. Here is example code: