-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
index on master: 53823f0 chore:recover lost stash changes
- Loading branch information
Benex254
committed
Jul 12, 2024
1 parent
53823f0
commit 73ce357
Showing
4 changed files
with
127 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |