Compare commits

..

5 Commits

Author SHA1 Message Date
Benex254
603efd56e8 chore: remove dbus-python 2024-08-09 13:48:36 +03:00
Benex254
4d74dfa339 feat(mpv): improve auto next 2024-08-09 13:47:23 +03:00
Benex254
4681e38153 chore: bump version 2024-08-09 01:09:34 +03:00
Benex254
242003500d chore: add dbus-python as dep for notifications 2024-08-09 01:07:32 +03:00
Benex254
66ab365657 feat(mpv): add ytdl to true 2024-08-09 01:06:53 +03:00
3 changed files with 19 additions and 13 deletions

View File

@@ -6,7 +6,7 @@ if sys.version_info < (3, 10):
) # noqa: F541
__version__ = "v0.60.3"
__version__ = "v0.60.4"
APP_NAME = "FastAnime"
AUTHOR = "Benex254"

View File

@@ -27,6 +27,7 @@ class MpvPlayer(object):
last_stop_time_secs = 0
last_total_time_secs = 0
current_media_title = ""
player_fetching = False
def get_episode(
self,
@@ -148,6 +149,7 @@ class MpvPlayer(object):
input_default_bindings=True,
input_vo_keyboard=True,
osc=True,
ytdl=True,
)
mpv_player.force_window = config.force_window
# mpv_player.cache = "yes"
@@ -160,6 +162,7 @@ class MpvPlayer(object):
@mpv_player.event_callback("file-loaded")
def set_total_time(event, *args):
d = mpv_player._get_property("duration")
self.player_fetching = False
if isinstance(d, float):
self.last_total_time = format_time(d)
@@ -171,17 +174,20 @@ class MpvPlayer(object):
self.last_stop_time = format_time(value)
@mpv_player.property_observer("time-remaining")
def handle_time_remaining_update(*args):
if len(args) > 1:
value = args[1]
if value is not None:
if value < 10 and config.auto_next:
url = self.get_episode("next")
if url:
mpv_player.loadfile(
url,
)
mpv_player.title = self.current_media_title
def handle_time_remaining_update(
property, time_remaining: float | None = None, *args
):
if time_remaining is not None:
print(time_remaining, self.player_fetching)
if time_remaining < 1 and config.auto_next and not self.player_fetching:
print("Auto Fetching Next Episode")
self.player_fetching = True
url = self.get_episode("next")
if url:
mpv_player.loadfile(
url,
)
mpv_player.title = self.current_media_title
# -- keybindings --
@mpv_player.on_key_press("shift+n")

View File

@@ -1,6 +1,6 @@
[tool.poetry]
name = "fastanime"
version = "0.60.3.dev1"
version = "0.60.4.dev1"
description = "A browser anime site experience from the terminal"
authors = ["Benextempest <benextempest@gmail.com>"]
license = "UNLICENSE"