index on master: 53823f0 chore:recover lost stash changes

This commit is contained in:
Benex254
2024-07-12 16:32:29 +03:00
parent 53823f02c1
commit 73ce357789
4 changed files with 127 additions and 0 deletions

Binary file not shown.

View File

@@ -0,0 +1,36 @@
from .types import AllAnimeSearchResults, AllAnimeShow
from ..types import SearchResults, Anime, EpisodesDetail
def normalize_search_results(search_results: AllAnimeSearchResults) -> SearchResults:
page_info = search_results["shows"]["pageInfo"]
results = []
for result in search_results["shows"]["edges"]:
normalized_result = {
"id": result["_id"],
"title": result["name"],
"type": result["__typename"],
"availableEpisodes": result["availableEpisodes"],
}
results.append(normalized_result)
normalized_search_results: SearchResults = {
"pageInfo": page_info,
"results": results,
}
return normalized_search_results
def normalize_anime(anime: AllAnimeShow) -> Anime:
id: str = anime["_id"]
title: str = anime["name"]
availableEpisodesDetail: EpisodesDetail = anime["availableEpisodesDetail"]
type: str = anime["__typename"]
normalized_anime: Anime = {
"id": id,
"title": title,
"availableEpisodesDetail": availableEpisodesDetail,
"type": type,
}
return normalized_anime

View File

@@ -0,0 +1,59 @@
from typing import Literal, TypedDict
class AllAnimeEpisodesInfo(TypedDict):
dub: int
sub: int
raw: int
class AllAnimePageInfo(TypedDict):
total: int
class AllAnimeShow(TypedDict):
_id: str
name: str
availableEpisodesDetail: AllAnimeEpisodesInfo
__typename: str
class AllAnimeSearchResult(TypedDict):
_id: str
name: str
availableEpisodes: list[str]
__typename: str
class AllAnimeShows(TypedDict):
pageInfo: AllAnimePageInfo
edges: list[AllAnimeSearchResult]
class AllAnimeSearchResults(TypedDict):
shows: AllAnimeShows
class AllAnimeSourcesDownloads(TypedDict):
sourceName: str
dowloadUrl: str
class AllAnimeSources(TypedDict):
sourceUrl: str
priority: float
sandbox: str
sourceName: str
type: str
className: str
streamerId: str
downloads: AllAnimeSourcesDownloads
Server = Literal["gogoanime", "dropbox", "wetransfer", "sharepoint"]
class AllAnimeEpisode(TypedDict):
episodeString: str
sourceUrls: list[AllAnimeSources]
notes: str | None

View File

@@ -0,0 +1,32 @@
from typing import TypedDict
class PageInfo(TypedDict):
total: int
# search data
class SearchResult(TypedDict):
id: str
title: str
availableEpisodes: list[str]
type: str
class SearchResults(TypedDict):
pageInfo: PageInfo
results: list[SearchResult]
# anime data
class EpisodesDetail(TypedDict):
dub: int
sub: int
raw: int
class Anime(TypedDict):
id: str
title: str
availableEpisodesDetail: EpisodesDetail
type: str