|
|
@ -77,7 +77,7 @@ def check_updates():
|
|
|
|
|
|
|
|
|
|
|
|
if source == 'git':
|
|
|
|
if source == 'git':
|
|
|
|
# Get the latest version available from github
|
|
|
|
# Get the latest version available from github
|
|
|
|
logging.info('BAZZAR Retrieving latest version information from GitHub')
|
|
|
|
logging.debug('BAZZAR Retrieving latest version information from GitHub')
|
|
|
|
url = 'https://api.github.com/repos/morpheus65535/bazarr/commits/%s' % settings.general.branch
|
|
|
|
url = 'https://api.github.com/repos/morpheus65535/bazarr/commits/%s' % settings.general.branch
|
|
|
|
version = request_json(url, timeout=20, validator=lambda x: type(x) == dict)
|
|
|
|
version = request_json(url, timeout=20, validator=lambda x: type(x) == dict)
|
|
|
|
|
|
|
|
|
|
|
@ -91,7 +91,7 @@ def check_updates():
|
|
|
|
|
|
|
|
|
|
|
|
# See how many commits behind we are
|
|
|
|
# See how many commits behind we are
|
|
|
|
if not current_version:
|
|
|
|
if not current_version:
|
|
|
|
logging.info(
|
|
|
|
logging.warn(
|
|
|
|
'BAZARR You are running an unknown version of Bazarr. Run the updater to identify your version')
|
|
|
|
'BAZARR You are running an unknown version of Bazarr. Run the updater to identify your version')
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
@ -100,7 +100,7 @@ def check_updates():
|
|
|
|
logging.info('BAZARR is up to date')
|
|
|
|
logging.info('BAZARR is up to date')
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
logging.info('Comparing currently installed version with latest GitHub version')
|
|
|
|
logging.debug('Comparing currently installed version with latest GitHub version')
|
|
|
|
url = 'https://api.github.com/repos/morpheus65535/bazarr/compare/%s...%s' % (latest_version,
|
|
|
|
url = 'https://api.github.com/repos/morpheus65535/bazarr/compare/%s...%s' % (latest_version,
|
|
|
|
current_version)
|
|
|
|
current_version)
|
|
|
|
commits = request_json(url, timeout=20, whitelist_status_code=404, validator=lambda x: type(x) == dict)
|
|
|
|
commits = request_json(url, timeout=20, whitelist_status_code=404, validator=lambda x: type(x) == dict)
|
|
|
@ -121,6 +121,9 @@ def check_updates():
|
|
|
|
notifications.write(msg='BAZARR New version is available. You are %s commits behind' % commits_behind,
|
|
|
|
notifications.write(msg='BAZARR New version is available. You are %s commits behind' % commits_behind,
|
|
|
|
queue='check_update')
|
|
|
|
queue='check_update')
|
|
|
|
update(source, restart=True if settings.general.getboolean('update_restart') else False)
|
|
|
|
update(source, restart=True if settings.general.getboolean('update_restart') else False)
|
|
|
|
|
|
|
|
elif commits_behind is 0:
|
|
|
|
|
|
|
|
notifications.write(msg='BAZZAR is up to date', queue='check_update')
|
|
|
|
|
|
|
|
logging.info('BAZZAR is up to date')
|
|
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
url = 'https://api.github.com/repos/morpheus65535/bazarr/releases'
|
|
|
|
url = 'https://api.github.com/repos/morpheus65535/bazarr/releases'
|
|
|
@ -237,6 +240,22 @@ def update(source, restart=True):
|
|
|
|
updated(restart)
|
|
|
|
updated(restart)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def checkout_git_branch():
|
|
|
|
|
|
|
|
output, err = run_git('fetch %s' % 'origin')
|
|
|
|
|
|
|
|
output, err = run_git('checkout %s' % settings.general.branch)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if not output:
|
|
|
|
|
|
|
|
logging.error('Unable to change git branch.')
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for line in output.split('\n'):
|
|
|
|
|
|
|
|
if line.endswith(('Aborting', 'Aborting.')):
|
|
|
|
|
|
|
|
logging.error('Unable to checkout from git: ' + line)
|
|
|
|
|
|
|
|
logging.info('Output: ' + str(output))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
output, err = run_git('pull %s %s' % ('origin', settings.general.branch))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class FakeLock(object):
|
|
|
|
class FakeLock(object):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
If no locking or request throttling is needed, use this
|
|
|
|
If no locking or request throttling is needed, use this
|
|
|
|