diff options
author | morpheus65535 <[email protected]> | 2024-12-03 22:23:48 -0500 |
---|---|---|
committer | morpheus65535 <[email protected]> | 2024-12-03 22:23:48 -0500 |
commit | 70e2ba7817d240f11ce3702dc3386c35f614028d (patch) | |
tree | 42d071a3ae72263e2e8a6bbfea0819f394a291a6 | |
parent | 1cc5c428ca9d5315f5fb02af69161d6723754fb6 (diff) | |
download | bazarr-70e2ba7817d240f11ce3702dc3386c35f614028d.tar.gz bazarr-70e2ba7817d240f11ce3702dc3386c35f614028d.zip |
Added frontend notification during automatic syncing of subtitles
-rw-r--r-- | bazarr/subtitles/sync.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/bazarr/subtitles/sync.py b/bazarr/subtitles/sync.py index 4726d245f..fc7477f9c 100644 --- a/bazarr/subtitles/sync.py +++ b/bazarr/subtitles/sync.py @@ -3,8 +3,10 @@ import logging import gc +import os from app.config import settings +from app.event_handler import show_progress, hide_progress from subtitles.tools.subsyncer import SubSyncer @@ -40,7 +42,16 @@ def sync_subtitles(video_path, srt_path, srt_lang, forced, hi, percent_score, so 'sonarr_episode_id': sonarr_episode_id, 'radarr_id': radarr_id, } - subsync.sync(**sync_kwargs) + subtitles_filename = os.path.basename(srt_path) + try: + show_progress(id=f'subsync_{subtitles_filename}', + header='Syncing Subtitle', + name=srt_path, + value=1, + count=1) + subsync.sync(**sync_kwargs) + finally: + hide_progress(id=f'subsync_{subtitles_filename}') del subsync gc.collect() return True |