From: Andrew Ruthven Date: Mon, 1 Aug 2022 09:27:07 +0000 (+1200) Subject: Import 0.6.1 of xmltv-proc-nz X-Git-Url: http://git.etc.gen.nz/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bf71c2d9bf2a4b5e8b3a2f40c71b77f53756be8c;p=mythtv-epg-nz.git Import 0.6.1 of xmltv-proc-nz --- diff --git a/bin/xmltv-proc-nz b/bin/xmltv-proc-nz index 0af53dc..2a7321d 100644 --- a/bin/xmltv-proc-nz +++ b/bin/xmltv-proc-nz @@ -44,6 +44,10 @@ JSW = Stephen Worthington - Reverse the default for BaseProcessor.valid. Set valid=True when valid data is obtained from one URL, even if other URLs fail. - Remove JSW flag - now works by whether it finds the matching json data. - Make PlusOnes use json configuration. +0.6.1 JSW + - Make failure to access version update data a warning instead of a failure. This was causing xmltv-proc-nz to fail as epg.org.nz + is no longer working (although the site still exists). + - Remove epg.org.nz as it is no longer working. """ #TODO: Find repeats #TODO: Regex replacements for categories @@ -70,10 +74,13 @@ else: tvdb = tvdb_api.Tvdb(language='en') NAME = 'xmltv-proc-nz' -URL = 'http://nice.net.nz/xmltv-proc-nz' -VERSION = '0.6.0 JSW' -BASE_URL = 'http://epg.org.nz' -JSON_BASE_URLS = ['http://epg.org.nz', 'http://localhost/json', 'file:///etc/mythtv-epg-nz/xmltv-proc-nz/json'] +#URL = 'http://nice.net.nz/xmltv-proc-nz' +URL = 'http://www.jsw.gen.nz/mythtv/xmltv-proc-nz' +VERSION = '0.6.1 JSW' +#BASE_URL = 'http://epg.org.nz' +BASE_URL = '' +#JSON_BASE_URLS = ['http://epg.org.nz', 'http://localhost/json'] +JSON_BASE_URLS = ['http://localhost/json', 'file:///etc/mythtv-epg-nz/xmltv-proc-nz/json'] TIME_FORMAT = '%Y%m%d%H%M%S' LOG_LEVEL = logging.INFO #LOG_LEVEL = logging.WARNING @@ -834,28 +841,29 @@ def check_for_updates(): """ Check for script updates. """ - try: - data = urlopen('%s/xmltv-proc-nz/+json' % BASE_URL).read() - except IOError: - log.critical('Cannot access Internet') - sys.exit(3) - else: + if BASE_URL != '': try: - stats = json.loads(data) - except ValueError as e: - print(e) - log.critical('Version check failed') - sys.exit(4) - if stats['version'] > VERSION: - log.warning( - 'A new version (%s) is available at %s (current version %s)', - stats['version'], - URL, - VERSION - ) - if stats['critical']: - log.critical('Version update is critical, exiting') - sys.exit(5) + url = '%s/xmltv-proc-nz/+json' % BASE_URL + data = urlopen(url).read() + except IOError: + log.warning(f'Update check failed, cannot access {url}') + else: + try: + stats = json.loads(data) + except ValueError as e: + print(e) + log.critical('Version check failed') + sys.exit(4) + if stats['version'] > VERSION: + log.warning( + 'A new version (%s) is available at %s (current version %s)', + stats['version'], + URL, + VERSION + ) + if stats['critical']: + log.critical('Version update is critical, exiting') + sys.exit(5) if __name__ == '__main__': parser = OptionParser(version='%prog ' + str(VERSION))