mirror of https://github.com/morpheus65535/bazarr
Added search progress modal when searching for an episode subtitles triggered by Plex webhook.
This commit is contained in:
parent
842dbf0827
commit
91c53ba475
|
@ -2111,7 +2111,7 @@ class WebHooksPlex(Resource):
|
||||||
.get()
|
.get()
|
||||||
|
|
||||||
if sonarrEpisodeId:
|
if sonarrEpisodeId:
|
||||||
episode_download_subtitles(no=sonarrEpisodeId['sonarrEpisodeId'])
|
episode_download_subtitles(no=sonarrEpisodeId['sonarrEpisodeId'], send_progress=True)
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
movie_imdb_id = [x['imdb'] for x in ids if 'imdb' in x][0]
|
movie_imdb_id = [x['imdb'] for x in ids if 'imdb' in x][0]
|
||||||
|
|
|
@ -806,7 +806,7 @@ def series_download_subtitles(no):
|
||||||
hide_progress(id='series_search_progress_{}'.format(no))
|
hide_progress(id='series_search_progress_{}'.format(no))
|
||||||
|
|
||||||
|
|
||||||
def episode_download_subtitles(no):
|
def episode_download_subtitles(no, send_progress=False):
|
||||||
conditions = [(TableEpisodes.sonarrEpisodeId == no)]
|
conditions = [(TableEpisodes.sonarrEpisodeId == no)]
|
||||||
conditions += get_exclusion_clause('series')
|
conditions += get_exclusion_clause('series')
|
||||||
episodes_details = TableEpisodes.select(TableEpisodes.path,
|
episodes_details = TableEpisodes.select(TableEpisodes.path,
|
||||||
|
@ -818,7 +818,10 @@ def episode_download_subtitles(no):
|
||||||
TableShows.title,
|
TableShows.title,
|
||||||
TableShows.sonarrSeriesId,
|
TableShows.sonarrSeriesId,
|
||||||
TableEpisodes.audio_language,
|
TableEpisodes.audio_language,
|
||||||
TableShows.seriesType)\
|
TableShows.seriesType,
|
||||||
|
TableEpisodes.title.alias('episodeTitle'),
|
||||||
|
TableEpisodes.season,
|
||||||
|
TableEpisodes.episode)\
|
||||||
.join(TableShows, on=(TableEpisodes.sonarrSeriesId == TableShows.sonarrSeriesId))\
|
.join(TableShows, on=(TableEpisodes.sonarrSeriesId == TableShows.sonarrSeriesId))\
|
||||||
.where(reduce(operator.and_, conditions))\
|
.where(reduce(operator.and_, conditions))\
|
||||||
.dicts()
|
.dicts()
|
||||||
|
@ -831,6 +834,15 @@ def episode_download_subtitles(no):
|
||||||
|
|
||||||
for episode in episodes_details:
|
for episode in episodes_details:
|
||||||
if providers_list:
|
if providers_list:
|
||||||
|
if send_progress:
|
||||||
|
show_progress(id='episode_search_progress_{}'.format(no),
|
||||||
|
header='Searching missing subtitles...',
|
||||||
|
name='{0} - S{1:02d}E{2:02d} - {3}'.format(episode['title'],
|
||||||
|
episode['season'],
|
||||||
|
episode['episode'],
|
||||||
|
episode['episodeTitle']),
|
||||||
|
value=1,
|
||||||
|
count=1)
|
||||||
for language in ast.literal_eval(episode['missing_subtitles']):
|
for language in ast.literal_eval(episode['missing_subtitles']):
|
||||||
# confirm if language is still missing or if cutoff have been reached
|
# confirm if language is still missing or if cutoff have been reached
|
||||||
confirmed_missing_subs = TableEpisodes.select(TableEpisodes.missing_subtitles) \
|
confirmed_missing_subs = TableEpisodes.select(TableEpisodes.missing_subtitles) \
|
||||||
|
@ -875,6 +887,8 @@ def episode_download_subtitles(no):
|
||||||
history_log(1, episode['sonarrSeriesId'], episode['sonarrEpisodeId'], message, path,
|
history_log(1, episode['sonarrSeriesId'], episode['sonarrEpisodeId'], message, path,
|
||||||
language_code, provider, score, subs_id, subs_path)
|
language_code, provider, score, subs_id, subs_path)
|
||||||
send_notifications(episode['sonarrSeriesId'], episode['sonarrEpisodeId'], message)
|
send_notifications(episode['sonarrSeriesId'], episode['sonarrEpisodeId'], message)
|
||||||
|
if send_progress:
|
||||||
|
hide_progress(id='episode_search_progress_{}'.format(no))
|
||||||
else:
|
else:
|
||||||
logging.info("BAZARR All providers are throttled")
|
logging.info("BAZARR All providers are throttled")
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in New Issue