mirror of
https://github.com/Benexl/FastAnime.git
synced 2026-02-04 11:07:48 -08:00
chore: cleanup codebase
This commit is contained in:
@@ -11,7 +11,7 @@ anime_normalizer_raw = {
|
||||
'Hazurewaku no "Joutai Ijou Skill" de Saikyou ni Natta Ore ga Subete wo Juurin suru made': "Hazure Waku no [Joutai Ijou Skill] de Saikyou ni Natta Ore ga Subete wo Juurin Suru made",
|
||||
},
|
||||
"aniwatch": {"My Star": "Oshi no Ko"},
|
||||
"animepahe": {},
|
||||
"animepahe": {"Azumanga Daiou The Animation": "Azumanga Daioh"},
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -223,7 +223,10 @@ def run_cli(
|
||||
if sync_play:
|
||||
ctx.obj.sync_play = sync_play
|
||||
if provider:
|
||||
import os
|
||||
|
||||
ctx.obj.provider = provider
|
||||
os.environ["CURRENT_FASTANIME_PROVIDER"] = provider
|
||||
if server:
|
||||
ctx.obj.server = server
|
||||
if format:
|
||||
|
||||
@@ -42,5 +42,5 @@ def completed(config: "Config", dump_json):
|
||||
from ...interfaces import anilist_interfaces
|
||||
|
||||
fastanime_runtime_state = FastAnimeRuntimeState()
|
||||
fastanime_runtime_state.current_anilist_data = anime_list[1]
|
||||
fastanime_runtime_state.anilist_results_data = anime_list[1]
|
||||
anilist_interfaces.anilist_results_menu(config, fastanime_runtime_state)
|
||||
|
||||
@@ -42,5 +42,5 @@ def dropped(config: "Config", dump_json):
|
||||
from ...utils.tools import FastAnimeRuntimeState
|
||||
|
||||
fastanime_runtime_state = FastAnimeRuntimeState()
|
||||
fastanime_runtime_state.current_anilist_data = anime_list[1]
|
||||
fastanime_runtime_state.anilist_results_data = anime_list[1]
|
||||
anilist_interfaces.anilist_results_menu(config, fastanime_runtime_state)
|
||||
|
||||
@@ -26,7 +26,7 @@ def favourites(config, dump_json):
|
||||
from ...utils.tools import FastAnimeRuntimeState
|
||||
|
||||
fastanime_runtime_state = FastAnimeRuntimeState()
|
||||
fastanime_runtime_state.current_anilist_data = anime_data[1]
|
||||
fastanime_runtime_state.anilist_results_data = anime_data[1]
|
||||
anilist_results_menu(config, fastanime_runtime_state)
|
||||
else:
|
||||
from sys import exit
|
||||
|
||||
@@ -42,5 +42,5 @@ def paused(config: "Config", dump_json):
|
||||
from ...utils.tools import FastAnimeRuntimeState
|
||||
|
||||
anilist_config = FastAnimeRuntimeState()
|
||||
anilist_config.data = anime_list[1]
|
||||
anilist_config.anilist_results_data = anime_list[1]
|
||||
anilist_interfaces.anilist_results_menu(config, anilist_config)
|
||||
|
||||
@@ -42,5 +42,5 @@ def planning(config: "Config", dump_json):
|
||||
from ...utils.tools import FastAnimeRuntimeState
|
||||
|
||||
fastanime_runtime_state = FastAnimeRuntimeState()
|
||||
fastanime_runtime_state.current_anilist_data = anime_list[1]
|
||||
fastanime_runtime_state.anilist_results_data = anime_list[1]
|
||||
anilist_interfaces.anilist_results_menu(config, fastanime_runtime_state)
|
||||
|
||||
@@ -25,7 +25,7 @@ def popular(config, dump_json):
|
||||
from ...utils.tools import FastAnimeRuntimeState
|
||||
|
||||
fastanime_runtime_state = FastAnimeRuntimeState()
|
||||
fastanime_runtime_state.current_anilist_data = anime_data[1]
|
||||
fastanime_runtime_state.anilist_results_data = anime_data[1]
|
||||
anilist_results_menu(config, fastanime_runtime_state)
|
||||
else:
|
||||
from sys import exit
|
||||
|
||||
@@ -33,7 +33,7 @@ def random_anime(config, dump_json):
|
||||
from ...utils.tools import FastAnimeRuntimeState
|
||||
|
||||
fastanime_runtime_state = FastAnimeRuntimeState()
|
||||
fastanime_runtime_state.current_anilist_data = anime_data[1]
|
||||
fastanime_runtime_state.anilist_results_data = anime_data[1]
|
||||
anilist_results_menu(config, fastanime_runtime_state)
|
||||
else:
|
||||
exit(1)
|
||||
|
||||
@@ -26,7 +26,7 @@ def recent(config, dump_json):
|
||||
from ...utils.tools import FastAnimeRuntimeState
|
||||
|
||||
fastanime_runtime_state = FastAnimeRuntimeState()
|
||||
fastanime_runtime_state.current_anilist_data = anime_data[1]
|
||||
fastanime_runtime_state.anilist_results_data = anime_data[1]
|
||||
anilist_results_menu(config, fastanime_runtime_state)
|
||||
else:
|
||||
from sys import exit
|
||||
|
||||
@@ -42,5 +42,5 @@ def rewatching(config: "Config", dump_json):
|
||||
from ...utils.tools import FastAnimeRuntimeState
|
||||
|
||||
fastanime_runtime_state = FastAnimeRuntimeState()
|
||||
fastanime_runtime_state.current_anilist_data = anime_list[1]
|
||||
fastanime_runtime_state.anilist_results_data = anime_list[1]
|
||||
anilist_interfaces.anilist_results_menu(config, fastanime_runtime_state)
|
||||
|
||||
@@ -25,7 +25,7 @@ def scores(config, dump_json):
|
||||
from ...utils.tools import FastAnimeRuntimeState
|
||||
|
||||
fastanime_runtime_state = FastAnimeRuntimeState()
|
||||
fastanime_runtime_state.data = anime_data[1]
|
||||
fastanime_runtime_state.anilist_results_data = anime_data[1]
|
||||
anilist_results_menu(config, fastanime_runtime_state)
|
||||
else:
|
||||
from sys import exit
|
||||
|
||||
@@ -4,7 +4,7 @@ from ...completion_functions import anime_titles_shell_complete
|
||||
|
||||
tags_available = {
|
||||
"Cast": ["Polyamorous"],
|
||||
"Cast / Main Cast": [
|
||||
"Cast Main Cast": [
|
||||
"Anti-Hero",
|
||||
"Elderly Protagonist",
|
||||
"Ensemble Cast",
|
||||
@@ -18,7 +18,7 @@ tags_available = {
|
||||
"Primarily Male Cast",
|
||||
"Primarily Teen Cast",
|
||||
],
|
||||
"Cast / Traits": [
|
||||
"Cast Traits": [
|
||||
"Age Regression",
|
||||
"Agender",
|
||||
"Aliens",
|
||||
@@ -94,7 +94,7 @@ tags_available = {
|
||||
],
|
||||
"Demographic": ["Josei", "Kids", "Seinen", "Shoujo", "Shounen"],
|
||||
"Setting": ["Matriarchy"],
|
||||
"Setting / Scene": [
|
||||
"Setting Scene": [
|
||||
"Bar",
|
||||
"Boarding School",
|
||||
"Circus",
|
||||
@@ -117,7 +117,7 @@ tags_available = {
|
||||
"Urban",
|
||||
"Work",
|
||||
],
|
||||
"Setting / Time": [
|
||||
"Setting Time": [
|
||||
"Achronological Order",
|
||||
"Anachronism",
|
||||
"Ancient China",
|
||||
@@ -125,7 +125,7 @@ tags_available = {
|
||||
"Historical",
|
||||
"Time Skip",
|
||||
],
|
||||
"Setting / Universe": [
|
||||
"Setting Universe": [
|
||||
"Afterlife",
|
||||
"Alternate Universe",
|
||||
"Augmented Reality",
|
||||
@@ -152,7 +152,7 @@ tags_available = {
|
||||
"Rotoscoping",
|
||||
"Stop Motion",
|
||||
],
|
||||
"Theme / Action": [
|
||||
"Theme Action": [
|
||||
"Archery",
|
||||
"Battle Royale",
|
||||
"Espionage",
|
||||
@@ -162,7 +162,7 @@ tags_available = {
|
||||
"Spearplay",
|
||||
"Swordplay",
|
||||
],
|
||||
"Theme / Arts": [
|
||||
"Theme Arts": [
|
||||
"Acting",
|
||||
"Calligraphy",
|
||||
"Classic Literature",
|
||||
@@ -174,7 +174,7 @@ tags_available = {
|
||||
"Rakugo",
|
||||
"Writing",
|
||||
],
|
||||
"Theme / Arts-Music": [
|
||||
"Theme Arts-Music": [
|
||||
"Band",
|
||||
"Classical Music",
|
||||
"Dancing",
|
||||
@@ -184,8 +184,8 @@ tags_available = {
|
||||
"Musical Theater",
|
||||
"Rock Music",
|
||||
],
|
||||
"Theme / Comedy": ["Parody", "Satire", "Slapstick", "Surreal Comedy"],
|
||||
"Theme / Drama": [
|
||||
"Theme Comedy": ["Parody", "Satire", "Slapstick", "Surreal Comedy"],
|
||||
"Theme Drama": [
|
||||
"Bullying",
|
||||
"Class Struggle",
|
||||
"Coming of Age",
|
||||
@@ -198,7 +198,7 @@ tags_available = {
|
||||
"Suicide",
|
||||
"Tragedy",
|
||||
],
|
||||
"Theme / Fantasy": [
|
||||
"Theme Fantasy": [
|
||||
"Alchemy",
|
||||
"Body Swapping",
|
||||
"Cultivation",
|
||||
@@ -216,8 +216,8 @@ tags_available = {
|
||||
"Wuxia",
|
||||
"Youkai",
|
||||
],
|
||||
"Theme / Game": ["Board Game", "E-Sports", "Video Games"],
|
||||
"Theme / Game-Card & Board Game": [
|
||||
"Theme Game": ["Board Game", "E-Sports", "Video Games"],
|
||||
"Theme Game-Card & Board Game": [
|
||||
"Card Battle",
|
||||
"Go",
|
||||
"Karuta",
|
||||
@@ -225,7 +225,7 @@ tags_available = {
|
||||
"Poker",
|
||||
"Shogi",
|
||||
],
|
||||
"Theme / Game-Sport": [
|
||||
"Theme Game-Sport": [
|
||||
"Acrobatics",
|
||||
"Airsoft",
|
||||
"American Football",
|
||||
@@ -258,7 +258,7 @@ tags_available = {
|
||||
"Volleyball",
|
||||
"Wrestling",
|
||||
],
|
||||
"Theme / Other": [
|
||||
"Theme Other": [
|
||||
"Adoption",
|
||||
"Animals",
|
||||
"Astronomy",
|
||||
@@ -308,7 +308,7 @@ tags_available = {
|
||||
"Travel",
|
||||
"War",
|
||||
],
|
||||
"Theme / Other-Organisations": [
|
||||
"Theme Other-Organisations": [
|
||||
"Assassins",
|
||||
"Criminal Organization",
|
||||
"Cult",
|
||||
@@ -320,7 +320,7 @@ tags_available = {
|
||||
"Triads",
|
||||
"Yakuza",
|
||||
],
|
||||
"Theme / Other-Vehicle": [
|
||||
"Theme Other-Vehicle": [
|
||||
"Aviation",
|
||||
"Cars",
|
||||
"Mopeds",
|
||||
@@ -329,7 +329,7 @@ tags_available = {
|
||||
"Tanks",
|
||||
"Trains",
|
||||
],
|
||||
"Theme / Romance": [
|
||||
"Theme Romance": [
|
||||
"Age Gap",
|
||||
"Bisexual",
|
||||
"Boys' Love",
|
||||
@@ -343,15 +343,15 @@ tags_available = {
|
||||
"Unrequited Love",
|
||||
"Yuri",
|
||||
],
|
||||
"Theme / Sci Fi": [
|
||||
"Theme Sci Fi": [
|
||||
"Cyberpunk",
|
||||
"Space Opera",
|
||||
"Time Loop",
|
||||
"Time Manipulation",
|
||||
"Tokusatsu",
|
||||
],
|
||||
"Theme / Sci Fi-Mecha": ["Real Robot", "Super Robot"],
|
||||
"Theme / Slice of Life": [
|
||||
"Theme Sci Fi-Mecha": ["Real Robot", "Super Robot"],
|
||||
"Theme Slice of Life": [
|
||||
"Agriculture",
|
||||
"Cute Boys Doing Cute Things",
|
||||
"Cute Girls Doing Cute Things",
|
||||
@@ -386,6 +386,7 @@ for tag_category, tags_in_category in tags_available.items():
|
||||
"--status",
|
||||
"-S",
|
||||
help="The media status of the anime",
|
||||
multiple=True,
|
||||
type=click.Choice(
|
||||
["FINISHED", "RELEASING", "NOT_YET_RELEASED", "CANCELLED", "HIATUS"]
|
||||
),
|
||||
@@ -486,38 +487,38 @@ for tag_category, tags_in_category in tags_available.items():
|
||||
"-y",
|
||||
type=click.Choice(
|
||||
[
|
||||
"2024",
|
||||
"2023",
|
||||
"2022",
|
||||
"2021",
|
||||
"2020",
|
||||
"2019",
|
||||
"2018",
|
||||
"2017",
|
||||
"2016",
|
||||
"2015",
|
||||
"2014",
|
||||
"2013",
|
||||
"2012",
|
||||
"2011",
|
||||
"2010",
|
||||
"2009",
|
||||
"2008",
|
||||
"2007",
|
||||
"2006",
|
||||
"2005",
|
||||
"2004",
|
||||
"2000",
|
||||
"1990",
|
||||
"1980",
|
||||
"1970",
|
||||
"1960",
|
||||
"1950",
|
||||
"1940",
|
||||
"1930",
|
||||
"1920",
|
||||
"1910",
|
||||
"1900",
|
||||
"1910",
|
||||
"1920",
|
||||
"1930",
|
||||
"1940",
|
||||
"1950",
|
||||
"1960",
|
||||
"1970",
|
||||
"1980",
|
||||
"1990",
|
||||
"2000",
|
||||
"2004",
|
||||
"2005",
|
||||
"2006",
|
||||
"2007",
|
||||
"2008",
|
||||
"2009",
|
||||
"2010",
|
||||
"2011",
|
||||
"2012",
|
||||
"2013",
|
||||
"2014",
|
||||
"2015",
|
||||
"2016",
|
||||
"2017",
|
||||
"2018",
|
||||
"2019",
|
||||
"2020",
|
||||
"2021",
|
||||
"2022",
|
||||
"2023",
|
||||
"2024",
|
||||
]
|
||||
),
|
||||
help="the year the media was released",
|
||||
@@ -531,7 +532,7 @@ def search(
|
||||
success, search_results = AniList.search(
|
||||
query=title,
|
||||
sort=sort,
|
||||
status=status,
|
||||
status_in=list(status),
|
||||
genre_in=list(genres),
|
||||
season=season,
|
||||
tag_in=list(tags),
|
||||
@@ -548,7 +549,7 @@ def search(
|
||||
from ...utils.tools import FastAnimeRuntimeState
|
||||
|
||||
fastanime_runtime_state = FastAnimeRuntimeState()
|
||||
fastanime_runtime_state.current_anilist_data = search_results
|
||||
fastanime_runtime_state.anilist_results_data = search_results
|
||||
anilist_results_menu(config, fastanime_runtime_state)
|
||||
else:
|
||||
from sys import exit
|
||||
|
||||
@@ -26,7 +26,7 @@ def trending(config, dump_json):
|
||||
from ...utils.tools import FastAnimeRuntimeState
|
||||
|
||||
fastanime_runtime_state = FastAnimeRuntimeState()
|
||||
fastanime_runtime_state.current_anilist_data = data
|
||||
fastanime_runtime_state.anilist_results_data = data
|
||||
anilist_results_menu(config, fastanime_runtime_state)
|
||||
else:
|
||||
from sys import exit
|
||||
|
||||
@@ -25,7 +25,7 @@ def upcoming(config, dump_json):
|
||||
from ...utils.tools import FastAnimeRuntimeState
|
||||
|
||||
fastanime_runtime_state = FastAnimeRuntimeState()
|
||||
fastanime_runtime_state.current_anilist_data = data
|
||||
fastanime_runtime_state.anilist_results_data = data
|
||||
anilist_results_menu(config, fastanime_runtime_state)
|
||||
else:
|
||||
from sys import exit
|
||||
|
||||
@@ -42,5 +42,5 @@ def watching(config: "Config", dump_json):
|
||||
from ...utils.tools import FastAnimeRuntimeState
|
||||
|
||||
fastanime_runtime_state = FastAnimeRuntimeState()
|
||||
fastanime_runtime_state.current_anilist_data = anime_list[1]
|
||||
fastanime_runtime_state.anilist_results_data = anime_list[1]
|
||||
anilist_interfaces.anilist_results_menu(config, fastanime_runtime_state)
|
||||
|
||||
@@ -221,7 +221,7 @@ def media_player_controls(
|
||||
"Are you sure you wish to continue to the next episode, your progress for the current episodes will be erased?",
|
||||
default=True,
|
||||
):
|
||||
media_player_controls(config, fastanime_runtime_state)
|
||||
media_actions_menu(config, fastanime_runtime_state)
|
||||
return
|
||||
|
||||
# all checks have passed lets go to the next episode
|
||||
@@ -386,7 +386,7 @@ def provider_anime_episode_servers_menu(
|
||||
else:
|
||||
if not Rofi.confirm("Sth went wrong!!Enter to continue..."):
|
||||
exit(1)
|
||||
provider_anime_episode_servers_menu(config, fastanime_runtime_state)
|
||||
media_actions_menu(config, fastanime_runtime_state)
|
||||
return
|
||||
|
||||
if config.server == "top":
|
||||
@@ -640,7 +640,9 @@ def provider_anime_episodes_menu(
|
||||
)
|
||||
|
||||
# prompt for episode number
|
||||
total_episodes = provider_anime["availableEpisodesDetail"][translation_type]
|
||||
total_episodes = sorted(
|
||||
provider_anime["availableEpisodesDetail"][translation_type], key=float
|
||||
)
|
||||
current_episode_number = ""
|
||||
|
||||
# auto select episode if continue from history otherwise prompt episode number
|
||||
@@ -731,7 +733,9 @@ def provider_anime_episodes_menu(
|
||||
provider_anime_episode_servers_menu(config, fastanime_runtime_state)
|
||||
|
||||
|
||||
def fetch_anime_episode(config, fastanime_runtime_state: "FastAnimeRuntimeState"):
|
||||
def fetch_anime_episode(
|
||||
config: "Config", fastanime_runtime_state: "FastAnimeRuntimeState"
|
||||
):
|
||||
selected_anime: "SearchResult" = (
|
||||
fastanime_runtime_state.provider_anime_search_result
|
||||
)
|
||||
@@ -739,7 +743,7 @@ def fetch_anime_episode(config, fastanime_runtime_state: "FastAnimeRuntimeState"
|
||||
with Progress() as progress:
|
||||
progress.add_task("Fetching Anime Info...", total=None)
|
||||
provider_anime = anime_provider.get_anime(
|
||||
selected_anime["id"], fastanime_runtime_state.selected_anime_anilist
|
||||
selected_anime["id"],
|
||||
)
|
||||
if not provider_anime:
|
||||
print(
|
||||
@@ -750,7 +754,7 @@ def fetch_anime_episode(config, fastanime_runtime_state: "FastAnimeRuntimeState"
|
||||
else:
|
||||
if not Rofi.confirm("Sth went wrong!!Enter to continue..."):
|
||||
exit(1)
|
||||
return fetch_anime_episode(config, fastanime_runtime_state)
|
||||
return media_actions_menu(config, fastanime_runtime_state)
|
||||
|
||||
fastanime_runtime_state.provider_anime = provider_anime
|
||||
provider_anime_episodes_menu(config, fastanime_runtime_state)
|
||||
@@ -795,7 +799,7 @@ def anime_provider_search_results_menu(
|
||||
else:
|
||||
if not Rofi.confirm("Sth went wrong!!Enter to continue..."):
|
||||
exit(1)
|
||||
return anime_provider_search_results_menu(config, fastanime_runtime_state)
|
||||
return media_actions_menu(config, fastanime_runtime_state)
|
||||
|
||||
provider_search_results = {
|
||||
anime["title"]: anime for anime in provider_search_results["results"]
|
||||
@@ -1277,7 +1281,7 @@ def anilist_results_menu(
|
||||
config: [TODO:description]
|
||||
fastanime_runtime_state: [TODO:description]
|
||||
"""
|
||||
search_results = fastanime_runtime_state.current_anilist_data["data"]["Page"][
|
||||
search_results = fastanime_runtime_state.anilist_results_data["data"]["Page"][
|
||||
"media"
|
||||
]
|
||||
|
||||
@@ -1558,7 +1562,7 @@ def fastanime_main_menu(
|
||||
# anilist data is a (bool,data)
|
||||
# the bool indicated success
|
||||
if anilist_data[0]:
|
||||
fastanime_runtime_state.current_anilist_data = anilist_data[1]
|
||||
fastanime_runtime_state.anilist_results_data = anilist_data[1]
|
||||
anilist_results_menu(config, fastanime_runtime_state)
|
||||
|
||||
else:
|
||||
|
||||
@@ -111,7 +111,6 @@ class MpvPlayer(object):
|
||||
provider_anime,
|
||||
current_episode_number,
|
||||
translation_type,
|
||||
fastanime_runtime_state.selected_anime_anilist,
|
||||
)
|
||||
if not episode_streams:
|
||||
self.mpv_player.show_text("No streams were found")
|
||||
@@ -271,7 +270,6 @@ class MpvPlayer(object):
|
||||
mpv_player.show_text("Changing translation type...")
|
||||
anime = anime_provider.get_anime(
|
||||
fastanime_runtime_state.provider_anime_search_result["id"],
|
||||
fastanime_runtime_state.selected_anime_anilist,
|
||||
)
|
||||
if not anime:
|
||||
mpv_player.show_text("Failed to update translation type")
|
||||
|
||||
@@ -24,7 +24,7 @@ class FastAnimeRuntimeState(object):
|
||||
selected_anime_id_anilist: int
|
||||
selected_anime_title_anilist: str
|
||||
# current_anilist_data: "AnilistDataSchema | AnilistMediaList"
|
||||
current_anilist_data: "Any"
|
||||
anilist_results_data: "Any"
|
||||
|
||||
|
||||
def exit_app(exit_code=0, *args):
|
||||
|
||||
Reference in New Issue
Block a user