Ejemplo n.º 1
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
Ejemplo n.º 2
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]))