Continuing development

This commit is contained in:
Louis Vézina 2018-10-16 10:58:25 -04:00
parent 8a1dc9e275
commit 67b722cce1
4 changed files with 33 additions and 8 deletions

View File

@ -20,14 +20,13 @@ for opt, arg in opts:
dir_name = os.path.dirname(__file__)
def start_bazarr():
script = [sys.executable, os.path.normcase(os.path.join(globals()['dir_name'], 'bazarr/main.py'))] + globals()['arguments']
script = [sys.executable, "-u", os.path.normcase(os.path.join(globals()['dir_name'], 'bazarr/main.py'))] + globals()['arguments']
ep = sp.Popen(script, stdout=sp.PIPE, stderr=sp.STDOUT, stdin=sp.PIPE)
print "Bazarr starting..."
try:
for line in iter(ep.stdout.readline, ''):
sys.stdout.write(line)
sys.stdout.flush()
except KeyboardInterrupt:
pass

View File

@ -67,7 +67,7 @@ if get_proxy_settings()[0] != 'None':
os.environ['HTTPS_PROXY'] = str(proxy)
os.environ['NO_PROXY'] = str(get_proxy_settings()[5])
from bottle import route, run, template, static_file, request, redirect, response, HTTPError, app
from bottle import route, run, template, static_file, request, redirect, response, HTTPError, app, hook
import bottle
bottle.TEMPLATE_PATH.insert(0, os.path.join(os.path.dirname(__file__), '../views/'))
bottle.debug(True)
@ -166,6 +166,11 @@ def post_get(name, default=''):
return request.POST.get(name, default).strip()
@hook('before_request')
def enable_cors():
response.headers['Access-Control-Allow-Origin'] = '*'
@route(base_url + 'login')
def login_form():
msg = bottle.request.query.get('msg', '')
@ -1695,7 +1700,6 @@ server = CherryPyWSGIServer((str(ip), int(port)), app)
try:
logging.info('Bazarr is started and waiting for request on http://' + str(ip) + ':' + str(port) + str(base_url))
print 'Bazarr is started and waiting for request on http://' + str(ip) + ':' + str(port) + str(base_url)
sys.stdout.flush()
server.start()
except KeyboardInterrupt:
shutdown()

View File

@ -179,11 +179,22 @@
});
})
% from get_settings import get_general_settings
% ip = get_general_settings()[0]
% port = get_general_settings()[1]
% base_url = get_general_settings()[2] + "/"
if ("{{ip}}" == "0.0.0.0") {
public_ip = window.location.hostname;
} else {
public_ip = "{{ip}}";
}
function ping() {
$.ajax({
url: '{{base_url}}',
url: 'http://' + public_ip + ':{{port}}{{base_url}}',
success: function(result) {
window.location.reload();
window.location.href= 'http://' + public_ip + ':{{port}}{{base_url}}';
}
});
}

View File

@ -235,11 +235,22 @@
});
})
% from get_settings import get_general_settings
% ip = get_general_settings()[0]
% port = get_general_settings()[1]
% base_url = get_general_settings()[2] + "/"
if ("{{ip}}" == "0.0.0.0") {
public_ip = window.location.hostname;
} else {
public_ip = "{{ip}}";
}
function ping() {
$.ajax({
url: '{{base_url}}',
url: 'http://' + public_ip + ':{{port}}{{base_url}}',
success: function(result) {
window.location.reload();
window.location.href= 'http://' + public_ip + ':{{port}}{{base_url}}';
}
});
}