Skip to content

Commit

Permalink
Update __init__.py
Browse files Browse the repository at this point in the history
  • Loading branch information
zynine- authored Apr 29, 2018
1 parent 85164f9 commit 30b7f83
Showing 1 changed file with 25 additions and 23 deletions.
48 changes: 25 additions & 23 deletions Contents/Code/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -38,6 +38,7 @@
PREFS_VCODEC = 'videocodec'
PREFS_ACODEC = 'audiocodec'
PREFS_ICONDIR = 'icon_directory'
PREFS_AUTODISCOVER = 'autodiscover'

#XMLTV Modes
XMLTV_MODE_RESTAPI = 'restapi'
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 30b7f83

Please sign in to comment.