From 03e98fdb95c32a14419fc5e0f954efcc4bfc1bf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20V=C3=A9zina?= <5130500+morpheus65535@users.noreply.github.com> Date: Thu, 21 Nov 2019 21:30:06 -0500 Subject: [PATCH 1/4] Fix for restart after update from source on github. --- bazarr/check_update.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/bazarr/check_update.py b/bazarr/check_update.py index aa8f8c624..283996304 100644 --- a/bazarr/check_update.py +++ b/bazarr/check_update.py @@ -4,6 +4,7 @@ import logging import json import requests import tarfile +import sys from get_args import args from config import settings @@ -294,10 +295,14 @@ def request_json(url, **kwargs): def updated(restart=True): if settings.general.getboolean('update_restart') and restart: try: - from main import restart - restart() - except: - logging.info('BAZARR Restart failed, please restart Bazarr manualy') + database.close() + restart_file = open(os.path.join(args.config_dir, "bazarr.restart"), "w") + logging.info('Bazarr is being restarted...') + restart_file.write('') + restart_file.close() + sys.exit(0) + except Exception as e: + logging.info('BAZARR Restart failed, please restart Bazarr manually') updated(restart=False) else: database.execute("UPDATE system SET updated='1'") From 626f5ea41482be37ab5afe862d9ef05cc287ce53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20V=C3=A9zina?= <5130500+morpheus65535@users.noreply.github.com> Date: Thu, 21 Nov 2019 22:23:20 -0500 Subject: [PATCH 2/4] Revert "Fix for restart after update from source on github." This reverts commit 03e98fdb --- bazarr/check_update.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/bazarr/check_update.py b/bazarr/check_update.py index 283996304..aa8f8c624 100644 --- a/bazarr/check_update.py +++ b/bazarr/check_update.py @@ -4,7 +4,6 @@ import logging import json import requests import tarfile -import sys from get_args import args from config import settings @@ -295,14 +294,10 @@ def request_json(url, **kwargs): def updated(restart=True): if settings.general.getboolean('update_restart') and restart: try: - database.close() - restart_file = open(os.path.join(args.config_dir, "bazarr.restart"), "w") - logging.info('Bazarr is being restarted...') - restart_file.write('') - restart_file.close() - sys.exit(0) - except Exception as e: - logging.info('BAZARR Restart failed, please restart Bazarr manually') + from main import restart + restart() + except: + logging.info('BAZARR Restart failed, please restart Bazarr manualy') updated(restart=False) else: database.execute("UPDATE system SET updated='1'") From a3484d2c1662d0183953db8f84f00314a49ab7ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20V=C3=A9zina?= <5130500+morpheus65535@users.noreply.github.com> Date: Thu, 21 Nov 2019 23:23:02 -0500 Subject: [PATCH 3/4] Fix for restart after update from source on github. --- bazarr/check_update.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bazarr/check_update.py b/bazarr/check_update.py index aa8f8c624..d9dd3faa9 100644 --- a/bazarr/check_update.py +++ b/bazarr/check_update.py @@ -294,10 +294,11 @@ def request_json(url, **kwargs): def updated(restart=True): if settings.general.getboolean('update_restart') and restart: try: - from main import restart - restart() - except: - logging.info('BAZARR Restart failed, please restart Bazarr manualy') + requests.get('http://127.0.0.1:' + settings.general.port + settings.general.base_url + 'restart') + except requests.ConnectionError: + pass + except (requests.ConnectTimeout, requests.HTTPError, requests.ReadTimeout, requests.Timeout): + logging.info('BAZARR Restart failed, please restart Bazarr manually') updated(restart=False) else: database.execute("UPDATE system SET updated='1'") From 19675820204dae14b52f1726a2ca315e9e592711 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20V=C3=A9zina?= <5130500+morpheus65535@users.noreply.github.com> Date: Thu, 21 Nov 2019 23:33:07 -0500 Subject: [PATCH 4/4] Fix for environment variable containing unicode string. --- bazarr/init.py | 6 +++--- bazarr/main.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bazarr/init.py b/bazarr/init.py index 0b8cd0013..51bc67df0 100644 --- a/bazarr/init.py +++ b/bazarr/init.py @@ -20,11 +20,11 @@ os.environ["SZ_USER_AGENT"] = "Bazarr/1" # set anti-captcha provider and key if settings.general.anti_captcha_provider == 'anti-captcha' and settings.anticaptcha.anti_captcha_key != "": os.environ["ANTICAPTCHA_CLASS"] = 'AntiCaptchaProxyLess' - os.environ["ANTICAPTCHA_ACCOUNT_KEY"] = settings.anticaptcha.anti_captcha_key + os.environ["ANTICAPTCHA_ACCOUNT_KEY"] = str(settings.anticaptcha.anti_captcha_key) elif settings.general.anti_captcha_provider == 'death-by-captcha' and settings.deathbycaptcha.username != "" and settings.deathbycaptcha.password != "": os.environ["ANTICAPTCHA_CLASS"] = 'DeathByCaptchaProxyLess' - os.environ["ANTICAPTCHA_ACCOUNT_KEY"] = ':'.join( - {settings.deathbycaptcha.username, settings.deathbycaptcha.password}) + os.environ["ANTICAPTCHA_ACCOUNT_KEY"] = str(':'.join( + {settings.deathbycaptcha.username, settings.deathbycaptcha.password})) else: os.environ["ANTICAPTCHA_CLASS"] = '' diff --git a/bazarr/main.py b/bazarr/main.py index 8b9f2ed1c..37012f62b 100644 --- a/bazarr/main.py +++ b/bazarr/main.py @@ -1334,11 +1334,11 @@ def save_settings(): # set anti-captcha provider and key if settings.general.anti_captcha_provider == 'anti-captcha': os.environ["ANTICAPTCHA_CLASS"] = 'AntiCaptchaProxyLess' - os.environ["ANTICAPTCHA_ACCOUNT_KEY"] = settings.anticaptcha.anti_captcha_key + os.environ["ANTICAPTCHA_ACCOUNT_KEY"] = str(settings.anticaptcha.anti_captcha_key) elif settings.general.anti_captcha_provider == 'death-by-captcha': os.environ["ANTICAPTCHA_CLASS"] = 'DeathByCaptchaProxyLess' - os.environ["ANTICAPTCHA_ACCOUNT_KEY"] = ':'.join( - {settings.deathbycaptcha.username, settings.deathbycaptcha.password}) + os.environ["ANTICAPTCHA_ACCOUNT_KEY"] = str(':'.join( + {settings.deathbycaptcha.username, settings.deathbycaptcha.password})) else: os.environ["ANTICAPTCHA_CLASS"] = ''