mirror of
https://github.com/morpheus65535/bazarr
synced 2024-12-25 01:02:19 +00:00
Notification progress bar.
This commit is contained in:
parent
5c84343527
commit
20e10d6720
3 changed files with 27 additions and 9 deletions
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
"""
|
||||
|
|
|
@ -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 + '<p><div class="ui disabled progress notification_progress" style="margin-bottom: -0.25em"><div class="bar"><div class="progress"></div></div></div>'
|
||||
}
|
||||
|
||||
if (duration === 'temporary') {
|
||||
timeout = 3000;
|
||||
|
@ -269,7 +277,7 @@
|
|||
}
|
||||
|
||||
new Noty({
|
||||
text: msg,
|
||||
text: message,
|
||||
progressBar: false,
|
||||
animation: {
|
||||
open: null,
|
||||
|
@ -284,6 +292,13 @@
|
|||
buttons: button,
|
||||
force: true
|
||||
}).show();
|
||||
|
||||
$('.notification_progress').progress({
|
||||
duration : 0,
|
||||
autoSuccess: false,
|
||||
value : item,
|
||||
total : length
|
||||
});
|
||||
}
|
||||
},
|
||||
complete: function (data) {
|
||||
|
|
Loading…
Reference in a new issue