From ad6557357d3d3a46d5692e707b3df90c4a20d777 Mon Sep 17 00:00:00 2001 From: morpheus65535 Date: Mon, 13 Nov 2023 13:27:47 -0500 Subject: Modified "no subtitles found" notification to be a message instead of an error. --- bazarr/api/episodes/episodes_subtitles.py | 11 +++++++++-- bazarr/api/movies/movies_subtitles.py | 11 +++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/bazarr/api/episodes/episodes_subtitles.py b/bazarr/api/episodes/episodes_subtitles.py index 4795bc98c..6e10590e9 100644 --- a/bazarr/api/episodes/episodes_subtitles.py +++ b/bazarr/api/episodes/episodes_subtitles.py @@ -15,7 +15,7 @@ from subtitles.tools.delete import delete_subtitles from sonarr.history import history_log from app.notifier import send_notifications from subtitles.indexer.series import store_subtitles -from app.event_handler import event_stream +from app.event_handler import event_stream, show_message from app.config import settings from ..utils import authenticate @@ -69,6 +69,12 @@ class EpisodesSubtitles(Resource): language = args.get('language') hi = args.get('hi').capitalize() forced = args.get('forced').capitalize() + if hi == 'True': + language_str = f'{language}:hi' + elif forced == 'True': + language_str = f'{language}:forced' + else: + language_str = language audio_language_list = get_audio_profile_languages(episodeInfo.audio_language) if len(audio_language_list) > 0: @@ -88,7 +94,8 @@ class EpisodesSubtitles(Resource): store_subtitles(result.path, episodePath) else: event_stream(type='episode', payload=sonarrEpisodeId) - return 'No subtitles found', 500 + show_message(f'No {language_str.upper()} subtitles found') + return '', 204 except OSError: return 'Unable to save subtitles file. Permission or path mapping issue?', 409 else: diff --git a/bazarr/api/movies/movies_subtitles.py b/bazarr/api/movies/movies_subtitles.py index db9385b71..2898e845b 100644 --- a/bazarr/api/movies/movies_subtitles.py +++ b/bazarr/api/movies/movies_subtitles.py @@ -15,7 +15,7 @@ from subtitles.tools.delete import delete_subtitles from radarr.history import history_log_movie from app.notifier import send_notifications_movie from subtitles.indexer.movies import store_subtitles_movie -from app.event_handler import event_stream +from app.event_handler import event_stream, show_message from app.config import settings from ..utils import authenticate @@ -67,6 +67,12 @@ class MoviesSubtitles(Resource): language = args.get('language') hi = args.get('hi').capitalize() forced = args.get('forced').capitalize() + if hi == 'True': + language_str = f'{language}:hi' + elif forced == 'True': + language_str = f'{language}:forced' + else: + language_str = language audio_language_list = get_audio_profile_languages(movieInfo.audio_language) if len(audio_language_list) > 0: @@ -85,7 +91,8 @@ class MoviesSubtitles(Resource): store_subtitles_movie(result.path, moviePath) else: event_stream(type='movie', payload=radarrId) - return 'No subtitles found', 500 + show_message(f'No {language_str.upper()} subtitles found') + return '', 204 except OSError: return 'Unable to save subtitles file. Permission or path mapping issue?', 409 else: -- cgit v1.2.3