Add pytest suite, unlimited daily cap, and vocal batch generator.
Tests cover curation, Lyria, queue, and API routes. Setting max_new_songs_per_day to 0 disables the limit; generate-batch runs 20 curated multilingual vocal directions. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
from ozan_radio.web_playlist import PLAYLIST_MARKER, build_playlist_payload, export_gateway_playlist
|
||||
|
||||
|
||||
def test_build_playlist_payload_excludes_skip(songs_dir: Path):
|
||||
payload = build_playlist_payload(songs_dir)
|
||||
ids = [t["id"] for t in payload["tracks"]]
|
||||
assert "11111111" in ids
|
||||
assert "22222222" not in ids
|
||||
assert payload["tracks"][0]["url"].startswith("https://tinqs.com/tinqs/live-radio/media/")
|
||||
|
||||
|
||||
def test_export_gateway_playlist_writes_json_and_embeds(tmp_path: Path, songs_dir: Path):
|
||||
gateway = tmp_path / "gateway"
|
||||
gateway.mkdir()
|
||||
index = gateway / "index.html"
|
||||
index.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
|
||||
dest.write_bytes(f.read_bytes())
|
||||
|
||||
result = export_gateway_playlist(tmp_path)
|
||||
assert result is not None
|
||||
data = json.loads((tmp_path / "gateway" / "playlist.json").read_text(encoding="utf-8"))
|
||||
assert len(data["tracks"]) == 1
|
||||
html = index.read_text(encoding="utf-8")
|
||||
assert "11111111" in html
|
||||
assert PLAYLIST_MARKER in html
|
||||
Reference in New Issue
Block a user