@@ -87,24 +87,25 @@ def get_icon_path(icon_name):
8787 return os .path .join (addon_path , 'resources' , 'img' , icon_name + ".png" )
8888
8989def create_cList ():
90- if not os .path .isfile (tvhList ):
91- channels_url = 'http://' + tvh_url + ':' + tvh_port + '/api/channel/grid?all=1&limit=999999999&sort=name'
92- response = requests .get (channels_url )
93- try :
94- logging .info ('Accessing Tvheadend channel list from: %s' , channels_url )
95- channels = response .json ()
96- with open (tvhList ,"w" ) as f :
97- json .dump (channels ,f )
98- except urllib2 .HTTPError as e :
99- logging .exception ('Exception: tvhClist - %s' , e .strerror )
100- pass
101- with open (tvhList ) as tvhData :
102- tvhClist = []
103- tvhDict = json .load (tvhData )
104- for ch in tvhDict ['entries' ]:
105- channelEnabled = ch ['enabled' ]
106- if channelEnabled == True :
107- tvhClist .append (ch ['number' ])
90+ tvhClist = []
91+ if tvhoff == 'true' :
92+ if not os .path .isfile (tvhList ):
93+ channels_url = 'http://' + tvh_url + ':' + tvh_port + '/api/channel/grid?all=1&limit=999999999&sort=name'
94+ response = requests .get (channels_url )
95+ try :
96+ logging .info ('Accessing Tvheadend channel list from: %s' , channels_url )
97+ channels = response .json ()
98+ with open (tvhList ,"w" ) as f :
99+ json .dump (channels ,f )
100+ except urllib2 .HTTPError as e :
101+ logging .exception ('Exception: tvhClist - %s' , e .strerror )
102+ pass
103+ with open (tvhList ) as tvhData :
104+ tvhDict = json .load (tvhData )
105+ for ch in tvhDict ['entries' ]:
106+ channelEnabled = ch ['enabled' ]
107+ if channelEnabled == True :
108+ tvhClist .append (ch ['number' ])
108109 lineupcode = xbmcaddon .Addon ().getSetting ('lineupcode' )
109110 url = 'http://tvlistings.gracenote.com/api/grid?lineupId=×pan=3&headendId=' + lineupcode + '&country=' + country + '&device=-&postalCode=' + zipcode + '&time=' + str (gridtime ) + '&pref=-&userId=-'
110111 content = urllib2 .urlopen (url ).read ()
0 commit comments