Verbessere die Extraktion von Kommentar-Tags in MP3-Metadaten mit erweiterten Fehlerbehandlungen und verbesserten Ausgaben.

This commit is contained in:
2025-07-06 11:11:43 +02:00
parent f509f898ef
commit 1621e37876

View File

@ -89,15 +89,25 @@ class LocalPodcastGenerator:
album = str(audio.tags.get('TALB', [''])[0]) if audio.tags.get('TALB') else None
# Comment-Tag extrahieren (COMM = Comment)
if audio.tags.get('COMM::eng'):
comment = str(audio.tags.get('COMM::eng', [''])[0])
elif audio.tags.get('COMM'):
# Fallback für allgemeine COMM-Tags
comment_tags = audio.tags.getall('COMM')
if comment_tags:
comment = str(comment_tags[0])
try:
# Versuche verschiedene Comment-Tag-Formate
if 'COMM::eng' in audio.tags:
comment = str(audio.tags['COMM::eng'])
elif 'COMM::' in str(audio.tags.keys()):
# Suche nach COMM-Tags mit beliebiger Sprache
for key in audio.tags.keys():
if key.startswith('COMM::'):
comment = str(audio.tags[key])
break
else:
# Versuche allgemeine COMM-Tags
comm_tags = audio.tags.getall('COMM')
if comm_tags:
comment = str(comm_tags[0])
except Exception as comm_error:
print(f" ⚠️ Fehler beim Lesen des Comment-Tags: {comm_error}")
if comment:
if comment and comment.strip():
print(f" 💬 Comment gefunden: {comment[:50]}...")
# Cover-Art extrahieren (APIC = Attached Picture)
@ -446,6 +456,9 @@ Ich spezialisiere mich auf House Music, die mehr als nur Beats bietet sie er
# Füge Comment hinzu falls vorhanden
if metadata['comment'] and metadata['comment'].strip():
description_text += f"\n\n{metadata['comment']}"
print(f" 📝 Beschreibung erweitert mit Comment ({len(metadata['comment'])} Zeichen)")
else:
print(f" 📝 Standard-Beschreibung verwendet (kein Comment)")
item_description.text = description_text