Exemplo n.º 1
0
 def hostsPageContent(self, MenuStatusMSG, ShowCancelButton):
     tempText = '<body bgcolor=\"#666666\" text=\"#FFFFFF\">\n'
     tempText += IncludeMENU(MenuStatusMSG, ShowCancelButton)
     tempText += '<div class="main"><table border="0" cellspacing="50px"><tbody>\n<tr>'
     columnIndex = 1
     displayHostsList = SortHostsList(GetHostsList())
     if 0 == len(GetHostsOrderList()):
         try:
             displayHostsList.sort(key=lambda t: tuple('.'.join(
                 str(t[0]).replace('://', '.').replace('www.', '').split(
                     '.')[1:-1]).lower()))
         except Exception as e:
             print("Exception during sorting displayHostsList", str(e))
     for hostName in displayHostsList:
         if hostName in settings.activeHostsHTML.keys():
             hostHTML = settings.activeHostsHTML[hostName]
             tempText += hostHTML
             #tempText += '<td><button type="button" disabled>%s</button> </td>' % _('Enter')
             columnIndex += 1
             if columnIndex > 4:
                 columnIndex = 1
                 tempText += '</tr>\n<tr>'
     tempText += '</tr>'
     tempText += '</tbody></table></div></body>\n'
     return tempText
Exemplo n.º 2
0
 def settingsPageContent(self, MenuStatusMSG):
     usedCFG = []
     tempText = '<body bgcolor=\"#666666\" text=\"#FFFFFF\">\n<div class="main">\n'
     tempText += IncludeMENU(MenuStatusMSG)
     #build hosts settings section
     hostsCFG = '<br><table width="850px" border="1"><tbody>\n'
     hostsCFG += '<tr><td align="center" colspan="3"><p><font size="5" color="#9FF781">%s</font></p></td></tr>\n' % _(
         'Hosts settings')
     for hostName in SortHostsList(GetHostsList()):
         if hostName in settings.configsHTML.keys():
             hostsCFG += settings.configsHTML[hostName]
     hostsCFG += '</tbody></table>\n'
     #build plugin global settings
     pluginCFG = '<table width="850px" border="1"><tbody>\n'
     pluginCFG += '<tr><td align="center" colspan="2"><p><font size="5" color="#9FF781">%s</font></p></td></tr>\n' % _(
         'Plugin global settings')
     from Plugins.Extensions.IPTVPlayer.components.iptvconfigmenu import ConfigMenu
     OptionsList = []
     ConfigMenu.fillConfigList(OptionsList, hiddenOptions=False)
     for item in OptionsList:
         if item[0] in settings.configsHTML.keys():
             pluginCFG += settings.configsHTML[item[0]]
     pluginCFG += '</tbody></table>\n'
     tempText += pluginCFG + '<p><br</p>\n' + hostsCFG + '</div></body>\n'
     return tempText
Exemplo n.º 3
0
	def hostsPageContent(self, MenuStatusMSG, ShowCancelButton):
		tempText = '<body bgcolor=\"#666666\" text=\"#FFFFFF\">\n'
		tempText += IncludeMENU(MenuStatusMSG, ShowCancelButton)
		tempText += '<div class="main"><table border="0" cellspacing="50px"><tbody>\n<tr>'
		columnIndex = 1
		displayHostsList = SortHostsList(GetHostsList())
		if 0 == len(GetHostsOrderList()):
			try:
				displayHostsList.sort(key=lambda t: tuple('.'.join(str(t[0]).replace('://', '.').replace('www.', '').split('.')[1:-1]).lower()))
			except Exception, e:
				print "Exception during sorting displayHostsList", str(e)
Exemplo n.º 4
0
    def __init__(self, session, listOfHostsNames):
        printDBG("ConfigHostsMenu.__init__ -------------------------------")
        self.list = []
        self.hostsConfigsAvailableList = []
        self.listOfHostsNames = []
        self.orgListOfHostsNames = SortHostsList(listOfHostsNames)
        ConfigBaseWidget.__init__(self, session)
        self.setup_title = _("Services configuration")
        self.__preparHostsConfigs(self.orgListOfHostsNames)

        self.reorderingEnabled = False
        self.reorderingMode = False
Exemplo n.º 5
0
    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
Exemplo n.º 6
0
 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
Exemplo n.º 7
0
    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]))