From bf0a57b3c248559bae7f79ed422da978f47e033d Mon Sep 17 00:00:00 2001 From: Manuel Weiser Date: Sat, 5 Jul 2025 19:57:42 +0200 Subject: [PATCH] =?UTF-8?q?F=C3=BCge=20Funktion=20hinzu,=20um=20den=20RSS-?= =?UTF-8?q?Feed=20ins=20httpdocs-Verzeichnis=20zu=20kopieren=20und=20das?= =?UTF-8?q?=20Arbeitsverzeichnis=20f=C3=BCr=20den=20Server=20zu=20wechseln?= =?UTF-8?q?.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- local_podcast_generator.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/local_podcast_generator.py b/local_podcast_generator.py index 9c0b716..25ad42f 100644 --- a/local_podcast_generator.py +++ b/local_podcast_generator.py @@ -246,9 +246,25 @@ Ich spezialisiere mich auf House Music, die mehr als nur Beats bietet – sie er import http.server import socketserver import os + from pathlib import Path - # Wechsle in das Arbeitsverzeichnis - original_dir = os.getcwd() + # Kopiere den RSS-Feed ins httpdocs-Verzeichnis + if "../httpdocs" in self.audio_dir: + httpdocs_path = Path("../httpdocs").resolve() + if httpdocs_path.exists(): + # Kopiere RSS-Feed ins httpdocs-Verzeichnis + import shutil + source_feed = Path(self.output_file) + target_feed = httpdocs_path / self.output_file + if source_feed.exists(): + shutil.copy2(source_feed, target_feed) + print(f"📄 RSS-Feed kopiert nach: {target_feed}") + + # Wechsle ins httpdocs-Verzeichnis für den Server + os.chdir(httpdocs_path) + print(f"📁 Server-Root: {httpdocs_path}") + else: + print(f"⚠️ httpdocs-Verzeichnis nicht gefunden: {httpdocs_path}") class CustomHandler(http.server.SimpleHTTPRequestHandler): def end_headers(self): @@ -264,7 +280,7 @@ Ich spezialisiere mich auf House Music, die mehr als nur Beats bietet – sie er with socketserver.TCPServer(("", port), handler) as httpd: print(f"🌐 Server läuft auf http://localhost:{port}") print(f"📡 RSS-Feed: http://localhost:{port}/{self.output_file}") - print(f"🎵 Audio-Dateien: http://localhost:{port}/{self.audio_dir}/") + print(f"🎵 Audio-Dateien: http://localhost:{port}/_audio/") print("⏹️ Drücke Ctrl+C zum Beenden") httpd.serve_forever() except KeyboardInterrupt: