diff --git a/bazarr/get_episodes.py b/bazarr/get_episodes.py index 49ddc0a4c..c5fc868e8 100644 --- a/bazarr/get_episodes.py +++ b/bazarr/get_episodes.py @@ -49,9 +49,10 @@ def sync_episodes(): # Close database connection c.close() - - for seriesId in seriesIdList: - notifications.write(msg='Getting episodes data for this show: ' + seriesId[1], queue='get_episodes') + + seriesIdListLength = len(seriesIdList) + for i, seriesId in enumerate(seriesIdList, 1): + notifications.write(msg='Getting episodes data from Sonarr...', queue='get_episodes', item=i, length=seriesIdListLength) # Get episodes data for a series from Sonarr url_sonarr_api_episode = url_sonarr + "/api/episode?seriesId=" + str(seriesId[0]) + "&apikey=" + apikey_sonarr try: @@ -151,8 +152,6 @@ def sync_episodes(): list_missing_subtitles() logging.debug('BAZARR All missing subtitles updated in database.') - - notifications.write(msg='Episodes sync from Sonarr ended.', queue='get_episodes') def SonarrFormatAudioCodec(audioCodec): diff --git a/bazarr/queueconfig.py b/bazarr/queueconfig.py index df81d0c2d..ad33e3218 100644 --- a/bazarr/queueconfig.py +++ b/bazarr/queueconfig.py @@ -10,7 +10,7 @@ class Notify: def __init__(self): self.queue = deque(maxlen=10) - def write(self, msg, type='info', duration='temporary', button='null', queue='main'): + def write(self, msg, type='info', duration='temporary', button='null', queue='main', item=0, length=0): """ :param msg: The message to display. :type msg: str @@ -19,12 +19,16 @@ class Notify: :param duration: The duration of the notification that can be: temporary, permanent :type duration: str :param button: The kind of button desired that can be: null, refresh, restart - :type duration: str + :type button: str :param queue: The name of the notification queue to use. Default is 'main' :type duration: str + :param item: The number of the item for progress bar + :type item: int + :param length: The length of the group of item for progress bar + :type length: int """ - self.queue.append(json.dumps([msg, type, duration, button, queue])) + self.queue.append(json.dumps([msg, type, duration, button, queue, item, length])) def read(self): """ diff --git a/views/menu.tpl b/views/menu.tpl index 4dfdc9f1b..84dc6876b 100644 --- a/views/menu.tpl +++ b/views/menu.tpl @@ -250,6 +250,14 @@ var duration = data[2]; var button = data[3]; var queue = data[4]; + var item = data[5]; + var length = data[6]; + + if (length === 0) { + var message = msg; + } else { + var message = msg + '