Files
arr/crates/arr-meta/src/lib.rs
T
Miguel Palhas 0fa422e170
ci / web (pull_request) Successful in 6s
ci / rust (pull_request) Successful in 46s
feat(meta): TMDB search and movie lookup
Search and detail lookup, carrying the two fields the policy engine
needs and that are easy to lose at the edge.

`original_language` arrives as bare ISO 639-1, which has one code for
both Portuguese variants, so the dub rule in §5.2 cannot be expressed
against it alone. `Movie` therefore also carries `origin_countries`,
from `origin_country` where TMDB has it and `production_countries`
otherwise, which is what separates a Brazilian film from a Portuguese
one.

Digital release dates come back appended to the detail call rather than
costing a second round trip, reduced to the earliest type-4 entry across
every country: a release existing in one region is a release that exists
on the indexers. `Movie::is_digitally_released` puts the §6.2 gate in
one tested place.

Responses are cached in process for a day, matching the metadata refresh
tick. Failures are never cached, so an outage cannot pin a title into a
bad state until tomorrow.

Tests are wiremock-backed, per §12.
2026-08-22 19:39:21 +01:00

27 lines
996 B
Rust

//! arr-meta — TMDB client. See `DESIGN.md` §5.2, §6.2 and §12.
//!
//! Two fields carry the weight here and neither is decoration:
//!
//! - `original_language` (plus the origin country that disambiguates `pt`) is
//! what the whole dub rule in §5.2 is expressed against.
//! - The digital release date gates targeted search (§6.2). A movie with no
//! digital release date must get zero searches.
//!
//! Responses are cached in process with a time-to-live, defaulting to a day,
//! because metadata refresh is a daily tick (§8) and not a per-request cost.
// `unused_crate_dependencies` is a per-target lint and the library's own test
// target links the dev-dependencies without using them. The real uses are in
// `tests/`.
#[cfg(test)]
use {tokio as _, wiremock as _};
mod cache;
mod client;
mod error;
mod model;
pub use client::{TmdbClient, TmdbClientBuilder, DEFAULT_BASE_URL, DEFAULT_CACHE_TTL};
pub use error::{Error, Result};
pub use model::{Movie, MovieSearchResult};