From cfb04f73a2fb4a3290cb81bc6b710d93f94d6c5d Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Wed, 18 Feb 2026 01:57:06 -0800 Subject: README: its more like 200 lines now after some qol --- README.md | 2 +- yt_radio.py | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/README.md b/README.md index 6a8cc39..3470fa6 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # yt-playlist-radio -Simple demo of YouTube playlist to m3u playlist, all in about 100 lines of Python. +Simple demo of YouTube playlist to m3u playlist, all in about 200 lines of Python. ## How to run? First set the environment variables as per `.env.template`, then just run it with gunicorn or something else (gunicorn comes bundled as part of the deps here) diff --git a/yt_radio.py b/yt_radio.py index aa6b896..d06516f 100644 --- a/yt_radio.py +++ b/yt_radio.py @@ -23,7 +23,6 @@ if not PLAYLIST_URL: raise RuntimeError("Please set PLAYLIST_URL environment variable") METADATA = {} -# Simple thread-safe cache for yt-dlp JSON outputs _CACHE_LOCK = threading.Lock() try: if os.path.exists(YTDLP_CACHE_FILE): @@ -84,7 +83,6 @@ def fetch_metadata(index, url): cached = _CACHE.get(url) if cached: try: - # cached may be the full yt-dlp JSON dict data = cached METADATA[index] = { "title": data.get("title", f"Track {index+1}"), @@ -112,7 +110,6 @@ def fetch_metadata(index, url): "artist": data.get("uploader", "Unknown"), "duration": data.get("duration", -1) } - # store full json in cache with _CACHE_LOCK: _CACHE[url] = data try: @@ -121,7 +118,6 @@ def fetch_metadata(index, url): logger.exception("Failed to persist cache after fetching %s", url) logger.debug("Fetched metadata for index %s: %s", index, METADATA[index]) except Exception: - # Fallback defaults METADATA[index] = { "title": f"Track {index+1}", "artist": "Unknown", -- cgit v1.2.3