etl module added
This commit is contained in:
parent
0f619dd954
commit
ff36173720
16 changed files with 1573 additions and 0 deletions
0
modules/anime_etl/mappers/__init__.py
Normal file
0
modules/anime_etl/mappers/__init__.py
Normal file
35
modules/anime_etl/mappers/anilist_filters.py
Normal file
35
modules/anime_etl/mappers/anilist_filters.py
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue