# scorpiox-scorpioplayer-media-library-home-rows-model

**SCORPIO PLAYER 2027** — pure C engine. Home/library row policy: Continue Watching,
Recently Added, Movies/TV → seasons → episodes, folders, favourites, item detail with
playable sources, resume decision, next episode. No shell decides what goes on the home
screen.

Status: **implemented** — 67 exports, 246-assertion test suite green, ASAN/UBSAN clean.

| Key | Value |
|---|---|
| Project | SCORPIO PLAYER 2027 |
| Language | C99, zero external deps (JSON = vendored yyjson 0.12.0) |
| Prefix | `sphrm_` |
| Spec | `SPEC.md` §1–14 |
| Console harness | `scorpiox-scorpioplayer-media-library-home-rows-model.console` |
| Spec sources | TPlayer `HomePageViewModel.cs`, `Views/Events.cs:1576-1631`, `MoviePage.xaml`; IOSLegacy `NewHomePageViewModel.cs`; `bosxixi.ScorpioPlayer.Core` `DebridDownloadConfig.cs:108-127` |

## Code as spec, not as source

The three frozen codebases (TPlayer UWP, IOSLegacy Uno, Core) are read-only reference
corpora. Every threshold (the 30-second fraction gate, the 5-second tail, the row order,
the hidden-section list) was measured line by line into `SPEC.md` first; the C is written
from the spec. Engines never link engines: everything comes in as JSON the shell already
got from shipped clients (`spcat_`, `spmovie_`, `spfiles_`, `spmcat_`, `spis_`, `spfsc_`).

## Build

```bash
make                # CLI (sphrm) + libscorpiox-…-home-rows-model.so
make test           # unit + fixture tests, exports check, corpus drive
make asan           # ASAN+UBSAN+leaks over the whole suite
make fuzz           # clang libFuzzer harness (tests/fuzz_sphrm.c)
make fuzz-run       # FUZZ_SECONDS=60 ./sphrm-fuzz …
./tests/check_exports.sh   # exports.json == nm -D (67)
```

CLI: `./sphrm version|test|rows|result|detail|stats|flags|watchlist|history|cell|sources|next|autoplay|stable|resume-key|legacy-key …`

## Inputs

`sphrm_load_inputs()` takes one object with five optional blocks (`server_home`,
`items`, `watch`, `library`, `store`) — SPEC §2. A bare array is treated as `items`.
Long strings (>8192 B) are truncated, never fatal. Duplicate item ids: first wins,
second counted in `stats.rejected`.

## Tracker

`scorpio-player-2027-pure-c-dll-fleet-from-tplayer-uwp-and-ioslegacy-uno-code-as-spec-tracker`
in the picobot repo.

## Licence

- Engine code: MIT-style project work under Pico channel rules.
- Vendored `yyjson`: MIT (`vendor/LICENSE`).
