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
1515from anilist import search_anime_by_title
1616from anilist import get_user_data, get_anilist_user_id, update_anime_progress
1717from 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
1919from select_anime import load_anime_data
2020from select_anime import extract_anime_info
2121from select_anime import select_anime
@@ -103,6 +103,7 @@ history_file="$HOME/.local/share/curd/curd_history.txt"
103103subs_language="english"
104104sub_or_dub="sub"
105105score_on_completion=true
106save_mpv_speed=true
106107discord_presence=true
107108presence_script_path="curddiscordpresence.py"
108109""")
@@ -388,6 +389,11 @@ while True:
388389 run_script("episode_url")
389390 links = load_links("scripts/tmp/links")
390391 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
391397 # watching_ep = current_ep+1
392398
393399 # 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):
3737 return None
3838 return None
3939
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
4048def get_percentage_watched(ipc_socket_path):
4149 """
4250 Calculates the percentage watched of the currently playing video.