Skip to content

Commit

Permalink
add a discoveryDump function to help troubleshooting
Browse files Browse the repository at this point in the history
  • Loading branch information
jumpmanjay committed Aug 25, 2016
1 parent 8bb9258 commit 1988196
Showing 1 changed file with 71 additions and 1 deletion.
72 changes: 71 additions & 1 deletion Contents/Services/Shared Code/PyHDHR.pys
Original file line number Diff line number Diff line change
Expand Up @@ -830,4 +830,74 @@ class PyHDHR:
print "PyHDHR.discover"
print(type(e))
print(e)
return False
return False

def discoveryDump(self,filename):
f = open(filename,'w')
f.write("Full Discovery\n")
try:
f.write("\nDiscover: "+URL_DISCOVER+"\n")
response = urllib.urlopen(URL_DISCOVER)
data = json.loads(response.read())
f.write("\nRAW:\n"+str(data)+"\n\nFormatted:\n")
for item in data:
for key in item:
try:
f.write(str(key)+" => "+str(item[key])+"\n")
except Exception as e:
f.write("[error decoding]"+"\n")

if 'StorageID' in item and 'StorageURL' in item and 'DiscoverURL' in item:
#DVR
f.write("\nDiscover DVR: "+item['DiscoverURL']+"\n")
response1 = urllib.urlopen(item['DiscoverURL'])
data1 = json.loads(response1.read())
f.write("\nRAW:\n"+str(data1)+"\n\nFormatted:\n")
for key1 in data1:
try:
f.write(str(key1)+" => "+str(data1[key1])+"\n")
except Exception as e:
f.write("[error decoding]"+"\n")

f.write("\nDiscover DVR Storage: "+item['StorageURL']+"\n")
response1 = urllib.urlopen(item['StorageURL'])
data1 = json.loads(response1.read())
f.write("\nRAW:\n"+str(data1)+"\n\nFormatted:\n")
for item1 in data1:
for key1 in item1:
try:
f.write(str(key1)+" => "+str(item1[key1])+"\n")
except Exception as e:
f.write("[error decoding]"+"\n")
f.write("\n")

elif 'DeviceID' in item and 'LineupURL' in item and 'DiscoverURL' in item:
#Tuner
f.write("\nDiscover Tuner: "+item['DiscoverURL']+"\n")
response1 = urllib.urlopen(item['DiscoverURL'])
data1 = json.loads(response1.read())
f.write("\nRAW:\n"+str(data1)+"\n\nFormatted:\n")
for key1 in data1:
try:
f.write(str(key1)+" => "+str(data1[key1])+"\n")
except Exception as e:
f.write("[error decoding]"+"\n")

f.write("\nDiscover Tuner Lineup: "+item['LineupURL']+"\n")
response1 = urllib.urlopen(item['LineupURL'])
data1 = json.loads(response1.read())
f.write("\nRAW:\n"+str(data1)+"\n\nFormatted:\n")
for item1 in data1:
for key1 in item1:
try:
f.write(str(key1)+" => "+str(item1[key1])+"\n")
except Exception as e:
f.write("[error decoding]"+"\n")
f.write("\n")
else:
print "ERROR: could not determine device type - " + str(item)
except Exception as e:
print "PyHDHR.discover"
print(type(e))
print(e)

0 comments on commit 1988196

Please sign in to comment.