animedex.models.art

Image / art-post models for the tagging upstreams.

ArtPost is the cross-source projection for Danbooru, Waifu.im, and NekosBest. The shapes are remarkably similar: every upstream returns an image URL plus a tag list, and most expose some content-rating axis (Danbooru’s four-letter g/s/q/e is the most expressive; Waifu.im collapses to a boolean is_nsfw; NekosBest is SFW-only).

Consistent with the project’s Human Agency Principle, the model does not filter results by rating; it simply preserves whichever rating the upstream reports so a downstream filter step is possible without a second HTTP call.

ArtRating

animedex.models.art.ArtRating

Danbooru’s four-letter content rating. Backends that use a less granular vocabulary normalise to this set.

alias of Literal[‘g’, ‘s’, ‘q’, ‘e’]

ArtPost

class animedex.models.art.ArtPost(*, id: str, url: str, preview_url: str | None = None, rating: Literal['g', 's', 'q', 'e'] | None = None, tags: List[str] = [], score: int | None = None, artist: str | None = None, source_url: str | None = None, width: int | None = None, height: int | None = None, source: SourceTag)[source]

Bases: AnimedexModel

A single image record from an art-tagging upstream.

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

  • url (str) – Full-resolution image URL.

  • preview_url (str or None) – Thumbnail URL when one is exposed.

  • rating (str or None) – Content rating, when reported. Normalised to ArtRating.

  • tags (list of str) – Tag list (free-form; vocabulary varies per upstream).

  • score (int or None) – Upstream’s popularity / vote count.

  • artist (str or None) – Attributed artist when reported.

  • source_url (str or None) – External URL where the image was originally sourced (e.g. the artist’s gallery page).

  • width (int or None) – Image width in pixels.

  • height (int or None) – Image height in pixels.

  • source (SourceTag) – Provenance tag.

id: str
url: str
preview_url: str | None
rating: ArtRating | None
tags: List[str]
score: int | None
artist: str | None
source_url: str | None
width: int | None
height: int | None
source: SourceTag

selftest

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

Smoke-test the art model.

Returns:

True on success; raises on schema errors.

Return type:

bool