mirror of
https://github.com/Benexl/FastAnime.git
synced 2026-02-04 19:11:55 -08:00
index on master: 53823f0 chore:recover lost stash changes
This commit is contained in:
BIN
.assets/screencasts/intro.webm
Normal file
BIN
.assets/screencasts/intro.webm
Normal file
Binary file not shown.
36
fastanime/libs/anime_provider/allanime/normalizer.py
Normal file
36
fastanime/libs/anime_provider/allanime/normalizer.py
Normal 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
|
||||
59
fastanime/libs/anime_provider/allanime/types.py
Normal file
59
fastanime/libs/anime_provider/allanime/types.py
Normal 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
|
||||
32
fastanime/libs/anime_provider/types.py
Normal file
32
fastanime/libs/anime_provider/types.py
Normal 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
|
||||
Reference in New Issue
Block a user