etl module added

This commit is contained in:
garaev kamil 2025-12-05 22:59:33 +03:00
parent 0f619dd954
commit ff36173720
16 changed files with 1573 additions and 0 deletions

View file

View file

@ -0,0 +1,35 @@
SEASON = {
"winter": "WINTER",
"spring": "SPRING",
"summer": "SUMMER",
"fall": "FALL",
}
FORMAT = {
"tv": "TV",
"movie": "MOVIE",
"ova": "OVA",
"ona": "ONA",
"special": "SPECIAL",
"music": "MUSIC",
}
def to_anilist_filters(local: dict) -> dict:
"""Наши фильтры → AniList GraphQL variables."""
q = local.get("query")
year = local.get("year")
season = SEASON.get(local.get("season"))
fmt = FORMAT.get(local.get("type"))
limit = local.get("limit", 10)
variables = {
"page": 1,
"perPage": limit,
}
if q: variables["search"] = q
if year: variables["seasonYear"] = year
if season: variables["season"] = season
if fmt: variables["format"] = fmt
return variables