diff --git a/fastanime/cli/commands/anilist/completed.py b/fastanime/cli/commands/anilist/completed.py index 67b2c13..6996524 100644 --- a/fastanime/cli/commands/anilist/completed.py +++ b/fastanime/cli/commands/anilist/completed.py @@ -42,5 +42,12 @@ def completed(config: "Config", dump_json): from ...interfaces import anilist_interfaces fastanime_runtime_state = FastAnimeRuntimeState() + + fastanime_runtime_state.current_page = 1 + fastanime_runtime_state.current_data_loader = ( + lambda config, **kwargs: anilist_interfaces._handle_animelist( + config, fastanime_runtime_state, "Completed", **kwargs + ) + ) fastanime_runtime_state.anilist_results_data = anime_list[1] anilist_interfaces.anilist_results_menu(config, fastanime_runtime_state) diff --git a/fastanime/cli/commands/anilist/dropped.py b/fastanime/cli/commands/anilist/dropped.py index 812f324..438c31f 100644 --- a/fastanime/cli/commands/anilist/dropped.py +++ b/fastanime/cli/commands/anilist/dropped.py @@ -42,5 +42,12 @@ def dropped(config: "Config", dump_json): from ...utils.tools import FastAnimeRuntimeState fastanime_runtime_state = FastAnimeRuntimeState() + + fastanime_runtime_state.current_page = 1 + fastanime_runtime_state.current_data_loader = ( + lambda config, **kwargs: anilist_interfaces._handle_animelist( + config, fastanime_runtime_state, "Dropped", **kwargs + ) + ) fastanime_runtime_state.anilist_results_data = anime_list[1] anilist_interfaces.anilist_results_menu(config, fastanime_runtime_state) diff --git a/fastanime/cli/commands/anilist/favourites.py b/fastanime/cli/commands/anilist/favourites.py index 61ac291..bb890b4 100644 --- a/fastanime/cli/commands/anilist/favourites.py +++ b/fastanime/cli/commands/anilist/favourites.py @@ -26,6 +26,9 @@ def favourites(config, dump_json): from ...utils.tools import FastAnimeRuntimeState fastanime_runtime_state = FastAnimeRuntimeState() + + fastanime_runtime_state.current_page = 1 + fastanime_runtime_state.current_data_loader = AniList.get_most_favourite fastanime_runtime_state.anilist_results_data = anime_data[1] anilist_results_menu(config, fastanime_runtime_state) else: diff --git a/fastanime/cli/commands/anilist/paused.py b/fastanime/cli/commands/anilist/paused.py index a5fdcad..2e565fd 100644 --- a/fastanime/cli/commands/anilist/paused.py +++ b/fastanime/cli/commands/anilist/paused.py @@ -41,6 +41,12 @@ def paused(config: "Config", dump_json): from ...interfaces import anilist_interfaces from ...utils.tools import FastAnimeRuntimeState - anilist_config = FastAnimeRuntimeState() - anilist_config.anilist_results_data = anime_list[1] - anilist_interfaces.anilist_results_menu(config, anilist_config) + fastanime_runtime_state = FastAnimeRuntimeState() + fastanime_runtime_state.current_page = 1 + fastanime_runtime_state.current_data_loader = ( + lambda config, **kwargs: anilist_interfaces._handle_animelist( + config, fastanime_runtime_state, "Paused", **kwargs + ) + ) + fastanime_runtime_state.anilist_results_data = anime_list[1] + anilist_interfaces.anilist_results_menu(config, fastanime_runtime_state) diff --git a/fastanime/cli/commands/anilist/planning.py b/fastanime/cli/commands/anilist/planning.py index 85a6f2c..5673b99 100644 --- a/fastanime/cli/commands/anilist/planning.py +++ b/fastanime/cli/commands/anilist/planning.py @@ -42,5 +42,12 @@ def planning(config: "Config", dump_json): from ...utils.tools import FastAnimeRuntimeState fastanime_runtime_state = FastAnimeRuntimeState() + + fastanime_runtime_state.current_page = 1 + fastanime_runtime_state.current_data_loader = ( + lambda config, **kwargs: anilist_interfaces._handle_animelist( + config, fastanime_runtime_state, "Planned", **kwargs + ) + ) fastanime_runtime_state.anilist_results_data = anime_list[1] anilist_interfaces.anilist_results_menu(config, fastanime_runtime_state) diff --git a/fastanime/cli/commands/anilist/popular.py b/fastanime/cli/commands/anilist/popular.py index 6ea4993..36cbf95 100644 --- a/fastanime/cli/commands/anilist/popular.py +++ b/fastanime/cli/commands/anilist/popular.py @@ -25,6 +25,9 @@ def popular(config, dump_json): from ...utils.tools import FastAnimeRuntimeState fastanime_runtime_state = FastAnimeRuntimeState() + + fastanime_runtime_state.current_page = 1 + fastanime_runtime_state.current_data_loader = AniList.get_most_popular fastanime_runtime_state.anilist_results_data = anime_data[1] anilist_results_menu(config, fastanime_runtime_state) else: diff --git a/fastanime/cli/commands/anilist/recent.py b/fastanime/cli/commands/anilist/recent.py index efbb3bd..97059d2 100644 --- a/fastanime/cli/commands/anilist/recent.py +++ b/fastanime/cli/commands/anilist/recent.py @@ -26,6 +26,11 @@ def recent(config, dump_json): from ...utils.tools import FastAnimeRuntimeState fastanime_runtime_state = FastAnimeRuntimeState() + + fastanime_runtime_state.current_page = 1 + fastanime_runtime_state.current_data_loader = ( + AniList.get_most_recently_updated + ) fastanime_runtime_state.anilist_results_data = anime_data[1] anilist_results_menu(config, fastanime_runtime_state) else: diff --git a/fastanime/cli/commands/anilist/rewatching.py b/fastanime/cli/commands/anilist/rewatching.py index 9330b10..5b3a0c9 100644 --- a/fastanime/cli/commands/anilist/rewatching.py +++ b/fastanime/cli/commands/anilist/rewatching.py @@ -42,5 +42,12 @@ def rewatching(config: "Config", dump_json): from ...utils.tools import FastAnimeRuntimeState fastanime_runtime_state = FastAnimeRuntimeState() + + fastanime_runtime_state.current_page = 1 + fastanime_runtime_state.current_data_loader = ( + lambda config, **kwargs: anilist_interfaces._handle_animelist( + config, fastanime_runtime_state, "Rewatching", **kwargs + ) + ) fastanime_runtime_state.anilist_results_data = anime_list[1] anilist_interfaces.anilist_results_menu(config, fastanime_runtime_state) diff --git a/fastanime/cli/commands/anilist/scores.py b/fastanime/cli/commands/anilist/scores.py index 664413c..44bde7e 100644 --- a/fastanime/cli/commands/anilist/scores.py +++ b/fastanime/cli/commands/anilist/scores.py @@ -25,6 +25,9 @@ def scores(config, dump_json): from ...utils.tools import FastAnimeRuntimeState fastanime_runtime_state = FastAnimeRuntimeState() + + fastanime_runtime_state.current_page = 1 + fastanime_runtime_state.current_data_loader = AniList.get_most_scored fastanime_runtime_state.anilist_results_data = anime_data[1] anilist_results_menu(config, fastanime_runtime_state) else: diff --git a/fastanime/cli/commands/anilist/search.py b/fastanime/cli/commands/anilist/search.py index 207876d..4c6a3f8 100644 --- a/fastanime/cli/commands/anilist/search.py +++ b/fastanime/cli/commands/anilist/search.py @@ -111,6 +111,22 @@ def search( from ...utils.tools import FastAnimeRuntimeState fastanime_runtime_state = FastAnimeRuntimeState() + + fastanime_runtime_state.current_page = 1 + fastanime_runtime_state.current_data_loader = ( + lambda page=1, **kwargs: AniList.search( + query=title, + sort=sort, + status_in=list(status), + genre_in=list(genres), + season=season, + tag_in=list(tags), + seasonYear=year, + format_in=list(media_format), + on_list=on_list, + page=page, + ) + ) fastanime_runtime_state.anilist_results_data = search_results anilist_results_menu(config, fastanime_runtime_state) else: diff --git a/fastanime/cli/commands/anilist/trending.py b/fastanime/cli/commands/anilist/trending.py index 7aa2831..f40f16a 100644 --- a/fastanime/cli/commands/anilist/trending.py +++ b/fastanime/cli/commands/anilist/trending.py @@ -26,6 +26,9 @@ def trending(config, dump_json): from ...utils.tools import FastAnimeRuntimeState fastanime_runtime_state = FastAnimeRuntimeState() + + fastanime_runtime_state.current_page = 1 + fastanime_runtime_state.current_data_loader = AniList.get_trending fastanime_runtime_state.anilist_results_data = data anilist_results_menu(config, fastanime_runtime_state) else: diff --git a/fastanime/cli/commands/anilist/upcoming.py b/fastanime/cli/commands/anilist/upcoming.py index 263b064..8472e48 100644 --- a/fastanime/cli/commands/anilist/upcoming.py +++ b/fastanime/cli/commands/anilist/upcoming.py @@ -25,6 +25,9 @@ def upcoming(config, dump_json): from ...utils.tools import FastAnimeRuntimeState fastanime_runtime_state = FastAnimeRuntimeState() + + fastanime_runtime_state.current_page = 1 + fastanime_runtime_state.current_data_loader = AniList.get_upcoming_anime fastanime_runtime_state.anilist_results_data = data anilist_results_menu(config, fastanime_runtime_state) else: diff --git a/fastanime/cli/commands/anilist/watching.py b/fastanime/cli/commands/anilist/watching.py index 677f9cc..6b2f43e 100644 --- a/fastanime/cli/commands/anilist/watching.py +++ b/fastanime/cli/commands/anilist/watching.py @@ -42,5 +42,12 @@ def watching(config: "Config", dump_json): from ...utils.tools import FastAnimeRuntimeState fastanime_runtime_state = FastAnimeRuntimeState() + + fastanime_runtime_state.current_page = 1 + fastanime_runtime_state.current_data_loader = ( + lambda config, **kwargs: anilist_interfaces._handle_animelist( + config, fastanime_runtime_state, "Watching", **kwargs + ) + ) fastanime_runtime_state.anilist_results_data = anime_list[1] anilist_interfaces.anilist_results_menu(config, fastanime_runtime_state) diff --git a/fastanime/cli/interfaces/anilist_interfaces.py b/fastanime/cli/interfaces/anilist_interfaces.py index 6c0881a..efffffc 100644 --- a/fastanime/cli/interfaces/anilist_interfaces.py +++ b/fastanime/cli/interfaces/anilist_interfaces.py @@ -1511,7 +1511,7 @@ def anilist_results_menu( # # ---- FASTANIME MAIN MENU ---- # -def handle_animelist( +def _handle_animelist( config: "Config", fastanime_runtime_state: "FastAnimeRuntimeState", list_type: str, @@ -1548,7 +1548,7 @@ def handle_animelist( status = "DROPPED" case "Paused": status = "PAUSED" - case "Repeating": + case "Rewatching": status = "REPEATING" case _: return @@ -1672,32 +1672,32 @@ def fastanime_main_menu( f"{'🎞️ ' if icons else ''}Recent": _recent, f"{'📺 ' if icons else ''}Watching": lambda config, media_list_type="Watching", - page=1: handle_animelist( + page=1: _handle_animelist( config, fastanime_runtime_state, media_list_type, page=page ), f"{'⏸ ' if icons else ''}Paused": lambda config, media_list_type="Paused", - page=1: handle_animelist( + page=1: _handle_animelist( config, fastanime_runtime_state, media_list_type, page=page ), f"{'🚮 ' if icons else ''}Dropped": lambda config, media_list_type="Dropped", - page=1: handle_animelist( + page=1: _handle_animelist( config, fastanime_runtime_state, media_list_type, page=page ), f"{'📑 ' if icons else ''}Planned": lambda config, media_list_type="Planned", - page=1: handle_animelist( + page=1: _handle_animelist( config, fastanime_runtime_state, media_list_type, page=page ), f"{'✅ ' if icons else ''}Completed": lambda config, media_list_type="Completed", - page=1: handle_animelist( + page=1: _handle_animelist( config, fastanime_runtime_state, media_list_type, page=page ), f"{'🔁 ' if icons else ''}Rewatching": lambda config, - media_list_type="Repeating", - page=1: handle_animelist( + media_list_type="Rewatching", + page=1: _handle_animelist( config, fastanime_runtime_state, media_list_type, page=page ), f"{'🔔 ' if icons else ''}Recently Updated Anime": AniList.get_most_recently_updated,