From b9c27d53ad51ab3f30a3d37148ffd1cca4a35b0c Mon Sep 17 00:00:00 2001 From: morpheus65535 Date: Wed, 16 Jun 2021 19:14:21 -0400 Subject: [PATCH] Improved events sent to browser. --- bazarr/api.py | 2 +- bazarr/get_series.py | 2 +- bazarr/get_subtitle.py | 22 ++++++++++++---------- bazarr/signalr_client.py | 6 +++--- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/bazarr/api.py b/bazarr/api.py index 45561962c..d9ac7154e 100644 --- a/bazarr/api.py +++ b/bazarr/api.py @@ -959,7 +959,7 @@ class Movies(Resource): .where(TableMovies.radarrId == radarrId)\ .execute() - list_missing_subtitles_movies(no=radarrId) + list_missing_subtitles_movies(no=radarrId, send_event=False) event_stream(type='movies', payload=radarrId) event_stream(type='badges') diff --git a/bazarr/get_series.py b/bazarr/get_series.py index 1ef7b90f1..6dbe76292 100644 --- a/bazarr/get_series.py +++ b/bazarr/get_series.py @@ -193,7 +193,7 @@ def update_one_series(series_id, action): # Update existing series in DB if action == 'updated' and existing_series: TableShows.update(series).where(TableShows.sonarrSeriesId == series['sonarrSeriesId']).execute() - sync_episodes(series_id=int(series_id), send_event=False) + sync_episodes(series_id=int(series_id), send_event=True) event_stream(type='series', action='update', payload=int(series_id)) logging.debug('BAZARR updated this series into the database:{}'.format(path_mappings.path_replace( series['path']))) diff --git a/bazarr/get_subtitle.py b/bazarr/get_subtitle.py index 6b5d94a53..0bedc8fb4 100644 --- a/bazarr/get_subtitle.py +++ b/bazarr/get_subtitle.py @@ -796,11 +796,12 @@ def series_download_subtitles(no): logging.info("BAZARR All providers are throttled") break - show_progress(id='series_search_progress_{}'.format(no), - header='Searching missing subtitles...', - name='Completed successfully', - value=count_episodes_details, - count=count_episodes_details) + if count_episodes_details: + show_progress(id='series_search_progress_{}'.format(no), + header='Searching missing subtitles...', + name='Completed successfully', + value=count_episodes_details, + count=count_episodes_details) hide_progress(id='series_search_progress_{}'.format(no)) @@ -960,11 +961,12 @@ def movies_download_subtitles(no): logging.info("BAZARR All providers are throttled") break - show_progress(id='movie_search_progress_{}'.format(no), - header='Searching missing subtitles...', - name='Completed successfully', - value=count_movie, - count=count_movie) + if count_movie: + show_progress(id='movie_search_progress_{}'.format(no), + header='Searching missing subtitles...', + name='Completed successfully', + value=count_movie, + count=count_movie) hide_progress(id='movie_search_progress_{}'.format(no)) diff --git a/bazarr/signalr_client.py b/bazarr/signalr_client.py index 9242a01fb..941d8bd9f 100644 --- a/bazarr/signalr_client.py +++ b/bazarr/signalr_client.py @@ -51,8 +51,8 @@ class SonarrSignalrClient: self.stop() logging.info('BAZARR SignalR client for Sonarr is connected and waiting for events.') if not args.dev: - scheduler.add_job(update_series, kwargs={'send_event': False}, max_instances=1) - scheduler.add_job(sync_episodes, kwargs={'send_event': False}, max_instances=1) + scheduler.add_job(update_series, kwargs={'send_event': True}, max_instances=1) + scheduler.add_job(sync_episodes, kwargs={'send_event': True}, max_instances=1) def stop(self, log=True): try: @@ -123,7 +123,7 @@ class RadarrSignalrClient: def on_connect_handler(): logging.info('BAZARR SignalR client for Radarr is connected and waiting for events.') if not args.dev: - scheduler.add_job(update_movies, kwargs={'send_event': False}, max_instances=1) + scheduler.add_job(update_movies, kwargs={'send_event': True}, max_instances=1) def configure(self): self.apikey_radarr = settings.radarr.apikey