Commit 9d4781a0a7
Unsigned
Layout: unified · split
curd.py +7 −1
| @@ -15,7 +15,7 @@ import time | |||
| 15 | from anilist import search_anime_by_title | 15 | from anilist import search_anime_by_title |
| 16 | from anilist import get_user_data, get_anilist_user_id, update_anime_progress | 16 | from anilist import get_user_data, get_anilist_user_id, update_anime_progress |
| 17 | from select_link import load_links | 17 | from select_link import load_links |
| 18 | from start_video import start_video, send_command, get_percentage_watched, percentage_watched | 18 | from start_video import start_video, send_command, get_percentage_watched, percentage_watched, get_mpv_playback_speed |
| 19 | from select_anime import load_anime_data | 19 | from select_anime import load_anime_data |
| 20 | from select_anime import extract_anime_info | 20 | from select_anime import extract_anime_info |
| 21 | from select_anime import select_anime | 21 | from select_anime import select_anime |
| @@ -103,6 +103,7 @@ history_file="$HOME/.local/share/curd/curd_history.txt" | |||
| 103 | subs_language="english" | 103 | subs_language="english" |
| 104 | sub_or_dub="sub" | 104 | sub_or_dub="sub" |
| 105 | score_on_completion=true | 105 | score_on_completion=true |
| 106 | save_mpv_speed=true | ||
| 106 | discord_presence=true | 107 | discord_presence=true |
| 107 | presence_script_path="curddiscordpresence.py" | 108 | presence_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 | ||
| 40 | def 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 | |||
| 40 | def get_percentage_watched(ipc_socket_path): | 48 | def 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. |