Skip to content

Data Models

TheMRX13 edited this page Jun 12, 2026 · 1 revision

Data Models

🌐 English · Deutsch

Source registry (providers.py)

Every streaming source is registered as a Provider dataclass: URL patterns (series/season/episode) plus the corresponding model classes.

Source series_cls season_cls episode_cls
AniWorld AniworldSeries AniworldSeason AniworldEpisode
SerienStream (s.to) SerienstreamSeries SerienstreamSeason SerienstreamEpisode
FilmPalast FilmPalastEpisode (movies have no season structure)

resolve_provider(url) normalises the URL (e.g. /serie/stream/<slug>/serie/<slug>, trailing slash) and returns the matching provider — or raises ValueError("Unsupported URL").

from aniworld.providers import resolve_provider

prov = resolve_provider("https://aniworld.to/anime/stream/one-piece")
series = prov.series_cls(url="https://aniworld.to/anime/stream/one-piece")

Series

Lazy-loading properties (HTML is fetched on first access and cached):

title, title_cleaned, description, genres, release_year, poster_url, directors, actors, producer, country, age_rating, rating, imdb (IMDB ID), mal_id (AniWorld only), has_movies, seasons, season_count.

Note on poster URLs: some s.to series use a hash ID instead of the series slug in the poster path — the extraction is generalised accordingly.

Season

AniworldSeason(url, series=None) — properties include season_number, episodes, are_movies (AniWorld "movies" season, skipped e.g. by AutoSync).

Episode

Core class for downloads:

ep = prov.episode_cls(
    url="https://aniworld.to/anime/stream/x/staffel-1/episode-1",
    selected_language="German Dub",
    selected_provider="VOE",
    selected_path="/path/optional",   # optional
)
ep.download(cancel_event=event)        # blocking; aborts when the event is set
  • provider_data (property): mapping (Audio, Subtitles) → {host → embed URL} — the basis for language checks (e.g. in AutoSync) and host selection.
  • download(): invoke extractor → direct link → yt-dlp/FFmpeg → target file according to ANIWORLD_NAMING_TEMPLATE; sets language tags (deu/eng/jpn) on audio/subtitle tracks. The finished file path is available in _episode_path afterwards.
  • Progress is published globally via models/common/common.get_ffmpeg_progress() (phase download = yt-dlp, ffmpeg = muxing) — the queue UI and /api/v1/status read from it.

Language system (config.py)

Site language keys are mapped to semantic enums:

Key Label (aniworld) Audio Subtitles
1 German Dub GERMAN
2 English Sub JAPANESE ENGLISH
3 German Sub JAPANESE GERMAN
4 English Dub ENGLISH

s.to uses the same keys with its own labels (1 = German Dub, 2 = English Dub, 3 = English Dub with German Sub). Helper maps: LANG_KEY_MAP, LANG_LABELS, LANG_CODE_MAP (ISO 639-2 for FFmpeg tags) and their inverses.

URL patterns

Defined as compiled regexes in config.py (ANIWORLD_SERIES_PATTERN, …_SEASON_…, …_EPISODE_…, analogous SERIENSTREAM_*, plus FILMPALAST_EPISODE_PATTERN in providers.py). AniWorld episode URLs also cover movies (/filme/film-N).

Clone this wiki locally