anipy-cli 2.7.31__py3-none-any.whl → 3.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of anipy-cli might be problematic. Click here for more details.

Files changed (62) hide show
  1. anipy_cli/__init__.py +2 -20
  2. anipy_cli/arg_parser.py +30 -20
  3. anipy_cli/cli.py +66 -0
  4. anipy_cli/clis/__init__.py +15 -0
  5. anipy_cli/clis/base_cli.py +32 -0
  6. anipy_cli/clis/binge_cli.py +83 -0
  7. anipy_cli/clis/default_cli.py +104 -0
  8. anipy_cli/clis/download_cli.py +111 -0
  9. anipy_cli/clis/history_cli.py +93 -0
  10. anipy_cli/clis/mal_cli.py +71 -0
  11. anipy_cli/{cli/clis → clis}/seasonal_cli.py +9 -6
  12. anipy_cli/colors.py +4 -4
  13. anipy_cli/config.py +308 -87
  14. anipy_cli/discord.py +34 -0
  15. anipy_cli/mal_proxy.py +216 -0
  16. anipy_cli/menus/__init__.py +5 -0
  17. anipy_cli/{cli/menus → menus}/base_menu.py +8 -12
  18. anipy_cli/menus/mal_menu.py +660 -0
  19. anipy_cli/menus/menu.py +194 -0
  20. anipy_cli/menus/seasonal_menu.py +263 -0
  21. anipy_cli/prompts.py +231 -0
  22. anipy_cli/util.py +262 -0
  23. anipy_cli-3.0.0.dist-info/METADATA +67 -0
  24. anipy_cli-3.0.0.dist-info/RECORD +26 -0
  25. {anipy_cli-2.7.31.dist-info → anipy_cli-3.0.0.dist-info}/WHEEL +1 -2
  26. anipy_cli-3.0.0.dist-info/entry_points.txt +3 -0
  27. anipy_cli/cli/__init__.py +0 -1
  28. anipy_cli/cli/cli.py +0 -37
  29. anipy_cli/cli/clis/__init__.py +0 -6
  30. anipy_cli/cli/clis/base_cli.py +0 -43
  31. anipy_cli/cli/clis/binge_cli.py +0 -54
  32. anipy_cli/cli/clis/default_cli.py +0 -46
  33. anipy_cli/cli/clis/download_cli.py +0 -92
  34. anipy_cli/cli/clis/history_cli.py +0 -64
  35. anipy_cli/cli/clis/mal_cli.py +0 -27
  36. anipy_cli/cli/menus/__init__.py +0 -3
  37. anipy_cli/cli/menus/mal_menu.py +0 -411
  38. anipy_cli/cli/menus/menu.py +0 -108
  39. anipy_cli/cli/menus/seasonal_menu.py +0 -177
  40. anipy_cli/cli/util.py +0 -125
  41. anipy_cli/download.py +0 -467
  42. anipy_cli/history.py +0 -83
  43. anipy_cli/mal.py +0 -651
  44. anipy_cli/misc.py +0 -227
  45. anipy_cli/player/__init__.py +0 -1
  46. anipy_cli/player/player.py +0 -35
  47. anipy_cli/player/players/__init__.py +0 -3
  48. anipy_cli/player/players/base.py +0 -107
  49. anipy_cli/player/players/mpv.py +0 -19
  50. anipy_cli/player/players/mpv_control.py +0 -37
  51. anipy_cli/player/players/syncplay.py +0 -19
  52. anipy_cli/player/players/vlc.py +0 -18
  53. anipy_cli/query.py +0 -100
  54. anipy_cli/run_anipy_cli.py +0 -14
  55. anipy_cli/seasonal.py +0 -112
  56. anipy_cli/url_handler.py +0 -470
  57. anipy_cli/version.py +0 -1
  58. anipy_cli-2.7.31.dist-info/LICENSE +0 -674
  59. anipy_cli-2.7.31.dist-info/METADATA +0 -162
  60. anipy_cli-2.7.31.dist-info/RECORD +0 -43
  61. anipy_cli-2.7.31.dist-info/entry_points.txt +0 -2
  62. anipy_cli-2.7.31.dist-info/top_level.txt +0 -1
@@ -1,177 +0,0 @@
1
- import sys
2
- from typing import List
3
- from yaspin import yaspin
4
- from yaspin.spinners import Spinners
5
-
6
-
7
- from anipy_cli.arg_parser import CliArgs
8
- from anipy_cli.colors import colors, cprint, cinput
9
- from anipy_cli.misc import Entry, print_names, error, clear_console
10
- from anipy_cli.player import get_player
11
- from anipy_cli.url_handler import videourl, epHandler
12
- from anipy_cli.query import query
13
- from anipy_cli.download import download
14
- from anipy_cli.config import Config
15
- from anipy_cli.seasonal import Seasonal
16
- from anipy_cli.cli.util import get_season_searches, binge
17
- from anipy_cli.cli.menus.base_menu import MenuBase, MenuOption
18
-
19
-
20
- class SeasonalMenu(MenuBase, Seasonal):
21
- def __init__(self, options: CliArgs, rpc_client=None):
22
- super().__init__()
23
-
24
- self.rpc_client = rpc_client
25
- self.options = options
26
- self.entry = Entry()
27
- self.dl_path = Config().seasonals_dl_path
28
- if options.location:
29
- self.dl_path = options.location
30
-
31
- @property
32
- def menu_options(self) -> List[MenuOption]:
33
- return [
34
- MenuOption("Add Anime", self.add_anime, "a"),
35
- MenuOption("Delete one anime from seasonals", self.del_anime, "e"),
36
- MenuOption("List anime in seasonals file", self.list_animes, "l"),
37
- MenuOption("Download newest episodes", self.download_latest, "d"),
38
- MenuOption("Binge watch newest episodes", self.binge_latest, "w"),
39
- MenuOption("Quit", self.quit, "q"),
40
- ]
41
-
42
- def print_header(self):
43
- pass
44
-
45
- def add_anime(self):
46
- show_entry = Entry()
47
- is_season_search = False
48
- searches = []
49
- if (
50
- not self.options.no_season_search
51
- and input("Search for anime in Season? (y|n): \n>> ") == "y"
52
- ):
53
- searches = get_season_searches()
54
-
55
- else:
56
- searches.append(input("Search: "))
57
-
58
- for search in searches:
59
- query_class = None
60
- if isinstance(search, dict):
61
- is_season_search = True
62
- links = [search["category_url"]]
63
-
64
- else:
65
- clear_console()
66
- query_class = query(search, show_entry)
67
- query_class.get_pages()
68
- links = query_class.get_links()
69
-
70
- if links == 0:
71
- error("no search results")
72
- input("Enter to continue")
73
- self.print_options()
74
-
75
- if is_season_search:
76
- show_entry = Entry()
77
- show_entry.show_name = search["name"]
78
- show_entry.category_url = search["category_url"]
79
-
80
- else:
81
- show_entry = query_class.pick_show()
82
-
83
- picked_ep = epHandler(show_entry).pick_ep_seasonal().ep
84
- self.add_show(show_entry.show_name, show_entry.category_url, picked_ep)
85
- self.print_options()
86
-
87
- def del_anime(self):
88
- seasonals = self.list_seasonals()
89
- seasonals = [x[0] for x in seasonals]
90
- print_names(seasonals)
91
- while True:
92
- inp = cinput(colors.CYAN, "Enter Number: ")
93
- try:
94
- picked = seasonals[int(inp) - 1]
95
- break
96
- except:
97
- error("Invalid Input")
98
-
99
- self.del_show(picked)
100
-
101
- self.print_options()
102
-
103
- def list_animes(self):
104
- for i in self.list_seasonals():
105
- print(f"==> EP: {i[1]} | {i[0]}")
106
-
107
- def list_possible(self, latest_urls):
108
- for i in latest_urls:
109
- cprint(colors.RED, f"{i}:")
110
- for j in latest_urls[i]["ep_list"]:
111
- cprint(colors.CYAN, f"==> EP: {j[0]}")
112
-
113
- def download_latest(self):
114
- latest_urls = self.latest_eps()
115
-
116
- if not latest_urls:
117
- error("Nothing to download")
118
- return
119
-
120
- print("Stuff to be downloaded:")
121
- self.list_possible(latest_urls)
122
- if not self.options.auto_update:
123
- cinput(colors.RED, "Enter to continue or CTRL+C to abort.")
124
-
125
- for i in latest_urls:
126
- print(f"Downloading newest urls for {i}")
127
- show_entry = Entry()
128
- show_entry.show_name = i
129
- for j in latest_urls[i]["ep_list"]:
130
- show_entry.embed_url = ""
131
- show_entry.ep = j[0]
132
- show_entry.ep_url = j[1]
133
- url_class = videourl(show_entry, self.options.quality)
134
- url_class.stream_url()
135
- show_entry = url_class.get_entry()
136
- download(
137
- show_entry, self.options.quality, self.options.ffmpeg, self.dl_path
138
- ).download()
139
-
140
- if not self.options.auto_update:
141
- self.print_options()
142
-
143
- for i in latest_urls:
144
- self.update_show(i, latest_urls[i]["category_url"])
145
-
146
- def binge_latest(self):
147
- latest_eps = self.latest_eps()
148
- print("Stuff to be watched:")
149
- self.list_possible(latest_eps)
150
- cinput(colors.RED, "Enter to continue or CTRL+C to abort.")
151
- ep_list = []
152
- ep_urls = []
153
- ep_dic = {}
154
- for i in latest_eps:
155
- for j in latest_eps[i]["ep_list"]:
156
- ep_list.append(j[0])
157
- ep_urls.append(j[1])
158
-
159
- ep_dic.update(
160
- {
161
- i: {
162
- "ep_urls": [x for x in ep_urls],
163
- "eps": [x for x in ep_list],
164
- "category_url": latest_eps[i]["category_url"],
165
- }
166
- }
167
- )
168
- ep_list.clear()
169
- ep_urls.clear()
170
-
171
- player = get_player(self.rpc_client, self.options.optional_player)
172
- binge(ep_dic, self.options.quality, player, mode="seasonal")
173
- player.kill_player()
174
- for i in latest_eps:
175
- self.update_show(i, latest_eps[i]["category_url"])
176
-
177
- self.print_options()
anipy_cli/cli/util.py DELETED
@@ -1,125 +0,0 @@
1
- from yaspin import yaspin
2
- from yaspin.spinners import Spinners
3
- from anipy_cli.colors import cprint, colors, cinput
4
- from anipy_cli.misc import Entry, search_in_season_on_gogo, print_names
5
- from anipy_cli.url_handler import epHandler, videourl
6
- from anipy_cli.mal import MAL
7
- from anipy_cli.seasonal import Seasonal
8
- from anipy_cli.player import PlayerBaseType
9
-
10
-
11
- def binge(ep_list, quality, player: PlayerBaseType, mode="", mal_class: MAL = None):
12
- """
13
- TODO: bruh what is this, let this accept a list of Entry
14
- Accepts ep_list like so:
15
- {"name" {'ep_urls': [], 'eps': [], 'category_url': }, "next_anime"...}
16
- """
17
- cprint(colors.RED, "To quit press CTRL+C")
18
- try:
19
- for i in ep_list:
20
- print(i)
21
- show_entry = Entry()
22
- show_entry.show_name = i
23
- show_entry.category_url = ep_list[i]["category_url"]
24
- show_entry.latest_ep = epHandler(show_entry).get_latest()
25
- for url, ep in zip(ep_list[i]["ep_urls"], ep_list[i]["eps"]):
26
- show_entry.ep = ep
27
- show_entry.embed_url = ""
28
- show_entry.ep_url = url
29
- cprint(
30
- colors.GREEN,
31
- "Fetching links for: ",
32
- colors.END,
33
- show_entry.show_name,
34
- colors.RED,
35
- f""" | EP: {
36
- show_entry.ep
37
- }/{
38
- show_entry.latest_ep
39
- }""",
40
- )
41
-
42
- url_class = videourl(show_entry, quality)
43
- url_class.stream_url()
44
- show_entry = url_class.get_entry()
45
- player.play_title(show_entry)
46
- player.wait()
47
-
48
- if mode == "seasonal":
49
- Seasonal().update_show(
50
- show_entry.show_name, show_entry.category_url, show_entry.ep
51
- )
52
- elif mode == "mal":
53
- mal_class.update_watched(show_entry.show_name, show_entry.ep)
54
-
55
- except KeyboardInterrupt:
56
- player.kill_player()
57
-
58
-
59
- def get_season_searches(gogo=True):
60
- searches = []
61
- selected = []
62
- season_year = None
63
- season_name = None
64
- while not season_year:
65
- try:
66
- season_year = int(cinput(colors.CYAN, "Season Year: "))
67
- except ValueError:
68
- print("Please enter a valid year.\n")
69
-
70
- while not season_name:
71
- season_name_input = cinput(
72
- colors.CYAN, "Season Name (spring|summer|fall|winter): "
73
- )
74
- if season_name_input.lower() in ["spring", "summer", "fall", "winter"]:
75
- season_name = season_name_input
76
-
77
- else:
78
- cprint(colors.YELLOW, "Please enter a valid season name.\n")
79
-
80
- with yaspin(
81
- text="Fetching seasonals...", spinner=Spinners.dots, color="cyan"
82
- ) as spinner:
83
- if gogo:
84
- anime_in_season = search_in_season_on_gogo(season_year, season_name)
85
-
86
- else:
87
- anime_in_season = MAL().get_seasonal_anime(season_year, season_name)
88
-
89
- spinner.ok("✔")
90
-
91
- cprint("Anime found in {} {} Season: ".format(season_year, season_name))
92
- cprint(
93
- colors.CYAN,
94
- "Anime found in ",
95
- colors.GREEN,
96
- season_year,
97
- colors.CYAN,
98
- " ",
99
- colors.YELLOW,
100
- season_name,
101
- colors.CYAN,
102
- " Season: ",
103
- )
104
- anime_names = []
105
- for anime in anime_in_season:
106
- if gogo:
107
- anime_names.append(anime["name"])
108
-
109
- else:
110
- anime_names.append(anime["node"]["title"])
111
-
112
- print_names(anime_names)
113
- selection = cinput(colors.CYAN, "Selection: (e.g. 1, 1 3 or 1-3) \n>> ")
114
- if selection.__contains__("-"):
115
- selection_range = selection.strip(" ").split("-")
116
- for i in range(int(selection_range[0]) - 1, int(selection_range[1]) - 1, 1):
117
- selected.append(i)
118
-
119
- else:
120
- for i in selection.lstrip(" ").rstrip(" ").split(" "):
121
- selected.append(int(i) - 1)
122
-
123
- for value in selected:
124
- searches.append(anime_in_season[int(value)])
125
- return searches