Continuing development

pull/222/head
Louis Vézina 6 years ago
parent 8a1dc9e275
commit 67b722cce1

@ -20,14 +20,13 @@ for opt, arg in opts:
dir_name = os.path.dirname(__file__) 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, "-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) ep = sp.Popen(script, stdout=sp.PIPE, stderr=sp.STDOUT, stdin=sp.PIPE)
print "Bazarr starting..." print "Bazarr starting..."
try: try:
for line in iter(ep.stdout.readline, ''): for line in iter(ep.stdout.readline, ''):
sys.stdout.write(line) sys.stdout.write(line)
sys.stdout.flush()
except KeyboardInterrupt: except KeyboardInterrupt:
pass pass

@ -67,7 +67,7 @@ if get_proxy_settings()[0] != 'None':
os.environ['HTTPS_PROXY'] = str(proxy) os.environ['HTTPS_PROXY'] = str(proxy)
os.environ['NO_PROXY'] = str(get_proxy_settings()[5]) 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 import bottle
bottle.TEMPLATE_PATH.insert(0, os.path.join(os.path.dirname(__file__), '../views/')) bottle.TEMPLATE_PATH.insert(0, os.path.join(os.path.dirname(__file__), '../views/'))
bottle.debug(True) bottle.debug(True)
@ -166,6 +166,11 @@ def post_get(name, default=''):
return request.POST.get(name, default).strip() return request.POST.get(name, default).strip()
@hook('before_request')
def enable_cors():
response.headers['Access-Control-Allow-Origin'] = '*'
@route(base_url + 'login') @route(base_url + 'login')
def login_form(): def login_form():
msg = bottle.request.query.get('msg', '') msg = bottle.request.query.get('msg', '')
@ -1695,7 +1700,6 @@ server = CherryPyWSGIServer((str(ip), int(port)), app)
try: try:
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))
print '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() server.start()
except KeyboardInterrupt: except KeyboardInterrupt:
shutdown() shutdown()

@ -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() { function ping() {
$.ajax({ $.ajax({
url: '{{base_url}}', url: 'http://' + public_ip + ':{{port}}{{base_url}}',
success: function(result) { success: function(result) {
window.location.reload(); window.location.href= 'http://' + public_ip + ':{{port}}{{base_url}}';
} }
}); });
} }

@ -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() { function ping() {
$.ajax({ $.ajax({
url: '{{base_url}}', url: 'http://' + public_ip + ':{{port}}{{base_url}}',
success: function(result) { success: function(result) {
window.location.reload(); window.location.href= 'http://' + public_ip + ':{{port}}{{base_url}}';
} }
}); });
} }

Loading…
Cancel
Save