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 album = str(audio.tags.get('TALB', [''])[0]) if audio.tags.get('TALB') else None
# Comment-Tag extrahieren (COMM = Comment) # Comment-Tag extrahieren (COMM = Comment)
if audio.tags.get('COMM::eng'): try:
comment = str(audio.tags.get('COMM::eng', [''])[0]) # Versuche verschiedene Comment-Tag-Formate
elif audio.tags.get('COMM'): if 'COMM::eng' in audio.tags:
# Fallback für allgemeine COMM-Tags comment = str(audio.tags['COMM::eng'])
comment_tags = audio.tags.getall('COMM') elif 'COMM::' in str(audio.tags.keys()):
if comment_tags: # Suche nach COMM-Tags mit beliebiger Sprache
comment = str(comment_tags[0]) 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]}...") print(f" 💬 Comment gefunden: {comment[:50]}...")
# Cover-Art extrahieren (APIC = Attached Picture) # 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 # Füge Comment hinzu falls vorhanden
if metadata['comment'] and metadata['comment'].strip(): if metadata['comment'] and metadata['comment'].strip():
description_text += f"\n\n{metadata['comment']}" 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 item_description.text = description_text