Commit 9d4781a0a7

9d4781a0a7b8ac074469515f96269d9ee8c0e926

parent: 5b13696c73

Unsigned

Wraient <wraient.911@gmail.com> · 2024-09-21 23:55 UTC

preserve mpv speed

Layout: unified · split

curd.py +7 −1
@@ -15,7 +15,7 @@ import time
15from anilist import search_anime_by_title 15from anilist import search_anime_by_title
16from anilist import get_user_data, get_anilist_user_id, update_anime_progress 16from anilist import get_user_data, get_anilist_user_id, update_anime_progress
17from select_link import load_links 17from select_link import load_links
18from start_video import start_video, send_command, get_percentage_watched, percentage_watched 18from start_video import start_video, send_command, get_percentage_watched, percentage_watched, get_mpv_playback_speed
19from select_anime import load_anime_data 19from select_anime import load_anime_data
20from select_anime import extract_anime_info 20from select_anime import extract_anime_info
21from select_anime import select_anime 21from select_anime import select_anime
@@ -103,6 +103,7 @@ history_file="$HOME/.local/share/curd/curd_history.txt"
103subs_language="english" 103subs_language="english"
104sub_or_dub="sub" 104sub_or_dub="sub"
105score_on_completion=true 105score_on_completion=true
106save_mpv_speed=true
106discord_presence=true 107discord_presence=true
107presence_script_path="curddiscordpresence.py" 108presence_script_path="curddiscordpresence.py"
108""") 109""")
@@ -388,6 +389,11 @@ while True:
388 run_script("episode_url") 389 run_script("episode_url")
389 links = load_links("scripts/tmp/links") 390 links = load_links("scripts/tmp/links")
390 mpv_args = [] 391 mpv_args = []
392 watched_percentage = 0
393
394 if user_config['save_mpv_speed']==True:
395 mpv_args.append(f'--speed={mpv_playback_speed}')
396
391 # watching_ep = current_ep+1 397 # watching_ep = current_ep+1
392 398
393 # to_continue_or_not_to_continue = input("Continue? (y/n)\n") 399 # to_continue_or_not_to_continue = input("Continue? (y/n)\n")
start_video.py +8
@@ -37,6 +37,14 @@ def send_command(ipc_socket_path, command):
37 return None 37 return None
38 return None 38 return None
39 39
40def get_mpv_playback_speed(ipc_socket_path):
41 current_speed = send_command(ipc_socket_path, ["get_property", "speed"])
42 if current_speed is not None:
43 return current_speed
44 else:
45 print("Failed to get playback speed.")
46
47
40def get_percentage_watched(ipc_socket_path): 48def get_percentage_watched(ipc_socket_path):
41 """ 49 """
42 Calculates the percentage watched of the currently playing video. 50 Calculates the percentage watched of the currently playing video.