animedex.models.manga

Manga domain models.

Mirrors the anime side. Manga is the cross-source common projection (MangaDex provides the lion’s share of fields; AniList also exposes manga but with thinner coverage). AtHomeServer is included from day one because the future reader work reader path consumes it; defining the shape now keeps the public model surface stable through that release.

MangaStatus

animedex.models.manga.MangaStatus

Manga publication status.

alias of Literal[‘ongoing’, ‘completed’, ‘hiatus’, ‘cancelled’, ‘unknown’]

MangaFormat

animedex.models.manga.MangaFormat

Manga format / kind. Includes the broader Asian-comics taxonomy because AniList classifies them at this granularity.

alias of Literal[‘MANGA’, ‘NOVEL’, ‘ONE_SHOT’, ‘DOUJINSHI’, ‘MANHWA’, ‘MANHUA’]

Chapter

class animedex.models.manga.Chapter(*, id: str, number: str, title: str | None = None, language: str, pages: int | None = None, source: SourceTag)[source]

Bases: AnimedexModel

A manga chapter as returned by any single backend.

Variables:
  • id (str) – Backend-native chapter identifier.

  • number (str) – Human-friendly number (kept as a string because numbering is non-monotonic and frequently fractional).

  • title (str or None) – Chapter title when set upstream.

  • language (str) – ISO 639 language code or upstream’s locale string.

  • pages (int or None) – Page count when known.

  • source (SourceTag) – Provenance tag.

id: str
number: str
title: str | None
language: str
pages: int | None
source: SourceTag

Manga

class animedex.models.manga.Manga(*, id: str, title: str, cover_url: str | None = None, chapters: List[Chapter] = [], languages: List[str] = [], description: str | None = None, status: Literal['ongoing', 'completed', 'hiatus', 'cancelled', 'unknown'] | None = None, format: Literal['MANGA', 'NOVEL', 'ONE_SHOT', 'DOUJINSHI', 'MANHWA', 'MANHUA'] | None = None, genres: List[str] = [], tags: List[str] = [], ids: Dict[str, str], source: SourceTag)[source]

Bases: AnimedexModel

A manga record.

Variables:
  • id (str) – Canonical "<source>:<id>" identifier.

  • title (str) – Display title (single string; manga upstreams are less locale-rich than anime).

  • cover_url (str or None) – Public cover image URL.

  • chapters (list of Chapter) – Known chapters, in upstream order.

  • languages (list of str) – Languages with at least one translated chapter.

  • description (str or None) – Synopsis / description.

  • status (str or None) – Publication status, normalised to MangaStatus.

  • format (str or None) – Media format, normalised to MangaFormat.

  • genres (list of str) – Broad genre tags.

  • tags (list of str) – Long-tail descriptive tags.

  • ids (dict[str, str]) – Cross-service identifier map.

  • source (SourceTag) – Provenance tag.

id: str
title: str
cover_url: str | None
chapters: List[Chapter]
languages: List[str]
description: str | None
status: MangaStatus | None
format: MangaFormat | None
genres: List[str]
tags: List[str]
ids: Dict[str, str]
source: SourceTag

AtHomeServer

class animedex.models.manga.AtHomeServer(*, base_url: str, chapter_hash: str, data: List[str], data_saver: List[str] = [], source: SourceTag)[source]

Bases: AnimedexModel

Result of MangaDex’s GET /at-home/server/{chapter} call.

The base URL is short-lived (~5 min). Per plans/03 we never cache it across chapters; the model carries it so a single invocation has a typed object to thread through the page-fetch loop.

Variables:
  • base_url (str) – Per-call base URL for the page bytes endpoint.

  • chapter_hash (str) – Hash that goes between the base URL and the per-page filenames.

  • data (list of str) – Filenames for full-resolution pages, in order.

  • data_saver (list of str) – Filenames for compressed-quality pages, in order. Empty when the upstream did not provide a saver-quality variant.

  • source (SourceTag) – Provenance tag.

base_url: str
chapter_hash: str
data: List[str]
data_saver: List[str]
source: SourceTag

selftest

animedex.models.manga.selftest() bool[source]

Smoke-test the manga model graph.

Returns:

True on success; raises on schema errors.

Return type:

bool