aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPinapelz <yukais@pinapelz.com>2026-02-18 01:57:06 -0800
committerPinapelz <yukais@pinapelz.com>2026-02-18 01:57:06 -0800
commitcfb04f73a2fb4a3290cb81bc6b710d93f94d6c5d (patch)
treeb99e768407d8381a555db1c92f5202c490b48a61
parent582a8dca61281f6b4c7885c3f0a24d762a19c1d6 (diff)
README: its more like 200 lines now after some qol
-rw-r--r--README.md2
-rw-r--r--yt_radio.py4
2 files changed, 1 insertions, 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",
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage