From e6b324b08fc86afce6f86f8dc391e7548ec9ff32 Mon Sep 17 00:00:00 2001 From: Halali Date: Wed, 20 Mar 2019 23:42:19 +0100 Subject: [PATCH] Some logging improvements --- bazarr/check_update.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/bazarr/check_update.py b/bazarr/check_update.py index f0b1cdd51..febdfd268 100644 --- a/bazarr/check_update.py +++ b/bazarr/check_update.py @@ -82,6 +82,9 @@ def check_updates(): version = request_json(url, timeout=20, validator=lambda x: type(x) == dict) if version is None: + notifications.write( + msg='BAZARR Could not get the latest version from GitHub.', + queue='check_update', type='warning') logging.warn( 'BAZARR Could not get the latest version from GitHub.') return @@ -91,6 +94,8 @@ def check_updates(): # See how many commits behind we are if not current_version: + notifications.write(msg='BAZARR You are running an unknown version of Bazarr. Run the updater to identify your version', + queue='check_update', type='warning') logging.warn( 'BAZARR You are running an unknown version of Bazarr. Run the updater to identify your version') return @@ -106,6 +111,8 @@ def check_updates(): commits = request_json(url, timeout=20, whitelist_status_code=404, validator=lambda x: type(x) == dict) if commits is None: + notifications.write(msg='BAZARR Could not get commits behind from GitHub.', + queue='check_update', type='warning') logging.warn('BAZARR Could not get commits behind from GitHub.') return @@ -113,8 +120,9 @@ def check_updates(): commits_behind = int(commits['behind_by']) logging.debug("BAZARR In total, %d commits behind", commits_behind) except KeyError: + notifications.write(msg='BAZARR Cannot compare versions. Are you running a local development version?', queue='check_update') logging.info('BAZARR Cannot compare versions. Are you running a local development version?') - commits_behind = 0 + return if commits_behind > 0: logging.info('BAZARR New version is available. You are %s commits behind' % commits_behind) @@ -130,6 +138,8 @@ def check_updates(): releases = request_json(url, timeout=20, whitelist_status_code=404, validator=lambda x: type(x) == list) if releases is None: + notifications.write(msg='BAZARR Could not get releases from GitHub.', + queue='check_update', type='warning') logging.warn('BAZARR Could not get releases from GitHub.') return else: @@ -172,6 +182,8 @@ def update(source, restart=True): output, err = run_git('pull ' + 'origin' + ' ' + settings.general.branch) if not output: + notifications.write(msg='Unable to download latest version', + queue='check_update', type='error') logging.error('BAZARR Unable to download latest version') return