From 919160102a269c19203c3b03d371f99372e00baf Mon Sep 17 00:00:00 2001 From: Manuel Weiser Date: Sat, 5 Jul 2025 20:25:26 +0200 Subject: [PATCH] =?UTF-8?q?Verbessere=20die=20Podcast-Feed-Erstellung=20du?= =?UTF-8?q?rch=20Hinzuf=C3=BCgen=20von=20Metadaten=20f=C3=BCr=20bessere=20?= =?UTF-8?q?Kompatibilit=C3=A4t=20mit=20Podcast-Apps=20und=20korrekte=20For?= =?UTF-8?q?matierung=20von=20Ver=C3=B6ffentlichungsdaten.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- local_podcast_generator.py | 49 +++++++++++++++++++++++++++++++++----- 1 file changed, 43 insertions(+), 6 deletions(-) diff --git a/local_podcast_generator.py b/local_podcast_generator.py index 7dad3ce..8aebf52 100644 --- a/local_podcast_generator.py +++ b/local_podcast_generator.py @@ -174,7 +174,7 @@ Ich spezialisiere mich auf House Music, die mehr als nur Beats bietet – sie er # Channel Element channel = ET.SubElement(rss, "channel") - # Channel Metadaten + # Channel Metadaten mit besserer Podcast-Kompatibilität title = ET.SubElement(channel, "title") title.text = podcast_title @@ -187,20 +187,41 @@ Ich spezialisiere mich auf House Music, die mehr als nur Beats bietet – sie er language = ET.SubElement(channel, "language") language.text = "de-DE" - # iTunes-spezifische Tags + # Wichtig: lastBuildDate für bessere Erkennung von Updates + last_build = ET.SubElement(channel, "lastBuildDate") + last_build.text = datetime.now().strftime('%a, %d %b %Y %H:%M:%S +0000') + + # pubDate für den Channel + channel_pub_date = ET.SubElement(channel, "pubDate") + channel_pub_date.text = datetime.now().strftime('%a, %d %b %Y %H:%M:%S +0000') + + # Generator Info + generator = ET.SubElement(channel, "generator") + generator.text = "SERMAN Local Podcast Generator" + + # iTunes-spezifische Tags für bessere Podcast-App-Kompatibilität itunes_author = ET.SubElement(channel, "itunes:author") itunes_author.text = podcast_author itunes_summary = ET.SubElement(channel, "itunes:summary") itunes_summary.text = podcast_description + # iTunes Kategorie itunes_category = ET.SubElement(channel, "itunes:category") itunes_category.set("text", "Music") + # Sub-Kategorie für bessere Einordnung + itunes_sub_category = ET.SubElement(itunes_category, "itunes:category") + itunes_sub_category.set("text", "Music Commentary") + # Explicit Content itunes_explicit = ET.SubElement(channel, "itunes:explicit") itunes_explicit.text = "false" + # iTunes Type (für episodische Podcasts) + itunes_type = ET.SubElement(channel, "itunes:type") + itunes_type.text = "episodic" + # Standard-Bild (kann später angepasst werden) image_url = f"{self.base_url}/_img/podcast-cover.png" image = ET.SubElement(channel, "image") @@ -247,9 +268,11 @@ Ich spezialisiere mich auf House Music, die mehr als nur Beats bietet – sie er item_guid.text = audio_url item_guid.set("isPermaLink", "true") - # Veröffentlichungsdatum + # Veröffentlichungsdatum (korrekt formatiert für RSS) item_pubdate = ET.SubElement(item, "pubDate") - item_pubdate.text = metadata['pub_date'].strftime('%a, %d %b %Y %H:%M:%S %z') + # RFC 2822 Format für RSS (mit Timezone) + pub_date_formatted = metadata['pub_date'].strftime('%a, %d %b %Y %H:%M:%S +0000') + item_pubdate.text = pub_date_formatted # Audio-Enclosure enclosure = ET.SubElement(item, "enclosure") @@ -262,7 +285,7 @@ Ich spezialisiere mich auf House Music, die mehr als nur Beats bietet – sie er item_duration = ET.SubElement(item, "itunes:duration") item_duration.text = self.format_duration(metadata['duration']) - # iTunes-spezifische Tags + # iTunes-spezifische Tags für bessere Episode-Erkennung itunes_title = ET.SubElement(item, "itunes:title") itunes_title.text = metadata['title'] @@ -272,8 +295,22 @@ Ich spezialisiere mich auf House Music, die mehr als nur Beats bietet – sie er itunes_explicit_item = ET.SubElement(item, "itunes:explicit") itunes_explicit_item.text = "false" - # Episode-Cover hinzufügen (falls vorhanden) + # iTunes Episode Typ + itunes_episode_type = ET.SubElement(item, "itunes:episodeType") + itunes_episode_type.text = "full" + + # Episode-Cover hinzufügen (falls vorhanden) - beide Formate für bessere Kompatibilität if episode_cover_url: + # Standard RSS image tag + item_image = ET.SubElement(item, "image") + item_image_url = ET.SubElement(item_image, "url") + item_image_url.text = episode_cover_url + item_image_title = ET.SubElement(item_image, "title") + item_image_title.text = metadata['title'] + item_image_link = ET.SubElement(item_image, "link") + item_image_link.text = audio_url + + # iTunes image tag itunes_image_item = ET.SubElement(item, "itunes:image") itunes_image_item.set("href", episode_cover_url)