mirror of
https://github.com/morpheus65535/bazarr.git
synced 2025-01-07 15:27:38 +08:00
Auto reload after restart
This commit is contained in:
parent
56226f941d
commit
1cccd810ae
3 changed files with 24 additions and 20 deletions
23
bazarr.py
23
bazarr.py
|
@ -30,20 +30,17 @@ def start_bazarr():
|
|||
script = [sys.executable, os.path.normcase(os.path.join(os.path.dirname(__file__), 'bazarr/main.py'))] + globals()['arguments']
|
||||
|
||||
pidfile = os.path.normcase(os.path.join(os.path.dirname(__file__), 'bazarr.pid'))
|
||||
if os.path.exists(pidfile):
|
||||
logging.error("Bazarr already running, please stop it first.")
|
||||
ep = sp.Popen(script, stdout=sp.PIPE, stderr=sp.STDOUT)
|
||||
try:
|
||||
file = open(pidfile,'w')
|
||||
except:
|
||||
logging.error("Error trying to write pid file.")
|
||||
else:
|
||||
ep = sp.Popen(script, stdout=sp.PIPE, stderr=sp.STDOUT)
|
||||
try:
|
||||
file = open(pidfile,'w')
|
||||
except:
|
||||
logging.error("Error trying to write pid file.")
|
||||
else:
|
||||
file.write(str(ep.pid))
|
||||
file.close()
|
||||
logging.info("Bazarr starting with process id: " + str(ep.pid) + "...")
|
||||
for line in iter(ep.stdout.readline, ''):
|
||||
sys.stdout.write(line)
|
||||
file.write(str(ep.pid))
|
||||
file.close()
|
||||
logging.info("Bazarr starting with process id: " + str(ep.pid) + "...")
|
||||
for line in iter(ep.stdout.readline, ''):
|
||||
sys.stdout.write(line)
|
||||
|
||||
|
||||
def shutdown_bazarr(restarting):
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
bazarr_version = '0.6.6'
|
||||
bazarr_version = '0.6.7'
|
||||
|
||||
import gc
|
||||
gc.enable()
|
||||
|
|
|
@ -208,7 +208,7 @@
|
|||
window.location = '{{base_url}}execute/' + $(this).data("taskid");
|
||||
})
|
||||
|
||||
$('a:not(.tabs), button:not(.cancel, #download_log)').click(function(){
|
||||
$('a:not(.tabs), button:not(.cancel, #download_log), #restart').click(function(){
|
||||
$('#loader').addClass('active');
|
||||
})
|
||||
|
||||
|
@ -217,7 +217,7 @@
|
|||
url: "{{base_url}}shutdown",
|
||||
async: false
|
||||
})
|
||||
.fail(function(){
|
||||
.always(function(){
|
||||
document.open();
|
||||
document.write('Bazarr has shutdown.');
|
||||
document.close();
|
||||
|
@ -227,12 +227,19 @@
|
|||
$('#restart').click(function(){
|
||||
$.ajax({
|
||||
url: "{{base_url}}restart",
|
||||
async: false
|
||||
async: true
|
||||
})
|
||||
.done(function(){
|
||||
document.open();
|
||||
document.write('Bazarr is restarting. Please reload page manually until it come back (should be less than 30 seconds).');
|
||||
document.close();
|
||||
setTimeout(function(){ setInterval(ping, 2000); },8000);
|
||||
});
|
||||
})
|
||||
|
||||
function ping() {
|
||||
$.ajax({
|
||||
url: window.location.href,
|
||||
success: function(result) {
|
||||
window.location.reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
Loading…
Reference in a new issue