From e2500c9f84bdf2d772a5ab0643884a96c0be69d1 Mon Sep 17 00:00:00 2001 From: Halali Date: Thu, 4 Apr 2019 15:29:08 +0200 Subject: [PATCH] Add long duration notification --- bazarr/get_subtitle.py | 11 +++++++---- views/menu.tpl | 23 +++++++++++++---------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/bazarr/get_subtitle.py b/bazarr/get_subtitle.py index d2a088397..1e617e020 100644 --- a/bazarr/get_subtitle.py +++ b/bazarr/get_subtitle.py @@ -765,11 +765,14 @@ def upgrade_subtitles(): providers_list = get_providers() providers_auth = get_providers_auth() + + count_episode_to_upgrade = len(episodes_to_upgrade) + count_movie_to_upgrade = len(movies_to_upgrade) for i, episode in enumerate(episodes_to_upgrade, 1): if episode[1] in ast.literal_eval(str(episode[9])): - notifications.write(msg='Upgrading series subtitles : ' + str(i) + '/' + str(len(episodes_to_upgrade)), - queue='get_subtitle') + notifications.write(msg='Upgrading series subtitles : ' + str(i) + '/' + str(count_episode_to_upgrade), + queue='get_subtitle', duration='long') result = download_subtitle(path_replace(episode[0]), str(alpha3_from_alpha2(episode[1])), episode[3], providers_list, providers_auth, str(episode[4]), episode[5], 'series', forced_minimum_score=int(episode[2]), is_upgrade=True) @@ -785,8 +788,8 @@ def upgrade_subtitles(): for i, movie in enumerate(movies_to_upgrade, 1): if movie[1] in ast.literal_eval(str(movie[8])): - notifications.write(msg='Upgrading movie subtitles : ' + str(i) + '/' + str(len(movies_to_upgrade)), - queue='get_subtitle') + notifications.write(msg='Upgrading movie subtitles : ' + str(i) + '/' + str(count_movie_to_upgrade), + queue='get_subtitle', duration='long') result = download_subtitle(path_replace_movie(movie[0]), str(alpha3_from_alpha2(movie[1])), movie[3], providers_list, providers_auth, str(movie[4]), movie[5], 'movie', forced_minimum_score=int(movie[2]), is_upgrade=True) diff --git a/views/menu.tpl b/views/menu.tpl index 4dfdc9f1b..62efb2943 100644 --- a/views/menu.tpl +++ b/views/menu.tpl @@ -244,17 +244,20 @@ url: url_notifications, success: function (data) { if (data !== "") { - data = JSON.parse(data); - var msg = data[0]; - var type = data[1]; - var duration = data[2]; - var button = data[3]; - var queue = data[4]; + data = JSON.parse(data); + var msg = data[0]; + var type = data[1]; + var duration = data[2]; + var button = data[3]; + var queue = data[4]; - if (duration === 'temporary') { - timeout = 3000; - killer = queue; - } else { + if (duration === 'temporary') { + timeout = 3000; + killer = queue; + } else if (duration === 'long') { + timeout = 15000; + killer = queue; + } else { timeout = false; killer = false; }