Skip to content

Commit

Permalink
Modified "no subtitles found" notification to be a message instead of…
Browse files Browse the repository at this point in the history
… an error.
  • Loading branch information
morpheus65535 committed Nov 13, 2023
1 parent 0f19d79 commit ad65573
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
11 changes: 9 additions & 2 deletions bazarr/api/episodes/episodes_subtitles.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
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
Expand Down Expand Up @@ -69,6 +69,12 @@ def patch(self):
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:
Expand All @@ -88,7 +94,8 @@ def patch(self):
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:
Expand Down
11 changes: 9 additions & 2 deletions bazarr/api/movies/movies_subtitles.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
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
Expand Down Expand Up @@ -67,6 +67,12 @@ def patch(self):
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:
Expand All @@ -85,7 +91,8 @@ def patch(self):
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:
Expand Down

0 comments on commit ad65573

Please sign in to comment.