diff --git a/fastanime/cli/commands/downloads.py b/fastanime/cli/commands/downloads.py index 7e2f778..661bbf5 100644 --- a/fastanime/cli/commands/downloads.py +++ b/fastanime/cli/commands/downloads.py @@ -258,7 +258,12 @@ def downloads(config: "Config", path: bool, view_episodes, ffmpegthumbnailer_see stream_anime() return episode_path = os.path.join(anime_playlist_path, episode_title) - run_mpv(episode_path) + if config.sync_play: + from ..utils.syncplay import SyncPlayer + + SyncPlayer(episode_path) + else: + run_mpv(episode_path) stream_episode(anime_playlist_path) def stream_anime(): @@ -291,7 +296,12 @@ def downloads(config: "Config", path: bool, view_episodes, ffmpegthumbnailer_see playlist, ) else: - run_mpv(playlist) + if config.sync_play: + from ..utils.syncplay import SyncPlayer + + SyncPlayer(playlist) + else: + run_mpv(playlist) stream_anime() stream_anime() diff --git a/fastanime/cli/utils/syncplay.py b/fastanime/cli/utils/syncplay.py index 6ee55d7..956c722 100644 --- a/fastanime/cli/utils/syncplay.py +++ b/fastanime/cli/utils/syncplay.py @@ -4,7 +4,7 @@ import subprocess from .tools import exit_app -def SyncPlayer(url: str, anime_title, *args): +def SyncPlayer(url: str, anime_title=None, *args): # TODO: handle m3u8 multi quality streams # # check for SyncPlay @@ -14,8 +14,17 @@ def SyncPlayer(url: str, anime_title, *args): exit_app(1) return "0", "0" # start SyncPlayer - subprocess.run( - [SYNCPLAY_EXECUTABLE, url, "--", f"--force-media-title={anime_title}"] - ) + if not anime_title: + subprocess.run( + [ + SYNCPLAY_EXECUTABLE, + url, + ] + ) + else: + subprocess.run( + [SYNCPLAY_EXECUTABLE, url, "--", f"--force-media-title={anime_title}"] + ) + # for compatability return "0", "0"