Yokan / rebuild
Course 1 8624561

SEASON_RECORDS.md

docs/features/SEASON_RECORDS.md

documentation / design asset89 lines
1# Anime season records23Parity stage 5 (diff rows E1, E11). Follows Animetail's pinned contract:4[AnimeSource](https://github.com/Animetailapp/Animetail/blob/d0eab5d6237dd09ebdb21a63fff5b66097c91087/source-api/src/main/kotlin/eu/kanade/tachiyomi/animesource/AnimeSource.kt),5`FetchType` and `SAnime.season_number`, and6[LocalAnimeSource](https://github.com/Animetailapp/Animetail/blob/d0eab5d6237dd09ebdb21a63fff5b66097c91087/source-local/src/main/kotlin/tachiyomi/source/local/entries/anime/LocalAnimeSource.kt).78## Model910A title has a fetch type: **Episodes** (default, every existing title) or **Seasons**.11A Seasons title has no episodes of its own; each season is a separate title record with12`parentId` pointing at it and an optional `seasonNumber` (unknown/-1 is stored as null).13Seasons may themselves be Seasons titles. Season records keep their own episodes,14progress, bookmarks, history and downloads.1516- Library, home and local-library lists show top-level titles only. Seasons are opened17  from their show's detail page; Back returns to the show.18- Season records are not favorites by default. Cache cleanup (`cleanDatabase`, browsed-title19  pruning) keeps seasons whose parent chain reaches a library title; once the show leaves20  the library they are ordinary cached titles again.21- Room v16 adds `manga.parentId`, `manga.fetchType` (default `Episodes`) and22  `manga.seasonNumber`; the same migration adds `chapter.fillerOverride` (stage 6).23- Native backups and hub documents carry the fields. Older backups/documents decode24  with Episodes/null defaults. Backup merge remaps `parentId` to merged IDs and never25  turns an incoming season into a library entry. Legacy Mangayomi exports omit the26  fields; legacy pulls keep local values.2728## Detail screen2930A Seasons title shows a keyed **Seasons** list instead of the episode list, in season31number then name order. Each row shows the cover, season label, watched/total count and32a progress bar; tapping opens the season's own detail page, and the play button resumes33its first unwatched episode. The show's Resume/Start button resumes the first season34with an unwatched episode. Compact and wide layouts use the same rows.3536## Sources3738- JavaScript: `getDetail(url)` may return `fetch_type: "Seasons"` (or `fetchType`, or39  ordinal `0`). The client then calls optional `getSeasonList(url)` or reads an inline40  `seasons` array. Each season accepts the listing aliases plus `season_number` and41  `fetch_type`. Lists are capped at 500; repeated URLs keep the first; a non-array is an error.42- Mihon: when `getDetailsAnime` reports `fetch_type: "Seasons"`, the client sends43  `getSeasonList` with `animeData.url` instead of `getEpisodeList`.44- The bundled Android bridge (`vendor/yokan-ext`) adds `FetchType`, `SAnime.fetch_type`45  and `season_number` (default getters, so binaries built against older interfaces46  link and report Episodes/-1), `AnimeSource.getSeasonList` (default empty) and the47  `getSeasonList` method. External desktop/iOS/web bridge binaries must forward the48  same fields; ones that omit `fetch_type` keep Episodes behavior.49- Refreshing a Seasons title (detail screen or library update) upserts its seasons:50  existing season records, or a previously browsed non-library title with the same51  source URL, are reused; seasons missing from a response are kept. The library52  updater then refreshes each season (nesting capped at four levels), so new episodes53  are recorded as updates of that season.54- Offline fallback returns the stored seasons of a Seasons title.5556## Local library5758Anime folders follow `LocalAnimeFetchTypeManager.find`: a folder containing a video or59archive file is an Episodes title; otherwise, a folder with non-hidden subfolders is a60Seasons title and each subfolder becomes a season record (`<show>/<season>`),61recursively. Season numbers come from recognized folder names (`Season 2`, `S02`).62Hidden folders are skipped. Yokan keeps its one-level flattening for Episodes titles:63a folder with root episodes still includes its immediate subfolders' episodes, with64the per-season selector. Download-layout type folders (`Anime`, `Manga`, …) directly65under a library root keep their existing title discovery. Backends without66immediate-child listings keep previous links unchanged.6768Upgrading existing libraries:69- A folder previously scanned as one flattened title because of a root image becomes a70  Seasons title. Its episodes move to the season records with the same IDs, progress,71  bookmarks, history and updates.72- Season folders previously listed as separate titles keep their IDs and progress and73  are linked under a new show record. If one was in the library, the show joins the74  library once with its categories; later removals are respected.7576Behavior difference from upstream: Yokan's local folders already flatten one subfolder77level for Episodes titles; upstream does too. Upstream treats every top-level folder78without root video as a Seasons title, so grouping folders (`Anime/Action/<show>`) also79become Seasons titles here.8081## Verification8283Verification passed 167 desktop checks, 84 Kotlin/Wasm browser tests and 17 Android bridge unit checks without failures/errors/skips, and all four targets compiled (shared stage 5/6 run). Tests cover the Room v15→1684migration/reopen, JS/Mihon decoding and bounds, repository and updater season refresh,85cleanup, backup remapping, legacy export, the detail ViewModel season list, real desktop86folders (progress/history move, library inheritance, rescan stability) and a real OPFS87scan. Bridge tests cover season forwarding and a class compiled against the older88interface. Native-device UI and external bridges are unverified. Season-list89filters/sort (diff row E2) are not implemented.90

Search chapters, reference and source filenames.