mirror of
https://github.com/morpheus65535/bazarr.git
synced 2025-01-23 15:17:40 +08:00
Add link to restart and manage KeyboardInterrupt
This commit is contained in:
parent
bf02d07759
commit
9c28c30ec8
3 changed files with 34 additions and 7 deletions
|
@ -29,10 +29,13 @@ dir_name = os.path.dirname(__file__)
|
||||||
def start_bazarr():
|
def start_bazarr():
|
||||||
script = [sys.executable, os.path.normcase(os.path.join(globals()['dir_name'], 'bazarr/main.py'))] + globals()['arguments']
|
script = [sys.executable, os.path.normcase(os.path.join(globals()['dir_name'], 'bazarr/main.py'))] + globals()['arguments']
|
||||||
|
|
||||||
ep = sp.Popen(script, stdout=sp.PIPE, stderr=sp.STDOUT)
|
ep = sp.Popen(script, stdout=sp.PIPE, stderr=sp.STDOUT, stdin=sp.PIPE)
|
||||||
logging.info("Bazarr starting...")
|
logging.info("Bazarr starting...")
|
||||||
for line in iter(ep.stdout.readline, ''):
|
try:
|
||||||
sys.stdout.write(line)
|
for line in iter(ep.stdout.readline, ''):
|
||||||
|
sys.stdout.write(line)
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -1693,4 +1693,8 @@ warnings.simplefilter("ignore", DeprecationWarning)
|
||||||
|
|
||||||
server = CherryPyWSGIServer((str(ip), int(port)), app)
|
server = CherryPyWSGIServer((str(ip), int(port)), app)
|
||||||
logging.info('Bazarr is started and waiting for request on http://' + str(ip) + ':' + str(port) + str(base_url))
|
logging.info('Bazarr is started and waiting for request on http://' + str(ip) + ':' + str(port) + str(base_url))
|
||||||
server.start()
|
try:
|
||||||
|
print('Bazarr is started and waiting for request on http://' + str(ip) + ':' + str(port) + str(base_url))
|
||||||
|
server.start()
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
shutdown()
|
||||||
|
|
|
@ -117,11 +117,11 @@
|
||||||
% c.close()
|
% c.close()
|
||||||
|
|
||||||
% if restart_required[1] == '1' and restart_required[0] == '1':
|
% if restart_required[1] == '1' and restart_required[0] == '1':
|
||||||
<div class='ui center aligned grid'><div class='fifteen wide column'><div class="ui red message">Bazarr need to be restarted to apply last update and changes to general settings.</div></div></div>
|
<div class='ui center aligned grid'><div class='fifteen wide column'><div class="ui red message">Bazarr need to be restarted to apply last update and changes to general settings. Click <a href=# id="restart_link">here</a> to restart.</div></div></div>
|
||||||
% elif restart_required[1] == '1':
|
% elif restart_required[1] == '1':
|
||||||
<div class='ui center aligned grid'><div class='fifteen wide column'><div class="ui red message">Bazarr need to be restarted to apply last update.</div></div></div>
|
<div class='ui center aligned grid'><div class='fifteen wide column'><div class="ui red message">Bazarr need to be restarted to apply last update. Click <a href=# id="restart_link">here</a> to restart.</div></div></div>
|
||||||
% elif restart_required[0] == '1':
|
% elif restart_required[0] == '1':
|
||||||
<div class='ui center aligned grid'><div class='fifteen wide column'><div class="ui red message">Bazarr need to be restarted to apply changes to general settings.</div></div></div>
|
<div class='ui center aligned grid'><div class='fifteen wide column'><div class="ui red message">Bazarr need to be restarted to apply changes to general settings. Click <a href=# id="restart_link">here</a> to restart.</div></div></div>
|
||||||
% end
|
% end
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
@ -167,4 +167,24 @@
|
||||||
$('.menu').css('background', '#272727');
|
$('.menu').css('background', '#272727');
|
||||||
$('#divmenu').css('background', '#272727');
|
$('#divmenu').css('background', '#272727');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$('#restart_link').click(function(){
|
||||||
|
$('#loader_text').text("Bazarr is restarting, please wait...");
|
||||||
|
$.ajax({
|
||||||
|
url: "{{base_url}}restart",
|
||||||
|
async: true
|
||||||
|
})
|
||||||
|
.done(function(){
|
||||||
|
setTimeout(function(){ setInterval(ping, 2000); },8000);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
function ping() {
|
||||||
|
$.ajax({
|
||||||
|
url: '{{base_url}}',
|
||||||
|
success: function(result) {
|
||||||
|
window.location.reload();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
</script>
|
</script>
|
Loading…
Reference in a new issue