From 85164f92257f905081e15a44468d97e215e73250 Mon Sep 17 00:00:00 2001 From: zynine Date: Sun, 29 Apr 2018 12:39:42 -0400 Subject: [PATCH 1/2] Update DefaultPrefs.json autodiscover boolean --- Contents/DefaultPrefs.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Contents/DefaultPrefs.json b/Contents/DefaultPrefs.json index e5b3300..1b14157 100644 --- a/Contents/DefaultPrefs.json +++ b/Contents/DefaultPrefs.json @@ -5,6 +5,12 @@ "label": "HDHomeRun IP", "default": "auto" }, + { + "id": "autodiscover", + "type": "bool", + "label": "Enable Auto Discover", + "default": "true" + }, { "id": "xmltv_mode", "type": "enum", From 30b7f833373b57fc653a9ab3c16967a35ba3830c Mon Sep 17 00:00:00 2001 From: zynine Date: Sun, 29 Apr 2018 12:41:16 -0400 Subject: [PATCH 2/2] Update __init__.py --- Contents/Code/__init__.py | 48 ++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/Contents/Code/__init__.py b/Contents/Code/__init__.py index 33626c8..6aea4fa 100644 --- a/Contents/Code/__init__.py +++ b/Contents/Code/__init__.py @@ -12,9 +12,9 @@ from DumbTools import DumbPrefs DEBUGMODE = True -TITLE = 'HDHR Viewer 2 (1.1.2)' +TITLE = 'HDHR Viewer 2 (1.1.3)' PREFIX = '/video/hdhrv2' -VERSION = '1.1.2' +VERSION = '1.1.3' #GRAPHICS ART = 'art-default.jpg' @@ -38,6 +38,7 @@ PREFS_VCODEC = 'videocodec' PREFS_ACODEC = 'audiocodec' PREFS_ICONDIR = 'icon_directory' +PREFS_AUTODISCOVER = 'autodiscover' #XMLTV Modes XMLTV_MODE_RESTAPI = 'restapi' @@ -1387,28 +1388,29 @@ def __init__(self): # Auto Discover devices def autoDiscover(self): cacheTime=None - try: - response = xstr(HTTP.Request(URL_HDHR_DISCOVER_DEVICES,timeout=TIMEOUT,cacheTime=cacheTime)) - JSONdevices = JSON.ObjectFromString(''.join(response.splitlines())) - - for device in JSONdevices: - StorageURL = device.get('StorageURL') - LineupURL = device.get('LineupURL') - - if LineupURL is not None: - if not xany(d['LocalIP']==device['LocalIP'] for d in self.tunerDevices): - device['autoDiscover'] = True - logInfo('Adding auto discovered tuner: '+device['LocalIP']) - self.tunerDevices.append(device) - else: - logInfo('Auto discovered tuner skipped (duplicate): '+device['LocalIP']) - - #future - if StorageURL is not None: - self.storageServers.append(device) + if Prefs[PREFS_AUTODISCOVER]: + try: + response = xstr(HTTP.Request(URL_HDHR_DISCOVER_DEVICES,timeout=TIMEOUT,cacheTime=cacheTime)) + JSONdevices = JSON.ObjectFromString(''.join(response.splitlines())) + + for device in JSONdevices: + StorageURL = device.get('StorageURL') + LineupURL = device.get('LineupURL') + + if LineupURL is not None: + if not xany(d['LocalIP']==device['LocalIP'] for d in self.tunerDevices): + device['autoDiscover'] = True + logInfo('Adding auto discovered tuner: '+device['LocalIP']) + self.tunerDevices.append(device) + else: + logInfo('Auto discovered tuner skipped (duplicate): '+device['LocalIP']) - except Exception as inst: - logError('Devices.autoDiscover(): '+strError(inst)) + #future + if StorageURL is not None: + self.storageServers.append(device) + except Exception as inst: + logError('Devices.autoDiscover(): '+strError(inst)) + # Get manual tuners listed in Settings def manualTuner(self):