mirror of https://github.com/morpheus65535/bazarr
Notification progress bar.
This commit is contained in:
parent
5c84343527
commit
20e10d6720
|
@ -50,8 +50,9 @@ def sync_episodes():
|
||||||
# Close database connection
|
# Close database connection
|
||||||
c.close()
|
c.close()
|
||||||
|
|
||||||
for seriesId in seriesIdList:
|
seriesIdListLength = len(seriesIdList)
|
||||||
notifications.write(msg='Getting episodes data for this show: ' + seriesId[1], queue='get_episodes')
|
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
|
# Get episodes data for a series from Sonarr
|
||||||
url_sonarr_api_episode = url_sonarr + "/api/episode?seriesId=" + str(seriesId[0]) + "&apikey=" + apikey_sonarr
|
url_sonarr_api_episode = url_sonarr + "/api/episode?seriesId=" + str(seriesId[0]) + "&apikey=" + apikey_sonarr
|
||||||
try:
|
try:
|
||||||
|
@ -152,8 +153,6 @@ def sync_episodes():
|
||||||
list_missing_subtitles()
|
list_missing_subtitles()
|
||||||
logging.debug('BAZARR All missing subtitles updated in database.')
|
logging.debug('BAZARR All missing subtitles updated in database.')
|
||||||
|
|
||||||
notifications.write(msg='Episodes sync from Sonarr ended.', queue='get_episodes')
|
|
||||||
|
|
||||||
|
|
||||||
def SonarrFormatAudioCodec(audioCodec):
|
def SonarrFormatAudioCodec(audioCodec):
|
||||||
if audioCodec == 'AC-3': return 'AC3'
|
if audioCodec == 'AC-3': return 'AC3'
|
||||||
|
|
|
@ -10,7 +10,7 @@ class Notify:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.queue = deque(maxlen=10)
|
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.
|
:param msg: The message to display.
|
||||||
:type msg: str
|
:type msg: str
|
||||||
|
@ -19,12 +19,16 @@ class Notify:
|
||||||
:param duration: The duration of the notification that can be: temporary, permanent
|
:param duration: The duration of the notification that can be: temporary, permanent
|
||||||
:type duration: str
|
:type duration: str
|
||||||
:param button: The kind of button desired that can be: null, refresh, restart
|
: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'
|
:param queue: The name of the notification queue to use. Default is 'main'
|
||||||
:type duration: str
|
: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):
|
def read(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -250,6 +250,14 @@
|
||||||
var duration = data[2];
|
var duration = data[2];
|
||||||
var button = data[3];
|
var button = data[3];
|
||||||
var queue = data[4];
|
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') {
|
if (duration === 'temporary') {
|
||||||
timeout = 3000;
|
timeout = 3000;
|
||||||
|
@ -269,7 +277,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
new Noty({
|
new Noty({
|
||||||
text: msg,
|
text: message,
|
||||||
progressBar: false,
|
progressBar: false,
|
||||||
animation: {
|
animation: {
|
||||||
open: null,
|
open: null,
|
||||||
|
@ -284,6 +292,13 @@
|
||||||
buttons: button,
|
buttons: button,
|
||||||
force: true
|
force: true
|
||||||
}).show();
|
}).show();
|
||||||
|
|
||||||
|
$('.notification_progress').progress({
|
||||||
|
duration : 0,
|
||||||
|
autoSuccess: false,
|
||||||
|
value : item,
|
||||||
|
total : length
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
complete: function (data) {
|
complete: function (data) {
|
||||||
|
|
Loading…
Reference in New Issue