diff --git a/local_podcast_generator.py b/local_podcast_generator.py index 1211f0d..8f32c2a 100644 --- a/local_podcast_generator.py +++ b/local_podcast_generator.py @@ -283,8 +283,30 @@ class LocalPodcastGenerator: def format_rfc2822_date(self, dt): """Formatiert ein Datum im RFC 2822 Format für RSS.""" # RFC 2822 Format: "Wed, 02 Oct 2002 08:00:00 +0000" - # Verwende die eingebaute strftime Funktion für korrekte Formatierung - return dt.strftime('%a, %d %b %Y %H:%M:%S +0000') + # Explizite englische Namen verwenden (unabhängig von Locale) + import locale + old_locale = locale.getlocale(locale.LC_TIME) + try: + # Versuche englisches Locale zu setzen + locale.setlocale(locale.LC_TIME, 'C') + formatted = dt.strftime('%a, %d %b %Y %H:%M:%S +0000') + except: + # Fallback: manuelle Formatierung + weekdays = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] + months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', + 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] + + weekday = weekdays[dt.weekday()] + month = months[dt.month - 1] + formatted = f"{weekday}, {dt.day:02d} {month} {dt.year} {dt.hour:02d}:{dt.minute:02d}:{dt.second:02d} +0000" + finally: + # Locale zurücksetzen + try: + locale.setlocale(locale.LC_TIME, old_locale) + except: + pass + + return formatted def format_duration(self, seconds): """Formatiert die Dauer in HH:MM:SS Format."""