def prepareMainTemplate(self):
        # here will be generated the dictionary for the main template
        ret = getCollapsedMenus()
        ret["remotegrabscreenshot"] = getRemoteGrabScreenshot()["remotegrabscreenshot"]
        ret["configsections"] = getConfigsSections()["sections"]
        ret["zapstream"] = getZapStream()["zapstream"]
        ret["showname"] = getShowName()["showname"]
        ret["customname"] = getCustomName()["customname"]
        ret["boxname"] = getBoxName()["boxname"]
        if not ret["boxname"] or not ret["customname"]:
            ret["boxname"] = getInfo()["brand"] + " " + getInfo()["model"]
        ret["box"] = getBoxType()
        ret["remote"] = remote
        from Components.config import config

        if hasattr(eEPGCache, "FULL_DESCRIPTION_SEARCH"):
            ret["epgsearchcaps"] = True
        else:
            ret["epgsearchcaps"] = False
            if config.OpenWebif.webcache.epg_desc_search.value:
                config.OpenWebif.webcache.epg_desc_search.value = False
                config.OpenWebif.webcache.epg_desc_search.save()
        ret["epgsearchtype"] = getEPGSearchType()["epgsearchtype"]
        extras = []
        extras.append({"key": "ajax/settings", "description": _("Settings")})
        if fileExists(resolveFilename(SCOPE_PLUGINS, "Extensions/LCD4linux/WebSite.pyo")):
            lcd4linux_key = "lcd4linux/config"
            if fileExists(resolveFilename(SCOPE_PLUGINS, "Extensions/WebInterface/plugin.pyo")):
                from Components.Network import iNetwork

                ifaces = iNetwork.getConfiguredAdapters()
                if len(ifaces):
                    ip_list = iNetwork.getAdapterAttribute(ifaces[0], "ip")  # use only the first configured interface
                    ip = "%d.%d.%d.%d" % (ip_list[0], ip_list[1], ip_list[2], ip_list[3])
                try:
                    lcd4linux_port = "http://" + ip + ":" + str(config.plugins.Webinterface.http.port.value) + "/"
                    lcd4linux_key = lcd4linux_port + "lcd4linux/config"
                except KeyError:
                    lcd4linux_key = None
            if lcd4linux_key:
                extras.append({"key": lcd4linux_key, "description": _("LCD4Linux Setup")})

        try:
            from Plugins.Extensions.AutoTimer.AutoTimer import AutoTimer

            extras.append({"key": "ajax/at", "description": _("AutoTimer")})
        except ImportError:
            pass
        if fileExists(resolveFilename(SCOPE_PLUGINS, "Extensions/OpenWebif/controllers/views/ajax/bqe.tmpl")):
            extras.append({"key": "ajax/bqe", "description": _("BouquetEditor")})

        try:
            from Plugins.Extensions.EPGRefresh.EPGRefresh import epgrefresh

            extras.append({"key": "ajax/epgr", "description": _("EPGRefresh")})
        except ImportError:
            pass
        ret["extras"] = extras

        return ret
Exemple #2
0
	def prepareMainTemplate(self):
		from Components.Network import iNetwork
		ifaces = iNetwork.getConfiguredAdapters()
		if len(ifaces):
				ip_list = iNetwork.getAdapterAttribute(ifaces[0], "ip") # use only the first configured interface
				ip = "%d.%d.%d.%d" % (ip_list[0], ip_list[1], ip_list[2], ip_list[3])
			
		ret = getCollapsedMenus()
		ret['remotegrabscreenshot'] = getRemoteGrabScreenshot()['remotegrabscreenshot']
		ret['configsections'] = getConfigsSections()['sections']
		ret['zapstream'] = getZapStream()['zapstream']
		ret['showname'] = getShowName()['showname']
		ret['customname'] = getCustomName()['customname']
		ret['boxname'] = getBoxName()['boxname']
		if not ret['boxname'] or not ret['customname']:
			ret['boxname'] = getInfo()['brand']+" "+getInfo()['model']
		ret['box'] = getBoxType()
		ret["remote"] = remote
		from Components.config import config
		if hasattr(eEPGCache, 'FULL_DESCRIPTION_SEARCH'):
			ret['epgsearchcaps'] = True
		else:
			ret['epgsearchcaps'] = False
			if config.ModernWebif.webcache.epg_desc_search.value:
				config.ModernWebif.webcache.epg_desc_search.value = False
				config.ModernWebif.webcache.epg_desc_search.save()
		ret['epgsearchtype'] = getEPGSearchType()['epgsearchtype']
		extras = []
		extras.append({ 'key': 'ajax/settings','description': _("Settings")})
		if fileExists(resolveFilename(SCOPE_PLUGINS, "Extensions/LCD4linux/WebSite.pyo")):
			lcd4linux_key = "lcd4linux/config"
			if fileExists(resolveFilename(SCOPE_PLUGINS, "Extensions/WebInterface/plugin.pyo")):
				try:
					lcd4linux_port = "http://" + ip + ":" + str(config.plugins.Webinterface.http.port.value) + "/"
					lcd4linux_key = lcd4linux_port + 'lcd4linux/config'
				except KeyError:
					lcd4linux_key = None
			if lcd4linux_key:
				extras.append({ 'key': lcd4linux_key, 'description': _("LCD4Linux Setup")})
		
		if fileExists("/usr/keys/oscam_atv/oscam.conf"):
				oscam_atv_config = ConfigParser.ConfigParser()
				oscam_atv_config.readfp(open('/usr/keys/oscam_atv/oscam.conf'))
				oscam_port = oscam_atv_config.get("webif","httpport");
				oscam_link = "http://" + ip + ":" + oscam_port + "/"
				extras.append({ 'key': oscam_link, 'description': _("OSCam Webinterface")})
		
		try:
			from Plugins.Extensions.AutoTimer.AutoTimer import AutoTimer
			extras.append({ 'key': 'ajax/at','description': _('AutoTimer')})
		except ImportError:
			pass
		if fileExists(resolveFilename(SCOPE_PLUGINS, "Extensions/ModernWebif/controllers/views/ajax/bqe.tmpl")):
			extras.append({ 'key': 'ajax/bqe','description': _('BouquetEditor')})
		
		try:
			from Plugins.Extensions.EPGRefresh.EPGRefresh import epgrefresh
			extras.append({ 'key': 'ajax/epgr','description': _('EPGRefresh')})
		except ImportError:
			pass
		ret['extras'] = extras

		return ret
Exemple #3
0
    def prepareMainTemplate(self, request):
        # here will be generated the dictionary for the main template
        ret = getCollapsedMenus()
        ret['remotegrabscreenshot'] = getRemoteGrabScreenshot(
        )['remotegrabscreenshot']
        ret['configsections'] = getConfigsSections()['sections']
        ret['showname'] = getShowName()['showname']
        ret['customname'] = getCustomName()['customname']
        ret['boxname'] = getBoxName()['boxname']
        if not ret['boxname'] or not ret['customname']:
            ret['boxname'] = getInfo()['brand'] + " " + getInfo()['model']
        ret['box'] = getBoxType()
        ret["remote"] = remote
        from Components.config import config
        if hasattr(eEPGCache, 'FULL_DESCRIPTION_SEARCH'):
            ret['epgsearchcaps'] = True
        else:
            ret['epgsearchcaps'] = False
            if config.OpenWebif.webcache.epg_desc_search.value:
                config.OpenWebif.webcache.epg_desc_search.value = False
                config.OpenWebif.webcache.epg_desc_search.save()
        ret['epgsearchtype'] = getEPGSearchType()['epgsearchtype']
        extras = []
        extras.append({'key': 'ajax/settings', 'description': _("Settings")})
        from Components.Network import iNetwork
        ifaces = iNetwork.getConfiguredAdapters()
        if len(ifaces):
            ip_list = iNetwork.getAdapterAttribute(
                ifaces[0], "ip")  # use only the first configured interface
            ip = "%d.%d.%d.%d" % (ip_list[0], ip_list[1], ip_list[2],
                                  ip_list[3])

        if fileExists(
                resolveFilename(SCOPE_PLUGINS,
                                "Extensions/LCD4linux/WebSite.pyo")):
            lcd4linux_key = "lcd4linux/config"
            if fileExists(
                    resolveFilename(SCOPE_PLUGINS,
                                    "Extensions/WebInterface/plugin.pyo")):
                try:
                    lcd4linux_port = "http://" + ip + ":" + str(
                        config.plugins.Webinterface.http.port.value) + "/"
                    lcd4linux_key = lcd4linux_port + 'lcd4linux/config'
                except KeyError:
                    lcd4linux_key = None
            if lcd4linux_key:
                extras.append({
                    'key': lcd4linux_key,
                    'description': _("LCD4Linux Setup"),
                    'nw': '1'
                })

        self.oscamconf = self.oscamconfPath()
        if self.oscamconf is not None:
            data = open(self.oscamconf, "r").readlines()
            proto = "http"
            port = None
            for i in data:
                if "httpport" in i.lower():
                    port = i.split("=")[1].strip()
                    if port[0] == '+':
                        proto = "https"
                        port = port[1:]
            if port is not None:
                url = "%s://%s:%s" % (proto, request.getRequestHostname(),
                                      port)
                extras.append({
                    'key': url,
                    'description': _("OSCam Webinterface"),
                    'nw': '1'
                })

        try:
            from Plugins.Extensions.AutoTimer.AutoTimer import AutoTimer
            extras.append({'key': 'ajax/at', 'description': _('AutoTimer')})
        except ImportError:
            pass

        if fileExists(
                resolveFilename(
                    SCOPE_PLUGINS,
                    "Extensions/OpenWebif/controllers/views/ajax/bqe.tmpl")):
            extras.append({
                'key': 'ajax/bqe',
                'description': _('BouquetEditor')
            })

        try:
            from Plugins.Extensions.EPGRefresh.EPGRefresh import epgrefresh
            extras.append({'key': 'ajax/epgr', 'description': _('EPGRefresh')})
        except ImportError:
            pass

        ret['extras'] = extras
        if config.OpenWebif.webcache.theme.value:
            ret['theme'] = config.OpenWebif.webcache.theme.value
        else:
            ret['theme'] = 'original'
        return ret