# player — Jellyfin music player in Jai

This is a vibe-coded project. Pure AI-assisted work. Take agency, but check `ai/` for current direction before making big calls.

## What this is

A desktop music player that talks to a Jellyfin server. End goal: looks like a ridiculous 2000s audio player that shipped on a CD-ROM with an album — chunky skinned UI, neon gradients, glossy buttons, a spectrum visualizer behind the now-playing screen, music-reactive shaders, artist art front and center.

## Build

```
cd /home/katajisto/player
/home/katajisto/bin/jai/bin/jai-linux build.jai
./build/player
```

`build.jai` is a metaprogram. It points the import path at `./modules` (vendored: `Jaison`) and falls back to the standard Jai modules at `/home/katajisto/bin/jai/modules`.

## Code layout

`src/main.jai` is intentionally tiny — it just `#load`s an `index.jai` from each subfolder. Each subfolder owns its surface area:

- `core/`   — app state, window, frame loop, time
- `jellyfin/` — HTTP client (libcurl), auth, library browsing, image fetch, stream URLs
- `audio/`  — Sound_Player wrapper, queue, FFT analysis for the visualizer
- `ui/`     — theme, fonts, and `views/` (one file per screen)
- `gfx/`    — custom shaders, texture loading
- `util/`   — log, helpers

Each folder has an `index.jai` that `#load`s every file in that folder. To add a file, drop it in and add a `#load` line.

## Dependencies

- **Simp** (Jai stdlib) — rendering
- **GetRect_LeftHanded** (Jai stdlib) — UI widgets
- **Sound_Player** (Jai stdlib) — audio playback (ALSA on linux, CoreAudio on mac)
- **Curl** (Jai stdlib) — HTTP to Jellyfin
- **Jaison** (vendored) — JSON
- **stb_image** (Jai stdlib) — single-header PNG/JPG decode for artist images
- **stb_vorbis** (Jai stdlib) — OGG decode for the (only) audio path

Cross-platform target: linux + macOS.

## AI notes

See `ai/` for live design notes:

- `ai/aesthetic.md` — visual direction
- `ai/architecture.md` — code layout rationale
- `ai/decisions.md` — decision log
- `ai/todo.md` — running todo / scratch

Update `ai/decisions.md` when you make a non-obvious choice. Update `ai/todo.md` when you punt on something.
