def getHostsList(self, groupName): printDBG("IPTVHostsGroups.getHostsList") if groupName in self.CACHE_HOSTS: return self.CACHE_HOSTS[groupName] if self.hostListFromFolder == None: self.hostListFromFolder = GetHostsList(fromList=False, fromHostFolder=True) if self.hostListFromList == None: self.hostListFromList = GetHostsList(fromList=True, fromHostFolder=False) groupFile = self._getGroupFile(groupName) self._loadHosts(groupFile, groupName, self.hostListFromFolder, self.hostListFromFolder) hosts = [] for host in self.LOADED_HOSTS[groupName]: if IsHostEnabled(host): hosts.append(host) for host in self.PREDEFINED_HOSTS.get(groupName, []): if host not in hosts and host not in self.LOADED_DISABLED_HOSTS[ groupName] and host in self.hostListFromFolder and IsHostEnabled( host): hosts.append(host) printDBG('Group Hosts = ' + str(hosts)) self.CACHE_HOSTS[groupName] = hosts return hosts
def keyOK(self): if self["config"].instance is None: return if self.reorderingEnabled: if not self.reorderingMode: self["config"].instance.setForegroundColorSelected(gRGB(0xFF0505)) self.reorderingMode = True else: self["config"].instance.setForegroundColorSelected(gRGB(0xFFFFFF)) self.reorderingMode = False self.runSetup() return curIndex = self["config"].getCurrentIndex() currItem = self["config"].list[curIndex][1] if curIndex < len(self.listOfHostsNames): hostName = self.listOfHostsNames[curIndex] if self.hostsConfigsAvailableList[curIndex] and IsHostEnabled(hostName): addConf = False try: self.host = __import__('Plugins.Extensions.IPTVPlayer.hosts.host' + hostName, globals(), locals(), ['GetConfigList'], -1) if(len(self.host.GetConfigList()) < 1): printDBG('ConfigMenu host "%s" does not have additional configs' % hostName) else: self.session.open(ConfigHostMenu, hostName=hostName) addConf = True except Exception: printExc('ConfigMenu host "%s" does not have method GetConfigList' % hostName) if not addConf: self.hostsConfigsAvailableList[curIndex] = False self.onSelectionChanged() self.session.open(MessageBox, _("Service [%s] has no additional settings.") % hostName, type=MessageBox.TYPE_INFO, timeout=5) else: ConfigBaseWidget.keyOK(self)
def run(self): for hostName in SortHostsList(GetHostsList()): if hostName in [ 'localmedia', 'urllist' ]: # those are local hosts, nothing to do via web interface continue if not IsHostEnabled(hostName): continue # column 1 containing logo and link if available try: _temp = __import__( 'Plugins.Extensions.IPTVPlayer.hosts.host' + hostName, globals(), locals(), ['gettytul'], -1) title = _temp.gettytul() _temp = None except Exception: continue # we do NOT use broken hosts!!! logo = getHostLogo(hostName) if title[:4] == 'http' and logo == "": try: hostNameWithURLandLOGO = '<br><a href="./usehost?activeHost=%s" target="_blank"><font size="2" color="#58D3F7">%s</font></a>' % ( hostName, '.'.join( title.replace('://', '.').replace( 'www.', '').split('.')[1:-1])) except Exception: hostNameWithURLandLOGO = '<br><a href="%s" target="_blank"><font size="2" color="#58D3F7">%s</font></a>' % ( title, title) elif title[:4] == 'http' and logo != "": try: hostNameWithURLandLOGO = '<a href="./usehost?activeHost=%s">%s</a><br><a href="%s" target="_blank"><font size="2" color="#58D3F7">%s</font></a>' % ( hostName, logo, title, '.'.join( title.replace('://', '.').replace( 'www.', '').split('.')[1:-1])) except Exception as e: print(str(e)) hostNameWithURLandLOGO = '<a href="%s" target="_blank">%s</a><br><a href="%s" target="_blank"><font size="2" color="#58D3F7">%s</font></a>' % ( title, logo, title, _('visit site')) elif title[:4] != 'http' and logo != "": hostNameWithURLandLOGO = '<a href="./usehost?activeHost=%s">%s</a><br><a href="%s" target="_blank"><font size="2" color="#58D3F7">%s</font></a>' % ( hostName, logo, title, title) else: hostNameWithURLandLOGO = '<br><a>%s</a>' % (title) # Column 2 TBD #build table row hostHTML = '<td align="center">%s</td>' % hostNameWithURLandLOGO settings.activeHostsHTML[hostName] = hostHTML
def run(self): if settings.GlobalSearchQuery == '': print "End settings.GlobalSearchQuery is empty" return for hostName in SortHostsList(GetHostsList()): self.stopIfRequested() if hostName in [ 'localmedia', 'urllist' ]: # those are local hosts, nothing to do via web interface continue elif hostName in [ 'localmedia', 'urllist' ]: # those are local hosts, nothing to do via web interface continue elif hostName in [ 'seriesonline' ]: # those hosts have issues wth global search, need more investigation continue elif not IsHostEnabled(hostName): continue #print "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ---------------- %s ---------------- !!!!!!!!!!!!!!!!!!!!!!!!!" % hostName try: _temp = __import__( 'Plugins.Extensions.IPTVPlayer.hosts.host' + hostName, globals(), locals(), ['IPTVHost'], -1) except Exception: print "doGlobalSearch: Exception importing %s" % hostName continue try: self.host = _temp.IPTVHost() except Exception, e: print "doGlobalSearch: Exception initializing iptvhost for %s: %s" % ( hostName, str(e)) continue #print "settings.GlobalSearchQuery=",settings.GlobalSearchQuery, 'hostName=', hostName settings.searchingInHost = hostName time.sleep(0.2) # try: self.host.getSupportedFavoritesTypes() ret = self.host.getInitList() searchTypes = self.host.getSearchTypes() except Exception, e: print "doGlobalSearch: Exception in getInitList for %s: %s" % ( hostName, str(e)) settings.hostsWithNoSearchOption.append(hostName) continue
def run(self): usedCFG = [] #configs for hosts for hostName in SortHostsList(GetHostsList()): # column 1 containing logo and link if available try: _temp = __import__( 'Plugins.Extensions.IPTVPlayer.hosts.host' + hostName, globals(), locals(), ['gettytul'], -1) title = _temp.gettytul() except Exception: continue # we do NOT use broken hosts!!! usedCFG.append("host%s" % hostName) logo = getHostLogo(hostName) if logo == "": logo = title if title[:4] == 'http': hostNameWithURLandLOGO = '<a href="%s" target="_blank">%s</a>' % ( title, logo) else: hostNameWithURLandLOGO = '<a>%s</a>' % (logo) # Column 2 TBD # Column 3 enable/disable host in GUI if IsHostEnabled(hostName): OnOffState = formSUBMITvalue([('cmd', 'OFF:host' + hostName)], _('Disable')) else: OnOffState = formSUBMITvalue([('cmd', 'ON:host' + hostName)], _('Enable')) # Column 4 host configuration options try: _temp = __import__( 'Plugins.Extensions.IPTVPlayer.hosts.host' + hostName, globals(), locals(), ['GetConfigList'], -1) OptionsList = _temp.GetConfigList() except Exception: OptionsList = [] #build table row hostsCFG = '<tr>' hostsCFG += '<td style="width:120px">%s</td>' % hostNameWithURLandLOGO hostsCFG += '<td>%s</td>' % OnOffState if len(OptionsList) == 0: hostsCFG += '<td><a>%s</a></td>' % "" # _('Host does not have configuration options') else: hostsCFG += '<td><table border="1" style="width:100%">' for item in self.buildSettingsTable( List2=OptionsList, List1=config.plugins.iptvplayer.dict().items(), exclList=usedCFG, direction='2>1'): usedCFG.append(item[0]) #print('hostsCFG:',item[0], item[1],item[2]) if item[0] == 'fake_separator': hostsCFG += '<tr><td colspan="2" align="center"><tt>%s</tt></td></tr>\n' % ( item[1]) else: hostsCFG += '<tr><td nowrap style="width:50%%"><tt>%s</tt></td><td>%s</td></tr>\n' % ( item[1], formGET(item[2])) hostsCFG += '</table></td>' hostsCFG += '</tr>\n' settings.configsHTML[hostName] = hostsCFG #now configs for plugin OptionsList = [] ConfigMenu.fillConfigList(OptionsList, hiddenOptions=False) for item in self.buildSettingsTable( List1=config.plugins.iptvplayer.dict().items(), List2=OptionsList, exclList=usedCFG, direction='2>1'): settings.configsHTML[ item[1]] = '<tr><td><tt>%s</tt></td><td>%s</td></tr>\n' % ( item[1], formGET(item[2]))