mirror of
https://github.com/Benexl/FastAnime.git
synced 2026-01-04 00:37:04 -08:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8f3834453c | ||
|
|
7ad8b8a0e3 | ||
|
|
80b41f06da |
@@ -6,7 +6,7 @@ if sys.version_info < (3, 10):
|
|||||||
) # noqa: F541
|
) # noqa: F541
|
||||||
|
|
||||||
|
|
||||||
__version__ = "v2.3.3"
|
__version__ = "v2.3.4"
|
||||||
|
|
||||||
APP_NAME = "FastAnime"
|
APP_NAME = "FastAnime"
|
||||||
AUTHOR = "Benex254"
|
AUTHOR = "Benex254"
|
||||||
|
|||||||
@@ -1010,6 +1010,42 @@ def media_actions_menu(
|
|||||||
|
|
||||||
media_actions_menu(config, fastanime_runtime_state)
|
media_actions_menu(config, fastanime_runtime_state)
|
||||||
|
|
||||||
|
def _change_player(
|
||||||
|
config: "Config", fastanime_runtime_state: "FastAnimeRuntimeState"
|
||||||
|
):
|
||||||
|
"""Change the translation type to use
|
||||||
|
|
||||||
|
Args:
|
||||||
|
config: [TODO:description]
|
||||||
|
fastanime_runtime_state: [TODO:description]
|
||||||
|
"""
|
||||||
|
# prompt for new translation type
|
||||||
|
options = ["syncplay", "mpv-mod", "default"]
|
||||||
|
if config.use_fzf:
|
||||||
|
player = fzf.run(
|
||||||
|
options,
|
||||||
|
prompt="Select Player:",
|
||||||
|
)
|
||||||
|
elif config.use_rofi:
|
||||||
|
player = Rofi.run(options, "Select Player: ")
|
||||||
|
else:
|
||||||
|
player = fuzzy_inquirer(
|
||||||
|
options,
|
||||||
|
"Select Player",
|
||||||
|
)
|
||||||
|
|
||||||
|
# update internal config
|
||||||
|
if player == "syncplay":
|
||||||
|
config.sync_play = True
|
||||||
|
config.use_mpv_mod = False
|
||||||
|
else:
|
||||||
|
config.sync_play = False
|
||||||
|
if player == "mpv-mod":
|
||||||
|
config.use_mpv_mod = True
|
||||||
|
else:
|
||||||
|
config.use_mpv_mod = False
|
||||||
|
media_actions_menu(config, fastanime_runtime_state)
|
||||||
|
|
||||||
def _view_info(config: "Config", fastanime_runtime_state: "FastAnimeRuntimeState"):
|
def _view_info(config: "Config", fastanime_runtime_state: "FastAnimeRuntimeState"):
|
||||||
"""helper function to view info of an anime from terminal
|
"""helper function to view info of an anime from terminal
|
||||||
|
|
||||||
@@ -1178,6 +1214,7 @@ def media_actions_menu(
|
|||||||
f"{'📖 ' if icons else ''}View Info": _view_info,
|
f"{'📖 ' if icons else ''}View Info": _view_info,
|
||||||
f"{'🎧 ' if icons else ''}Change Translation Type": _change_translation_type,
|
f"{'🎧 ' if icons else ''}Change Translation Type": _change_translation_type,
|
||||||
f"{'💽 ' if icons else ''}Change Provider": _change_provider,
|
f"{'💽 ' if icons else ''}Change Provider": _change_provider,
|
||||||
|
f"{'💽 ' if icons else ''}Change Player": _change_player,
|
||||||
f"{'🔘 ' if icons else ''}Toggle auto select anime": _toggle_auto_select, # WARN: problematic if you choose an anime that doesnt match id
|
f"{'🔘 ' if icons else ''}Toggle auto select anime": _toggle_auto_select, # WARN: problematic if you choose an anime that doesnt match id
|
||||||
f"{'💠 ' if icons else ''}Toggle auto next episode": _toggle_auto_next,
|
f"{'💠 ' if icons else ''}Toggle auto next episode": _toggle_auto_next,
|
||||||
f"{'🔘 ' if icons else ''}Toggle continue from history": _toggle_continue_from_history,
|
f"{'🔘 ' if icons else ''}Toggle continue from history": _toggle_continue_from_history,
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ class MpvPlayer(object):
|
|||||||
elif type == "reload":
|
elif type == "reload":
|
||||||
if current_episode_number not in total_episodes:
|
if current_episode_number not in total_episodes:
|
||||||
self.mpv_player.show_text("Episode not available")
|
self.mpv_player.show_text("Episode not available")
|
||||||
return None, None
|
return
|
||||||
self.mpv_player.show_text("Replaying Episode...")
|
self.mpv_player.show_text("Replaying Episode...")
|
||||||
elif type == "custom":
|
elif type == "custom":
|
||||||
if not ep_no or ep_no not in total_episodes:
|
if not ep_no or ep_no not in total_episodes:
|
||||||
@@ -79,7 +79,7 @@ class MpvPlayer(object):
|
|||||||
self.mpv_player.show_text(
|
self.mpv_player.show_text(
|
||||||
f"Acceptable episodes are: {total_episodes}",
|
f"Acceptable episodes are: {total_episodes}",
|
||||||
)
|
)
|
||||||
return None, None
|
return
|
||||||
|
|
||||||
self.mpv_player.show_text(f"Fetching episode {ep_no}")
|
self.mpv_player.show_text(f"Fetching episode {ep_no}")
|
||||||
current_episode_number = ep_no
|
current_episode_number = ep_no
|
||||||
@@ -114,14 +114,14 @@ class MpvPlayer(object):
|
|||||||
)
|
)
|
||||||
if not episode_streams:
|
if not episode_streams:
|
||||||
self.mpv_player.show_text("No streams were found")
|
self.mpv_player.show_text("No streams were found")
|
||||||
return None, None
|
return
|
||||||
|
|
||||||
# always select the first
|
# always select the first
|
||||||
if server == "top":
|
if server == "top":
|
||||||
selected_server = next(episode_streams, None)
|
selected_server = next(episode_streams, None)
|
||||||
if not selected_server:
|
if not selected_server:
|
||||||
self.mpv_player.show_text("Sth went wrong when loading the episode")
|
self.mpv_player.show_text("Sth went wrong when loading the episode")
|
||||||
return None, None
|
return
|
||||||
else:
|
else:
|
||||||
episode_streams_dict = {
|
episode_streams_dict = {
|
||||||
episode_stream["server"]: episode_stream
|
episode_stream["server"]: episode_stream
|
||||||
@@ -132,14 +132,14 @@ class MpvPlayer(object):
|
|||||||
self.mpv_player.show_text(
|
self.mpv_player.show_text(
|
||||||
f"Invalid server!!; servers available are: {episode_streams_dict.keys()}",
|
f"Invalid server!!; servers available are: {episode_streams_dict.keys()}",
|
||||||
)
|
)
|
||||||
return None, None
|
return
|
||||||
self.current_media_title = selected_server["episode_title"]
|
self.current_media_title = selected_server["episode_title"]
|
||||||
links = selected_server["links"]
|
links = selected_server["links"]
|
||||||
|
|
||||||
stream_link_ = filter_by_quality(quality, links)
|
stream_link_ = filter_by_quality(quality, links)
|
||||||
if not stream_link_:
|
if not stream_link_:
|
||||||
self.mpv_player.show_text("Quality not found")
|
self.mpv_player.show_text("Quality not found")
|
||||||
return None, None
|
return
|
||||||
self.mpv_player._set_property("start", "0")
|
self.mpv_player._set_property("start", "0")
|
||||||
stream_link = stream_link_["link"]
|
stream_link = stream_link_["link"]
|
||||||
fastanime_runtime_state.provider_current_episode_stream_link = stream_link
|
fastanime_runtime_state.provider_current_episode_stream_link = stream_link
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "fastanime"
|
name = "fastanime"
|
||||||
version = "2.3.3"
|
version = "2.3.4"
|
||||||
description = "A browser anime site experience from the terminal"
|
description = "A browser anime site experience from the terminal"
|
||||||
authors = ["Benextempest <benextempest@gmail.com>"]
|
authors = ["Benextempest <benextempest@gmail.com>"]
|
||||||
license = "UNLICENSE"
|
license = "UNLICENSE"
|
||||||
|
|||||||
Reference in New Issue
Block a user