Fix MP3 comment tagging and remove Genre from settings metadata

This commit is contained in:
Troll (Hermes Agent) 2026-08-01 22:35:51 +00:00
parent e0e9d44065
commit 77e23ba52c
3 changed files with 11 additions and 6 deletions

6
app.py
View file

@ -159,13 +159,15 @@ def apply_mp3_tags(path, title=None):
audio.save()
# Comment requires a real ID3 frame, not EasyID3.
# Comment requires a real ID3 frame, not EasyID3. Write both COMM and a TXXX
# "Comment" frame for broad compatibility across players and readers.
if cfg.get('comment'):
from mutagen.id3 import ID3, COMM
from mutagen.id3 import COMM, TXXX
audio2 = MP3(path)
if audio2.tags is None:
audio2.add_tags()
audio2.tags["COMM"] = COMM(encoding=3, lang='eng', desc='Comment', text=cfg['comment'])
audio2.tags["TXXX:Comment"] = TXXX(encoding=3, desc='Comment', text=cfg['comment'])
audio2.save()
except Exception as e:
# Don't fail the upload just because tagging failed; log/flash only if inside request context.