Add Live Ozan Radio — DeepSeek DJ, Lyria 3, and player chat.
Personal AI station that generates tracks from taste seeds or Spotify; safe to share — secrets and cache are gitignored. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import asyncio
|
||||
|
||||
import uvicorn
|
||||
|
||||
from ozan_radio.config import Config
|
||||
from ozan_radio.dj import DeepSeekDJ
|
||||
from ozan_radio.lyria import LyriaEngine
|
||||
from ozan_radio.queue import RadioQueue
|
||||
from ozan_radio.server import app
|
||||
from ozan_radio.spotify import SpotifyTaste
|
||||
from ozan_radio.taste import load_taste_seeds
|
||||
|
||||
|
||||
async def generate_one() -> None:
|
||||
"""CLI: generate a single track and print the result."""
|
||||
cfg = Config.from_env()
|
||||
taste = await SpotifyTaste(cfg).fetch_taste()
|
||||
seeds = None if taste else load_taste_seeds()
|
||||
if taste:
|
||||
print(f"Taste: {taste.summary}\n")
|
||||
elif seeds:
|
||||
print(f"Taste seeds: {seeds.summary}\n")
|
||||
else:
|
||||
print("No Spotify or seeds — DJ will freestyle.\n")
|
||||
|
||||
q = RadioQueue(cfg.output_dir)
|
||||
plan = await DeepSeekDJ(cfg).plan_next(taste, q.recent_titles, seeds)
|
||||
print(f"DJ: {plan.dj_line}")
|
||||
print(f"Title: {plan.title}")
|
||||
print(f"Prompt: {plan.lyria_prompt}\n")
|
||||
print("Generating with Lyria 3…")
|
||||
|
||||
track = LyriaEngine(cfg).generate(plan)
|
||||
q.add(track)
|
||||
print(f"Saved: {track.audio_path}")
|
||||
|
||||
|
||||
def main() -> None:
|
||||
parser = argparse.ArgumentParser(description="Live Ozan Radio")
|
||||
parser.add_argument(
|
||||
"command",
|
||||
nargs="?",
|
||||
default="serve",
|
||||
choices=["serve", "generate"],
|
||||
help="serve = start radio server, generate = one-shot track",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.command == "generate":
|
||||
asyncio.run(generate_one())
|
||||
return
|
||||
|
||||
cfg = Config.from_env()
|
||||
uvicorn.run(app, host=cfg.radio_host, port=cfg.radio_port, log_level="info")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user