Fix MP3 comment tagging and remove Genre from settings metadata
This commit is contained in:
parent
e0e9d44065
commit
77e23ba52c
3 changed files with 11 additions and 6 deletions
6
app.py
6
app.py
|
|
@ -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.
|
||||
|
|
|
|||
7
booth_settings.json
Normal file
7
booth_settings.json
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"artist": "Trollgorithm",
|
||||
"album": "Theme Booth 2026",
|
||||
"year": "2026",
|
||||
"genre": null,
|
||||
"comment": "Custom booth song comment"
|
||||
}
|
||||
|
|
@ -237,10 +237,6 @@
|
|||
<td>Year</td>
|
||||
<td><input type="text" id="year" name="year" value="{{ metadata.get('year', '') }}" placeholder="e.g. 2026"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Genre</td>
|
||||
<td><input type="text" id="genre" name="genre" value="{{ metadata.get('genre', '') }}" placeholder="e.g. Country Metal"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Comment</td>
|
||||
<td><textarea id="comment" name="comment" rows="3" placeholder="e.g. Custom theme song generated at the booth">{{ metadata.get('comment', '') }}</textarea></td>
|
||||
|
|
|
|||
Reference in a new issue