mirror of
https://github.com/morpheus65535/bazarr.git
synced 2025-04-24 06:37:16 -04:00
Fix to create daemon stop and restart file in config_dir. Add a fix for automatic reloading after restart when using a reverse proxy with SSL.
This commit is contained in:
parent
7186fc8968
commit
e124e1c3fd
4 changed files with 23 additions and 9 deletions
16
bazarr.py
16
bazarr.py
|
@ -5,6 +5,9 @@ import os
|
|||
import sys
|
||||
import getopt
|
||||
|
||||
config_dir = os.path.join(os.path.dirname(__file__), 'data/')
|
||||
no_update = False
|
||||
|
||||
arguments = []
|
||||
try:
|
||||
opts, args = getopt.getopt(sys.argv[1:],"h:",["no-update", "config="])
|
||||
|
@ -13,7 +16,14 @@ except getopt.GetoptError:
|
|||
sys.exit(2)
|
||||
for opt, arg in opts:
|
||||
arguments.append(opt)
|
||||
if arg != '':
|
||||
if opt == '-h':
|
||||
print 'bazarr.py -h --no-update --config <config_directory>'
|
||||
sys.exit()
|
||||
elif opt in ("--no-update"):
|
||||
no_update = True
|
||||
elif opt in ("--config"):
|
||||
config_dir = arg
|
||||
elif arg != '':
|
||||
arguments.append(arg)
|
||||
|
||||
|
||||
|
@ -32,8 +42,8 @@ def start_bazarr():
|
|||
|
||||
|
||||
if __name__ == '__main__':
|
||||
restartfile = os.path.normcase(os.path.join(globals()['dir_name'], 'bazarr.restart'))
|
||||
stopfile = os.path.normcase(os.path.join(globals()['dir_name'], 'bazarr.stop'))
|
||||
restartfile = os.path.normcase(os.path.join(config_dir, 'bazarr.restart'))
|
||||
stopfile = os.path.normcase(os.path.join(config_dir, 'bazarr.stop'))
|
||||
|
||||
try:
|
||||
os.remove(restartfile)
|
||||
|
|
|
@ -199,7 +199,7 @@ def redirect_root():
|
|||
@route(base_url + 'shutdown')
|
||||
def shutdown():
|
||||
try:
|
||||
stop_file = open(os.path.join(os.path.dirname(os.path.dirname(__file__)), "bazarr.stop"), "w")
|
||||
stop_file = open(os.path.join(config_dir, "bazarr.stop"), "w")
|
||||
except Exception as e:
|
||||
logging.error('Cannot create bazarr.stop file.')
|
||||
else:
|
||||
|
@ -215,7 +215,7 @@ def restart():
|
|||
logging.error('Cannot stop CherryPy.')
|
||||
else:
|
||||
try:
|
||||
restart_file = open(os.path.join(os.path.dirname(os.path.dirname(__file__)), "bazarr.restart"), "w")
|
||||
restart_file = open(os.path.join(config_dir, "bazarr.restart"), "w")
|
||||
except Exception as e:
|
||||
logging.error('Cannot create bazarr.restart file.')
|
||||
else:
|
||||
|
|
|
@ -190,11 +190,13 @@
|
|||
public_ip = "{{ip}}";
|
||||
}
|
||||
|
||||
protocol = window.location.protocol;
|
||||
|
||||
function ping() {
|
||||
$.ajax({
|
||||
url: 'http://' + public_ip + ':{{port}}{{base_url}}',
|
||||
url: protocol + '://' + public_ip + ':{{port}}{{base_url}}',
|
||||
success: function(result) {
|
||||
window.location.href= 'http://' + public_ip + ':{{port}}{{base_url}}';
|
||||
window.location.href= protocol + '://' + public_ip + ':{{port}}{{base_url}}';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -246,11 +246,13 @@
|
|||
public_ip = "{{ip}}";
|
||||
}
|
||||
|
||||
protocol = window.location.protocol;
|
||||
|
||||
function ping() {
|
||||
$.ajax({
|
||||
url: 'http://' + public_ip + ':{{port}}{{base_url}}',
|
||||
url: protocol + '://' + public_ip + ':{{port}}{{base_url}}',
|
||||
success: function(result) {
|
||||
window.location.href= 'http://' + public_ip + ':{{port}}{{base_url}}';
|
||||
window.location.href= protocol + '://' + public_ip + ':{{port}}{{base_url}}';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue