Files
proton-stream/crates/pstr-meta/src/lib.rs
T
nvrl 4c80076762 fix(core,meta,app,android,cli): number episodes the way releases do
AniList's per-season lookup searched for "<title> 2nd Season" and the
scorer picked the base entry again, so Attack on Titan seasons 2-4 and
Jigokuraku season 2 were captioned with season one's names. Episode
names came from streamingEpisodes, which is partial and numbered however
a streaming site counted. Bleach S17 and Mushishi S02/S03 had none.

AniList now walks SEQUEL relations from the match and takes each
entry's episodes from ani.zip, which carries TVDB's season, number and
absolute number. An episode row keeps all three plus its place in the
AniList entry. EpisodeGuide::get matches whichever numbering a file
uses and never answers from another season.

Episodes and fanart are stored as one enrichment. The episode list is
replaced even when empty, and the enrichment is recorded as asked, so a
film is not re-asked every run. Storing a different match drops the old
entry's episode rows. AniList's 4.75:1 bannerImage is no longer stored
as the 16:9 backdrop; ani.zip's 1920x1080 fanart is used instead.

Schema v9 adds the columns and deletes the AniList episode rows and
banners. Matches are kept. Desktop, Android and the CLI now share
service::plan and MetadataService::work. The settings text names
ani.zip. Audit and roadmap in docs/METADATA.md; bug entry B61.
2026-10-04 00:47:41 +02:00

45 lines
1.9 KiB
Rust

//! Matching a library's titles against a metadata provider.
//!
//! What this crate is for is the gap between what a filename says and what a
//! poster wall wants: a share filled by the Proton Drive Linux client carries no
//! thumbnails at all — Proton renders those at upload time and that client
//! attaches none — so without enrichment every tile in the grid is a pair of
//! initials on a grey rectangle. See `docs/DEVELOPMENT.md`.
//!
//! ```text
//! Title ──▶ Query ──▶ Provider::search ──▶ [Candidate] ──▶ matching::best
//! (anilist | tmdb) │
//! ▼
//! Enrichment ◀── Provider::enrich ◀──────────────────── TitleMetadata
//! (episodes, fanart) (anilist relations + ani.zip | tmdb)
//! ```
//!
//! Three things are worth knowing before touching any of it:
//!
//! * **It is off by default and says why.** Enrichment sends the titles in
//! someone's library to a third party. The switch is theirs, the reasoning is
//! in `pstr_core::metadata`, and nothing here runs until it is on.
//! * **A wrong match is worse than no match.** The wrong poster does not look
//! like a bug, it looks like the library is wrong — so
//! [`matching::MATCH_FLOOR`] is high and a weak field yields nothing.
//! * **Misses are cached and failures are not.** See [`service`].
//!
//! The model — [`pstr_core::metadata::TitleMetadata`] and friends — deliberately
//! lives in `pstr-core`, so the catalog can store it and the UI can draw it
//! without either depending on this crate.
pub mod anilist;
pub mod anizip;
pub mod error;
pub mod limiter;
pub mod matching;
pub mod provider;
pub mod service;
pub mod settings;
pub mod tmdb;
pub use error::{Error, Result};
pub use matching::{Candidate, Query};
pub use provider::Provider;
pub use service::MetadataService;