mirror of
https://github.com/morpheus65535/bazarr
synced 2025-03-13 07:32:52 +00:00
Continue developing
This commit is contained in:
parent
b5b212ad76
commit
8b5a04cb27
2 changed files with 26 additions and 4 deletions
|
@ -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
|
||||||
|
|
|
@ -665,7 +665,7 @@
|
||||||
<div class="ui dividing header">Updates</div>
|
<div class="ui dividing header">Updates</div>
|
||||||
<div class="twelve wide column">
|
<div class="twelve wide column">
|
||||||
<div class="ui grid">
|
<div class="ui grid">
|
||||||
<div class="middle aligned row">
|
<div class="middle aligned row" id="div_branch">
|
||||||
<div class="right aligned four wide column">
|
<div class="right aligned four wide column">
|
||||||
<label>Branch</label>
|
<label>Branch</label>
|
||||||
</div>
|
</div>
|
||||||
|
@ -2059,9 +2059,12 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
% from get_args import args
|
% from get_args import args
|
||||||
|
% from check_update import get_version
|
||||||
|
|
||||||
% if args.no_update or args.release_update:
|
% if args.no_update or args.release_update:
|
||||||
$("#div_update").hide();
|
$("#div_update").hide();
|
||||||
|
% elif get_version()[1] != 'git':
|
||||||
|
$("#div_branch").hide();
|
||||||
% end
|
% end
|
||||||
% import sys
|
% import sys
|
||||||
% if sys.platform.startswith('win'):
|
% if sys.platform.startswith('win'):
|
||||||
|
|
Loading…
Add table
Reference in a new issue