Continue developing

This commit is contained in:
Halali 2019-03-12 21:58:09 +01:00
parent b5b212ad76
commit 8b5a04cb27
2 changed files with 26 additions and 4 deletions

View File

@ -77,7 +77,7 @@ def check_updates():
if source == 'git':
# 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
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
if not current_version:
logging.info(
logging.warn(
'BAZARR You are running an unknown version of Bazarr. Run the updater to identify your version')
return
@ -100,7 +100,7 @@ def check_updates():
logging.info('BAZARR is up to date')
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,
current_version)
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,
queue='check_update')
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:
url = 'https://api.github.com/repos/morpheus65535/bazarr/releases'
@ -237,6 +240,22 @@ def update(source, restart=True):
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):
"""
If no locking or request throttling is needed, use this

View File

@ -665,7 +665,7 @@
<div class="ui dividing header">Updates</div>
<div class="twelve wide column">
<div class="ui grid">
<div class="middle aligned row">
<div class="middle aligned row" id="div_branch">
<div class="right aligned four wide column">
<label>Branch</label>
</div>
@ -2059,9 +2059,12 @@
});
% from get_args import args
% from check_update import get_version
% if args.no_update or args.release_update:
$("#div_update").hide();
% elif get_version()[1] != 'git':
$("#div_branch").hide();
% end
% import sys
% if sys.platform.startswith('win'):