--- title: Cadence sdk: static app_port: 7860 pinned: false app_build_command: npm run build --- # 🎧 Cadence β€” YouTube music dashboard **Three ways to run it:** | | What | Needs | |---|---|---| | **`cadence-dashboard.html`** | The whole dashboard in **one file** β€” double-click it, host it anywhere, no install | nothing (demo mode) | | **This project** | The same dashboard wired to a real backend: YouTube Music search, radio, audio streaming | Python 3 (`./run.sh`) | | **`cadence-android/`** | The same dashboard as an **installable Android app** (PWA): home-screen icon, full-screen, offline | any https static host | The single file starts in **demo mode** (built-in catalog, simulated playback, every panel and interaction live) and can be pointed at the backend from **βš™ Settings** for real search and audio. To rebuild it after editing the dashboard: `python3 standalone/build_standalone.py`. --- # Backend version Search any song by name, stream it, and let the engine keep the music going with artist radios and similar-song suggestions β€” wrapped in a browser dashboard with live playback, suggestion and cache telemetry. No API key needed: search/radio/artist/genre data comes from YouTube Music's public data (via `ytmusicapi`), and the audio is pulled with `yt-dlp` and served by this server so the browser can play, seek and buffer it like a normal audio file. ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Cadence Β· dashboard [ search songs, artists, albums… ] CH Queue β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ Overview β”‚ β–’ now playing β–’ queue β–’ buffered β–’ radio β”‚ Up next β”‚ β”‚ Search β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ (queue rail) β”‚ β”‚ Trending β”‚ β”‚ Now playing β”‚ β”‚ Suggestion feed β”‚ β”‚ track 3 of 42 β”‚ β”‚ Genres β”‚ β”‚ art + controls β”‚ β”‚ + reason labels β”‚ β”‚ ... β”‚ β”‚ Recent β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ ─────── β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ Engine β”‚ β”‚ Trending in CH β”‚ β”‚ Trending artists β”‚ β”‚ β”‚ β”‚ cache … β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ now playing Β· transport Β· seek Β· volume β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` ## Run it ```bash ./run.sh # installs deps if needed β†’ http://localhost:8000 # or pip install -r requirements.txt PORT=8000 python3 app.py ``` Then open **http://localhost:8000** (dashboard) β€” the older single-column player is kept at **/classic**. ## Dashboard views | View | What you get | |---|---| | **Overview** | Live tiles (now playing, queue depth, *buffered ahead*, radio engine), a now-playing hero with one-click *Play similar* / *Artist radio*, the **suggestion feed** with a reason per track ("Up next", "Similar to X", "More from X"), trending tracks + artists, and recently played | | **Search** | Any song / artist / album by name, with live suggestions in the search box; artists render as cards, songs as a playable list | | **Trending** | YouTube Music charts for 69 regions (defaults to πŸ‡¨πŸ‡­ Switzerland) β€” charting tracks plus trending artists with rank and up/down trend | | **Genres & moods** | 38 tiles (moods + genres) β†’ curated playlists β†’ playable track lists, all browsable without typing anything | | **Artist** | Top songs, monthly listeners, "Fans also like" similar artists, albums & singles | | **Album / playlist** | Full track lists with play-all and per-track *similar songs* | | **Recently played** | Local listening history (stored in your browser) | | **Queue rail** | The full upcoming queue, click any row to jump; collapses via the Queue button | | **Engine panel** | Server telemetry: cache size vs. 3 GB cap, tracks cached, downloads, average fetch time, in-flight downloads, uptime | Everything is hash-routed (`#/artist/…`, `#/playlist/…`, `#/genre/…`), so views are shareable and the browser back button works. ## How the "keep playing" engine works * Play any track β†’ the server downloads the audio once into a local cache and serves it with HTTP Range support (seeking/buffering/replays are instant). * While you listen, the next track is **prefetched** β€” the "Buffered ahead" tile polls `/api/ready/` and flips to *Ready βœ“* when it's on disk. * When the queue runs low, radio suggestions for the current track are appended automatically (the "Radio" badge appears in the player bar), so playback never dead-ends. * ✨ on any row = "play similar songs" β†’ seeds a station from that track. ## Keyboard `/` search Β· `space` play/pause Β· `n` / `p` next/prev Β· `←` `β†’` skip 10 s Β· `s` shuffle Β· `r` repeat (off/queue/track) Β· `m` mute Β· `q` toggle queue rail. OS media keys work too. ## API | Endpoint | Purpose | |---|---| | `GET /api/search?q=&limit=` | songs + artists for a query | | `GET /api/suggest?q=` | search-box autocomplete | | `GET /api/radio?videoId=&limit=` | "similar songs" / up-next radio for a track | | `GET /api/artist?id=\|name=` | top songs, albums, similar artists, monthly listeners | | `GET /api/artist/radio?id=` | continuous artist station | | `GET /api/trending?country=CH` | regional chart tracks + trending artists + region list | | `GET /api/genres` Β· `GET /api/genre?params=` Β· `GET /api/playlist?id=` | browse tree and playlists | | `GET /api/album?id=` | album track list | | `GET /api/stream/` | cached audio with Range support (the `