# CLAUDE.md This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. ## What this is A static, responsive single-page site listing the user's TV series, ranked by a fixed personal ranking, with poster/title/year/season-count sourced from a local Plex Media Server library. No build step, no framework, no dependencies — plain HTML/CSS/JS served as static files. Deployed to Vercel (`https://serie-tv.vercel.app`), auto-deploying on every push to `main` via a connected GitHub repo (`paoloalby/serie-tv`, private). ## Data pipeline The site's data does not come from an API at request time — it's pre-generated and committed as static JSON/images. 1. **`data/rank.json`** — the source of truth for ordering: a hand-maintained list of `{rank, title, year}` reflecting the user's personal ranking. Edit this file to reorder, add, or remove series from the site. 2. **`data/plex-shows.json`** (gitignored, not committed) — raw export of the full Plex "Serie TV" library section (`title`, `year`, `seasons`, `ratingKey`). Regenerated by pulling from the local Plex server (`http://127.0.0.1:32400`), which requires an `X-Plex-Token` obtained from the Plex web UI's `localStorage` (`myPlexAccessToken`). This token must never be printed/logged — see `scripts/relay.py`. 3. **`scripts/relay.py`** — a throwaway local HTTP relay (port 8765) used to pull poster images and metadata out of the Plex web UI's browser context (where the auth token lives) without the token ever having to be typed, printed, or pasted anywhere. Run it, then from the Plex tab's JS console/devtools POST metadata to `/metadata` and poster blobs to `/poster/`. It writes `data/plex-shows.json` and `public/posters/.jpg`. Not needed unless refreshing the Plex export. 4. **`scripts/build-data.py`** — merges `data/rank.json` with `data/plex-shows.json` by normalized title (+ year fallback), and writes the final `public/data.json` consumed by the page. Run this after updating `data/rank.json` or re-pulling Plex data: ``` python3 scripts/build-data.py ``` It prints how many ranked entries matched and lists any unmatched titles — check this output after edits, since a typo in `rank.json` silently drops that series from the site. 5. Unused posters (in the Plex library but not in the current ranking) are pruned from `public/posters/` before committing, to keep the repo small. ## Site (`public/`) - `public/index.html` — the entire site: inline `