Fix generation JSON/Lyria errors, add Winamp player, and ship Echoes of the Sahel.
Harden DeepSeek JSON parsing with retry, pre-sanitize Lyria prompts, and instrumental fallback. Add pure HTML Winamp skin at /winamp with playlist export support. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -3,7 +3,12 @@ from __future__ import annotations
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
from ozan_radio.web_playlist import PLAYLIST_MARKER, build_playlist_payload, export_gateway_playlist
|
||||
from ozan_radio.web_playlist import (
|
||||
PLAYLIST_MARKER,
|
||||
build_playlist_payload,
|
||||
embed_playlist_in_html,
|
||||
export_gateway_playlist,
|
||||
)
|
||||
|
||||
|
||||
def test_build_playlist_payload_excludes_skip(songs_dir: Path):
|
||||
@@ -14,6 +19,13 @@ def test_build_playlist_payload_excludes_skip(songs_dir: Path):
|
||||
assert payload["tracks"][0]["url"].startswith("https://tinqs.com/tinqs/live-radio/media/")
|
||||
|
||||
|
||||
def test_embed_playlist_in_html_replaces_marker():
|
||||
html = f"<script>{PLAYLIST_MARKER}\n{{}}\n{PLAYLIST_MARKER}</script>"
|
||||
out = embed_playlist_in_html(html, {"tracks": [{"id": "abc"}]})
|
||||
assert '"abc"' in out
|
||||
assert PLAYLIST_MARKER in out
|
||||
|
||||
|
||||
def test_export_gateway_playlist_writes_json_and_embeds(tmp_path: Path, songs_dir: Path):
|
||||
gateway = tmp_path / "gateway"
|
||||
gateway.mkdir()
|
||||
@@ -22,6 +34,11 @@ def test_export_gateway_playlist_writes_json_and_embeds(tmp_path: Path, songs_di
|
||||
f"<script>\n{PLAYLIST_MARKER}\n{{}}\n{PLAYLIST_MARKER}\n</script>\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
winamp = gateway / "winamp.html"
|
||||
winamp.write_text(
|
||||
f"<script>\n{PLAYLIST_MARKER}\n{{}}\n{PLAYLIST_MARKER}\n</script>\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
(tmp_path / "songs").mkdir(exist_ok=True)
|
||||
for f in songs_dir.iterdir():
|
||||
dest = tmp_path / "songs" / f.name
|
||||
@@ -34,3 +51,5 @@ def test_export_gateway_playlist_writes_json_and_embeds(tmp_path: Path, songs_di
|
||||
html = index.read_text(encoding="utf-8")
|
||||
assert "11111111" in html
|
||||
assert PLAYLIST_MARKER in html
|
||||
whtml = winamp.read_text(encoding="utf-8")
|
||||
assert "11111111" in whtml
|
||||
|
||||
Reference in New Issue
Block a user