Skip to content

Commit

Permalink
potential bugfix for tuner mismatch when viewing live tv
Browse files Browse the repository at this point in the history
  • Loading branch information
jumpmanjay committed Sep 8, 2016
1 parent c0397d6 commit 3d8255d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
7 changes: 2 additions & 5 deletions Contents/Code/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,12 +259,9 @@ def ShowTunedTV(guideno,include_container=False):
if not pyhdhr:
pyhdhr = PyHDHR()

liveurl = pyhdhr.getLiveTVURL(guideno)
if not liveurl:
return ObjectContainer(header="Empty", message="Could not fetch url")

chaninfo = pyhdhr.getChannelInfo(guideno)
chaninfo = pyhdhr.getLiveTVChannelInfo(guideno)
if chaninfo:
liveurl = chaninfo.getURL()
cont = 'mpegts'
vcodec = 'mpeg2video'
acodec = 'ac3'
Expand Down
10 changes: 8 additions & 2 deletions Contents/Services/Shared Code/PyHDHR.pys
Original file line number Diff line number Diff line change
Expand Up @@ -786,15 +786,21 @@ class PyHDHR:
progs = self.ChannelInfos[guideno].getProgramInfos()
if len(progs) > 0:
return progs[0]

def getLiveTVURL(self,guideno):
chaninfo = self.getLiveTVChannelInfo(guideno)
if chaninfo:
return chaninfo.getURL()
return None

def getLiveTVChannelInfo(self,guideno):
self.discover(True)
for tunerkey in self.Tuners:
chaninfos = self.Tuners[tunerkey].getChannelInfos()
if guideno in chaninfos:
try:
response = urllib2.urlopen(chaninfos[guideno].getURL()+"?duration=1",None,5)
return chaninfos[guideno].getURL()
return chaninfos[guideno]
except Exception as e:
regx = re.search('HTTP Error 503:',str(e))
if regx != None:
Expand Down

0 comments on commit 3d8255d

Please sign in to comment.