diff options
author | Louis Vézina <[email protected]> | 2018-10-16 21:15:42 -0400 |
---|---|---|
committer | Louis Vézina <[email protected]> | 2018-10-16 21:15:42 -0400 |
commit | e124e1c3fd90052b0f2a069ca5f776418b4ac68d (patch) | |
tree | 2ede4032349c6a81b068525ab2cbeef98a101601 | |
parent | 7186fc8968cc3b47a1a810e346f81acb0a46b851 (diff) | |
download | bazarr-e124e1c3fd90052b0f2a069ca5f776418b4ac68d.tar.gz bazarr-e124e1c3fd90052b0f2a069ca5f776418b4ac68d.zip |
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.
-rw-r--r-- | bazarr.py | 16 | ||||
-rw-r--r-- | bazarr/main.py | 4 | ||||
-rw-r--r-- | views/menu.tpl | 6 | ||||
-rw-r--r-- | views/system.tpl | 6 |
4 files changed, 23 insertions, 9 deletions
@@ -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) diff --git a/bazarr/main.py b/bazarr/main.py index e6be41237..178bf300e 100644 --- a/bazarr/main.py +++ b/bazarr/main.py @@ -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: diff --git a/views/menu.tpl b/views/menu.tpl index 15a9f27b1..1cabb40be 100644 --- a/views/menu.tpl +++ b/views/menu.tpl @@ -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}}'; } }); } diff --git a/views/system.tpl b/views/system.tpl index 9cd3163de..7022ee5c5 100644 --- a/views/system.tpl +++ b/views/system.tpl @@ -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}}';
}
});
}
|