diff options
| author | Pinapelz <yukais@pinapelz.com> | 2026-02-18 01:57:06 -0800 |
|---|---|---|
| committer | Pinapelz <yukais@pinapelz.com> | 2026-02-18 01:57:06 -0800 |
| commit | cfb04f73a2fb4a3290cb81bc6b710d93f94d6c5d (patch) | |
| tree | b99e768407d8381a555db1c92f5202c490b48a61 | |
| parent | 582a8dca61281f6b4c7885c3f0a24d762a19c1d6 (diff) | |
README: its more like 200 lines now after some qol
| -rw-r--r-- | README.md | 2 | ||||
| -rw-r--r-- | yt_radio.py | 4 |
2 files changed, 1 insertions, 5 deletions
@@ -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", |
