From e8a05ec4b80f53581d423b02f2ef6b77471d43ff Mon Sep 17 00:00:00 2001 From: Benex254 Date: Wed, 21 Aug 2024 20:48:01 +0300 Subject: [PATCH] feat: add dump json to anilist commands --- fastanime/cli/commands/anilist/completed.py | 28 ++++++++++++---- fastanime/cli/commands/anilist/dropped.py | 32 +++++++++++++------ fastanime/cli/commands/anilist/favourites.py | 28 ++++++++++++---- fastanime/cli/commands/anilist/login.py | 16 +++++----- fastanime/cli/commands/anilist/notifier.py | 3 +- fastanime/cli/commands/anilist/paused.py | 32 +++++++++++++------ fastanime/cli/commands/anilist/planning.py | 32 +++++++++++++------ fastanime/cli/commands/anilist/popular.py | 28 ++++++++++++---- .../cli/commands/anilist/random_anime.py | 28 +++++++++++----- fastanime/cli/commands/anilist/recent.py | 28 ++++++++++++---- fastanime/cli/commands/anilist/rewatching.py | 32 +++++++++++++------ fastanime/cli/commands/anilist/scores.py | 28 ++++++++++++---- fastanime/cli/commands/anilist/search.py | 30 +++++++++++++---- fastanime/cli/commands/anilist/trending.py | 28 ++++++++++++---- fastanime/cli/commands/anilist/upcoming.py | 28 ++++++++++++---- fastanime/cli/commands/anilist/watching.py | 32 +++++++++++++------ 16 files changed, 321 insertions(+), 112 deletions(-) diff --git a/fastanime/cli/commands/anilist/completed.py b/fastanime/cli/commands/anilist/completed.py index be55b6d..7308146 100644 --- a/fastanime/cli/commands/anilist/completed.py +++ b/fastanime/cli/commands/anilist/completed.py @@ -7,16 +7,23 @@ if TYPE_CHECKING: @click.command(help="View anime you completed") +@click.option( + "--dump-json", + "-d", + is_flag=True, + help="Only print out the results dont open anilist menu", +) @click.pass_obj -def completed(config: "Config"): +def completed(config: "Config", dump_json): + from sys import exit + from ....anilist import AniList - from ...interfaces import anilist_interfaces - from ...utils.tools import FastAnimeRuntimeState, exit_app + from ...utils.tools import FastAnimeRuntimeState if not config.user: print("Not authenticated") print("Please run: fastanime anilist loggin") - exit_app() + exit(1) anime_list = AniList.get_anime_list("COMPLETED") if not anime_list or not anime_list[1]: return @@ -27,6 +34,13 @@ def completed(config: "Config"): for mediaListItem in anime_list[1]["data"]["Page"]["mediaList"] ] # pyright:ignore anime_list[1]["data"]["Page"]["media"] = media # pyright:ignore - fastanime_runtime_state = FastAnimeRuntimeState() - fastanime_runtime_state.anilist_data = anime_list[1] - anilist_interfaces.anilist_results_menu(config, fastanime_runtime_state) + if dump_json: + import json + + print(json.dumps(anime_list)) + else: + from ...interfaces import anilist_interfaces + + fastanime_runtime_state = FastAnimeRuntimeState() + fastanime_runtime_state.anilist_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 b077f55..2aad8a8 100644 --- a/fastanime/cli/commands/anilist/dropped.py +++ b/fastanime/cli/commands/anilist/dropped.py @@ -7,26 +7,40 @@ if TYPE_CHECKING: @click.command(help="View anime you dropped") +@click.option( + "--dump-json", + "-d", + is_flag=True, + help="Only print out the results dont open anilist menu", +) @click.pass_obj -def dropped(config: "Config"): +def dropped(config: "Config", dump_json): + from sys import exit + from ....anilist import AniList - from ...interfaces import anilist_interfaces - from ...utils.tools import FastAnimeRuntimeState, exit_app if not config.user: print("Not authenticated") print("Please run: fastanime anilist loggin") - exit_app() + exit(1) anime_list = AniList.get_anime_list("DROPPED") if not anime_list: - return + exit(1) if not anime_list[0] or not anime_list[1]: - return + exit(1) media = [ mediaListItem["media"] for mediaListItem in anime_list[1]["data"]["Page"]["mediaList"] ] # pyright:ignore anime_list[1]["data"]["Page"]["media"] = media # pyright:ignore - fastanime_runtime_state = FastAnimeRuntimeState() - fastanime_runtime_state.anilist_data = anime_list[1] - anilist_interfaces.anilist_results_menu(config, fastanime_runtime_state) + if dump_json: + import json + + print(json.dumps(anime_list[1])) + else: + from ...interfaces import anilist_interfaces + from ...utils.tools import FastAnimeRuntimeState + + fastanime_runtime_state = FastAnimeRuntimeState() + fastanime_runtime_state.anilist_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 bcd8464..23da683 100644 --- a/fastanime/cli/commands/anilist/favourites.py +++ b/fastanime/cli/commands/anilist/favourites.py @@ -5,14 +5,30 @@ import click help="Fetch the top 15 most favourited anime from anilist", short_help="View most favourited anime", ) +@click.option( + "--dump-json", + "-d", + is_flag=True, + help="Only print out the results dont open anilist menu", +) @click.pass_obj -def favourites(config): +def favourites(config, dump_json): from ....anilist import AniList - from ...interfaces.anilist_interfaces import anilist_results_menu - from ...utils.tools import FastAnimeRuntimeState anime_data = AniList.get_most_favourite() if anime_data[0]: - fastanime_runtime_state = FastAnimeRuntimeState() - fastanime_runtime_state.anilist_data = anime_data[1] - anilist_results_menu(config, fastanime_runtime_state) + if dump_json: + import json + + print(json.dumps(anime_data[1])) + else: + from ...interfaces.anilist_interfaces import anilist_results_menu + from ...utils.tools import FastAnimeRuntimeState + + fastanime_runtime_state = FastAnimeRuntimeState() + fastanime_runtime_state.anilist_data = anime_data[1] + anilist_results_menu(config, fastanime_runtime_state) + else: + from sys import exit + + exit(1) diff --git a/fastanime/cli/commands/anilist/login.py b/fastanime/cli/commands/anilist/login.py index 9890030..d2d68d2 100644 --- a/fastanime/cli/commands/anilist/login.py +++ b/fastanime/cli/commands/anilist/login.py @@ -11,11 +11,11 @@ if TYPE_CHECKING: @click.option("--erase", "-e", help="Erase your login details", is_flag=True) @click.pass_obj def login(config: "Config", status, erase): + from sys import exit + from rich import print from rich.prompt import Confirm, Prompt - from ...utils.tools import exit_app - if status: is_logged_in = True if config.user else False message = ( @@ -23,16 +23,16 @@ def login(config: "Config", status, erase): ) print(message) print(config.user) - exit_app() + exit(0) elif erase: if Confirm.ask( "Are you sure you want to erase your login status", default=False ): config.update_user({}) print("Success") - exit_app(0) + exit(0) else: - exit_app(1) + exit(1) else: from click import launch @@ -41,7 +41,7 @@ def login(config: "Config", status, erase): if config.user: print("Already logged in :confused:") if not Confirm.ask("or would you like to reloggin", default=True): - exit_app() + exit(0) # ---- new loggin ----- print( f"A browser session will be opened ( [link]{config.fastanime_anilist_app_login_url}[/link] )", @@ -52,10 +52,10 @@ def login(config: "Config", status, erase): user = AniList.login_user(token) if not user: print("Sth went wrong", user) - exit_app() + exit(1) return user["token"] = token config.update_user(user) print("Successfully saved credentials") print(user) - exit_app() + exit(0) diff --git a/fastanime/cli/commands/anilist/notifier.py b/fastanime/cli/commands/anilist/notifier.py index f1a64b9..b49c5f2 100644 --- a/fastanime/cli/commands/anilist/notifier.py +++ b/fastanime/cli/commands/anilist/notifier.py @@ -13,6 +13,7 @@ def notifier(config: "Config"): import logging import os import time + from sys import exit import requests from plyer import notification @@ -30,7 +31,7 @@ def notifier(config: "Config"): if not config.user: print("Not Authenticated") print("Run the following to get started: fastanime anilist loggin") - return + exit(1) run = True # WARNING: Mess around with this value at your own risk timeout = 2 # time is in minutes diff --git a/fastanime/cli/commands/anilist/paused.py b/fastanime/cli/commands/anilist/paused.py index d0fb19f..6637ef6 100644 --- a/fastanime/cli/commands/anilist/paused.py +++ b/fastanime/cli/commands/anilist/paused.py @@ -7,26 +7,40 @@ if TYPE_CHECKING: @click.command(help="View anime you paused on watching") +@click.option( + "--dump-json", + "-d", + is_flag=True, + help="Only print out the results dont open anilist menu", +) @click.pass_obj -def paused(config: "Config"): +def paused(config: "Config", dump_json): + from sys import exit + from ....anilist import AniList - from ...interfaces import anilist_interfaces - from ...utils.tools import FastAnimeRuntimeState, exit_app if not config.user: print("Not authenticated") print("Please run: fastanime anilist loggin") - exit_app() + exit(1) anime_list = AniList.get_anime_list("PAUSED") if not anime_list: - return + exit(1) if not anime_list[0] or not anime_list[1]: - return + exit(1) media = [ mediaListItem["media"] for mediaListItem in anime_list[1]["data"]["Page"]["mediaList"] ] # pyright:ignore anime_list[1]["data"]["Page"]["media"] = media # pyright:ignore - anilist_config = FastAnimeRuntimeState() - anilist_config.data = anime_list[1] - anilist_interfaces.anilist_results_menu(config, anilist_config) + if dump_json: + import json + + print(json.dumps(anime_list[1])) + else: + from ...interfaces import anilist_interfaces + from ...utils.tools import FastAnimeRuntimeState + + anilist_config = FastAnimeRuntimeState() + anilist_config.data = anime_list[1] + anilist_interfaces.anilist_results_menu(config, anilist_config) diff --git a/fastanime/cli/commands/anilist/planning.py b/fastanime/cli/commands/anilist/planning.py index 5dc321b..71cb9ee 100644 --- a/fastanime/cli/commands/anilist/planning.py +++ b/fastanime/cli/commands/anilist/planning.py @@ -7,26 +7,40 @@ if TYPE_CHECKING: @click.command(help="View anime you are planning on watching") +@click.option( + "--dump-json", + "-d", + is_flag=True, + help="Only print out the results dont open anilist menu", +) @click.pass_obj -def planning(config: "Config"): +def planning(config: "Config", dump_json): + from sys import exit + from ....anilist import AniList - from ...interfaces import anilist_interfaces - from ...utils.tools import FastAnimeRuntimeState, exit_app if not config.user: print("Not authenticated") print("Please run: fastanime anilist loggin") - exit_app() + exit(1) anime_list = AniList.get_anime_list("PLANNING") if not anime_list: - return + exit(1) if not anime_list[0] or not anime_list[1]: - return + exit(1) media = [ mediaListItem["media"] for mediaListItem in anime_list[1]["data"]["Page"]["mediaList"] ] # pyright:ignore anime_list[1]["data"]["Page"]["media"] = media # pyright:ignore - fastanime_runtime_state = FastAnimeRuntimeState() - fastanime_runtime_state.anilist_data = anime_list[1] - anilist_interfaces.anilist_results_menu(config, fastanime_runtime_state) + if dump_json: + import json + + print(json.dumps(anime_list[1])) + else: + from ...interfaces import anilist_interfaces + from ...utils.tools import FastAnimeRuntimeState + + fastanime_runtime_state = FastAnimeRuntimeState() + fastanime_runtime_state.anilist_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 26c73ac..c7ee998 100644 --- a/fastanime/cli/commands/anilist/popular.py +++ b/fastanime/cli/commands/anilist/popular.py @@ -4,14 +4,30 @@ import click @click.command( help="Fetch the top 15 most popular anime", short_help="View most popular anime" ) +@click.option( + "--dump-json", + "-d", + is_flag=True, + help="Only print out the results dont open anilist menu", +) @click.pass_obj -def popular(config): +def popular(config, dump_json): from ....anilist import AniList - from ...interfaces.anilist_interfaces import anilist_results_menu - from ...utils.tools import FastAnimeRuntimeState anime_data = AniList.get_most_popular() if anime_data[0]: - fastanime_runtime_state = FastAnimeRuntimeState() - fastanime_runtime_state.anilist_data = anime_data[1] - anilist_results_menu(config, fastanime_runtime_state) + if dump_json: + import json + + print(json.dumps(anime_data[1])) + else: + from ...interfaces.anilist_interfaces import anilist_results_menu + from ...utils.tools import FastAnimeRuntimeState + + fastanime_runtime_state = FastAnimeRuntimeState() + fastanime_runtime_state.anilist_data = anime_data[1] + anilist_results_menu(config, fastanime_runtime_state) + else: + from sys import exit + + exit(1) diff --git a/fastanime/cli/commands/anilist/random_anime.py b/fastanime/cli/commands/anilist/random_anime.py index 506aeea..efb9774 100644 --- a/fastanime/cli/commands/anilist/random_anime.py +++ b/fastanime/cli/commands/anilist/random_anime.py @@ -5,23 +5,35 @@ import click help="Get random anime from anilist based on a range of anilist anime ids that are seected at random", short_help="View random anime", ) +@click.option( + "--dump-json", + "-d", + is_flag=True, + help="Only print out the results dont open anilist menu", +) @click.pass_obj -def random_anime(config): +def random_anime(config, dump_json): import random from ....anilist import AniList - from ...interfaces.anilist_interfaces import anilist_results_menu - from ...utils.tools import FastAnimeRuntimeState - random_anime = range(1, 15000) + random_anime = range(1, 100000) random_anime = random.sample(random_anime, k=50) anime_data = AniList.search(id_in=list(random_anime)) if anime_data[0]: - fastanime_runtime_state = FastAnimeRuntimeState() - fastanime_runtime_state.anilist_data = anime_data[1] - anilist_results_menu(config, fastanime_runtime_state) + if dump_json: + import json + + print(json.dumps(anime_data[1])) + else: + from ...interfaces.anilist_interfaces import anilist_results_menu + from ...utils.tools import FastAnimeRuntimeState + + fastanime_runtime_state = FastAnimeRuntimeState() + fastanime_runtime_state.anilist_data = anime_data[1] + anilist_results_menu(config, fastanime_runtime_state) else: - print(anime_data[1]) + exit(1) diff --git a/fastanime/cli/commands/anilist/recent.py b/fastanime/cli/commands/anilist/recent.py index 14750ba..5d12751 100644 --- a/fastanime/cli/commands/anilist/recent.py +++ b/fastanime/cli/commands/anilist/recent.py @@ -5,14 +5,30 @@ import click help="Fetch the 15 most recently updated anime from anilist that are currently releasing", short_help="View recently updated anime", ) +@click.option( + "--dump-json", + "-d", + is_flag=True, + help="Only print out the results dont open anilist menu", +) @click.pass_obj -def recent(config): +def recent(config, dump_json): from ....anilist import AniList - from ...interfaces.anilist_interfaces import anilist_results_menu - from ...utils.tools import FastAnimeRuntimeState anime_data = AniList.get_most_recently_updated() if anime_data[0]: - fastanime_runtime_state = FastAnimeRuntimeState() - fastanime_runtime_state.anilist_data = anime_data[1] - anilist_results_menu(config, fastanime_runtime_state) + if dump_json: + import json + + print(json.dumps(anime_data[1])) + else: + from ...interfaces.anilist_interfaces import anilist_results_menu + from ...utils.tools import FastAnimeRuntimeState + + fastanime_runtime_state = FastAnimeRuntimeState() + fastanime_runtime_state.anilist_data = anime_data[1] + anilist_results_menu(config, fastanime_runtime_state) + else: + from sys import exit + + exit(1) diff --git a/fastanime/cli/commands/anilist/rewatching.py b/fastanime/cli/commands/anilist/rewatching.py index f64ed9a..3305ecd 100644 --- a/fastanime/cli/commands/anilist/rewatching.py +++ b/fastanime/cli/commands/anilist/rewatching.py @@ -7,26 +7,40 @@ if TYPE_CHECKING: @click.command(help="View anime you are rewatching") +@click.option( + "--dump-json", + "-d", + is_flag=True, + help="Only print out the results dont open anilist menu", +) @click.pass_obj -def rewatching(config: "Config"): +def rewatching(config: "Config", dump_json): + from sys import exit + from ....anilist import AniList - from ...interfaces import anilist_interfaces - from ...utils.tools import FastAnimeRuntimeState, exit_app if not config.user: print("Not authenticated") print("Please run: fastanime anilist loggin") - exit_app() + exit(1) anime_list = AniList.get_anime_list("REPEATING") if not anime_list: - return + exit(1) if not anime_list[0] or not anime_list[1]: - return + exit(1) media = [ mediaListItem["media"] for mediaListItem in anime_list[1]["data"]["Page"]["mediaList"] ] # pyright:ignore anime_list[1]["data"]["Page"]["media"] = media # pyright:ignore - fastanime_runtime_state = FastAnimeRuntimeState() - fastanime_runtime_state.anilist_data = anime_list[1] - anilist_interfaces.anilist_results_menu(config, fastanime_runtime_state) + if dump_json: + import json + + print(json.dumps(anime_list[1])) + else: + from ...interfaces import anilist_interfaces + from ...utils.tools import FastAnimeRuntimeState + + fastanime_runtime_state = FastAnimeRuntimeState() + fastanime_runtime_state.anilist_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 985c289..43551f8 100644 --- a/fastanime/cli/commands/anilist/scores.py +++ b/fastanime/cli/commands/anilist/scores.py @@ -4,14 +4,30 @@ import click @click.command( help="Fetch the 15 most scored anime", short_help="View most scored anime" ) +@click.option( + "--dump-json", + "-d", + is_flag=True, + help="Only print out the results dont open anilist menu", +) @click.pass_obj -def scores(config): +def scores(config, dump_json): from ....anilist import AniList - from ...interfaces.anilist_interfaces import anilist_results_menu - from ...utils.tools import FastAnimeRuntimeState anime_data = AniList.get_most_scored() if anime_data[0]: - fastanime_runtime_state = FastAnimeRuntimeState() - fastanime_runtime_state.data = anime_data[1] - anilist_results_menu(config, fastanime_runtime_state) + if dump_json: + import json + + print(json.dumps(anime_data[1])) + else: + from ...interfaces.anilist_interfaces import anilist_results_menu + from ...utils.tools import FastAnimeRuntimeState + + fastanime_runtime_state = FastAnimeRuntimeState() + fastanime_runtime_state.data = anime_data[1] + anilist_results_menu(config, fastanime_runtime_state) + else: + from sys import exit + + exit(1) diff --git a/fastanime/cli/commands/anilist/search.py b/fastanime/cli/commands/anilist/search.py index 1a00915..5f79ef4 100644 --- a/fastanime/cli/commands/anilist/search.py +++ b/fastanime/cli/commands/anilist/search.py @@ -7,15 +7,31 @@ from ...completion_functions import anime_titles_shell_complete help="Search for anime using anilists api and get top ~50 results", short_help="Search for anime", ) -@click.argument("title", shell_complete=anime_titles_shell_complete) +@click.option("--title", "-t", shell_complete=anime_titles_shell_complete) +@click.option( + "--dump-json", + "-d", + is_flag=True, + help="Only print out the results dont open anilist menu", +) @click.pass_obj -def search(config, title): +def search(config, title, dump_json): from ....anilist import AniList - from ...interfaces.anilist_interfaces import anilist_results_menu - from ...utils.tools import FastAnimeRuntimeState success, search_results = AniList.search(title) if success: - fastanime_runtime_state = FastAnimeRuntimeState() - fastanime_runtime_state.anilist_data = search_results - anilist_results_menu(config, fastanime_runtime_state) + if dump_json: + import json + + print(json.dumps(search_results)) + else: + from ...interfaces.anilist_interfaces import anilist_results_menu + from ...utils.tools import FastAnimeRuntimeState + + fastanime_runtime_state = FastAnimeRuntimeState() + fastanime_runtime_state.anilist_data = search_results + anilist_results_menu(config, fastanime_runtime_state) + else: + from sys import exit + + exit(1) diff --git a/fastanime/cli/commands/anilist/trending.py b/fastanime/cli/commands/anilist/trending.py index c67aacd..a51ccbd 100644 --- a/fastanime/cli/commands/anilist/trending.py +++ b/fastanime/cli/commands/anilist/trending.py @@ -5,14 +5,30 @@ import click help="Fetch the top 15 anime that are currently trending", short_help="Trending anime 🔥🔥🔥", ) +@click.option( + "--dump-json", + "-d", + is_flag=True, + help="Only print out the results dont open anilist menu", +) @click.pass_obj -def trending(config): +def trending(config, dump_json): from ....anilist import AniList - from ...interfaces.anilist_interfaces import anilist_results_menu - from ...utils.tools import FastAnimeRuntimeState success, data = AniList.get_trending() if success: - fastanime_runtime_state = FastAnimeRuntimeState() - fastanime_runtime_state.anilist_data = data - anilist_results_menu(config, fastanime_runtime_state) + if dump_json: + import json + + print(json.dumps(data)) + else: + from ...interfaces.anilist_interfaces import anilist_results_menu + from ...utils.tools import FastAnimeRuntimeState + + fastanime_runtime_state = FastAnimeRuntimeState() + fastanime_runtime_state.anilist_data = data + anilist_results_menu(config, fastanime_runtime_state) + else: + from sys import exit + + exit(1) diff --git a/fastanime/cli/commands/anilist/upcoming.py b/fastanime/cli/commands/anilist/upcoming.py index a22e184..4d2aa1f 100644 --- a/fastanime/cli/commands/anilist/upcoming.py +++ b/fastanime/cli/commands/anilist/upcoming.py @@ -4,14 +4,30 @@ import click @click.command( help="Fetch the 15 most anticipited anime", short_help="View upcoming anime" ) +@click.option( + "--dump-json", + "-d", + is_flag=True, + help="Only print out the results dont open anilist menu", +) @click.pass_obj -def upcoming(config): +def upcoming(config, dump_json): from ....anilist import AniList - from ...interfaces.anilist_interfaces import anilist_results_menu - from ...utils.tools import FastAnimeRuntimeState success, data = AniList.get_upcoming_anime() if success: - fastanime_runtime_state = FastAnimeRuntimeState() - fastanime_runtime_state.anilist_data = data - anilist_results_menu(config, fastanime_runtime_state) + if dump_json: + import json + + print(json.dumps(data)) + else: + from ...interfaces.anilist_interfaces import anilist_results_menu + from ...utils.tools import FastAnimeRuntimeState + + fastanime_runtime_state = FastAnimeRuntimeState() + fastanime_runtime_state.anilist_data = data + anilist_results_menu(config, fastanime_runtime_state) + else: + from sys import exit + + exit(1) diff --git a/fastanime/cli/commands/anilist/watching.py b/fastanime/cli/commands/anilist/watching.py index d25db39..a3b8e71 100644 --- a/fastanime/cli/commands/anilist/watching.py +++ b/fastanime/cli/commands/anilist/watching.py @@ -7,26 +7,40 @@ if TYPE_CHECKING: @click.command(help="View anime you are watching") +@click.option( + "--dump-json", + "-d", + is_flag=True, + help="Only print out the results dont open anilist menu", +) @click.pass_obj -def watching(config: "Config"): +def watching(config: "Config", dump_json): + from sys import exit + from ....anilist import AniList - from ...interfaces import anilist_interfaces - from ...utils.tools import FastAnimeRuntimeState, exit_app if not config.user: print("Not authenticated") print("Please run: fastanime anilist loggin") - exit_app() + exit(1) anime_list = AniList.get_anime_list("CURRENT") if not anime_list: - return + exit(1) if not anime_list[0] or not anime_list[1]: - return + exit(1) media = [ mediaListItem["media"] for mediaListItem in anime_list[1]["data"]["Page"]["mediaList"] ] # pyright:ignore anime_list[1]["data"]["Page"]["media"] = media # pyright:ignore - fastanime_runtime_state = FastAnimeRuntimeState() - fastanime_runtime_state.anilist_data = anime_list[1] - anilist_interfaces.anilist_results_menu(config, fastanime_runtime_state) + if dump_json: + import json + + print(json.dumps(anime_list[1])) + else: + from ...interfaces import anilist_interfaces + from ...utils.tools import FastAnimeRuntimeState + + fastanime_runtime_state = FastAnimeRuntimeState() + fastanime_runtime_state.anilist_data = anime_list[1] + anilist_interfaces.anilist_results_menu(config, fastanime_runtime_state)