From 8b5a04cb279be45a53f86a1bb7ed7f875b9e55a1 Mon Sep 17 00:00:00 2001 From: Halali Date: Tue, 12 Mar 2019 21:58:09 +0100 Subject: [PATCH] Continue developing --- bazarr/check_update.py | 25 ++++++++++++++++++++++--- views/settings.tpl | 5 ++++- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/bazarr/check_update.py b/bazarr/check_update.py index d0628faa2..22b743827 100644 --- a/bazarr/check_update.py +++ b/bazarr/check_update.py @@ -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 diff --git a/views/settings.tpl b/views/settings.tpl index be2853768..3df9f406f 100644 --- a/views/settings.tpl +++ b/views/settings.tpl @@ -665,7 +665,7 @@
Updates
-
+
@@ -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'):