Ejemplo n.º 1
0
def housekeepingExtensionsmenu(el):
	if el.value:
		plugins.addPlugin(extDescriptor)
	else:
		try:
			plugins.removePlugin(extDescriptor)
		except ValueError as ve:
			print("[AutoTimer] housekeepingExtensionsmenu got confused, tried to remove non-existant plugin entry... ignoring.")
Ejemplo n.º 2
0
def housekeepingExtensionsmenu(el):
	if el.value:
		plugins.addPlugin(extDescriptor)
	else:
		try:
			plugins.removePlugin(extDescriptor)
		except ValueError as ve:
			doLog("[AutoTimer] housekeepingExtensionsmenu got confused, tried to remove non-existant plugin entry... ignoring.")
Ejemplo n.º 3
0
def AutozapExtensionsmenu(el):
	if el.value:
		plugins.addPlugin(autozapDescriptor)
	else:
		try:
			plugins.removePlugin(autozapDescriptor)
		except ValueError as ve:
			print("[EPGRefresh] housekeepingExtensionsmenu got confused, tried to remove non-existant plugin entry... ignoring.")
Ejemplo n.º 4
0
	def aitInvalidated(self):
		print "[HbbTV].aitInvalidated"
		self._redButtonApp = None
		self._textApp = None
		if plugins.getPlugins(PluginDescriptor.WHERE_HBBTV).count(HbbTV.redButtonDescriptor) > 0:
			plugins.removePlugin(HbbTV.redButtonDescriptor)
		if plugins.getPlugins(PluginDescriptor.WHERE_TELETEXT).count(HbbTV.textDescriptor) > 0:
			plugins.removePlugin(HbbTV.textDescriptor)
Ejemplo n.º 5
0
	def aitInvalidated(self):
		print "[HbbTV].aitInvalidated"
		self._redButtonApp = None
		self._textApp = None
		if plugins.getPlugins(PluginDescriptor.WHERE_HBBTV).count(HbbTV.redButtonDescriptor) > 0:
			plugins.removePlugin(HbbTV.redButtonDescriptor)
		if plugins.getPlugins(PluginDescriptor.WHERE_TELETEXT).count(HbbTV.textDescriptor) > 0:
			plugins.removePlugin(HbbTV.textDescriptor)
Ejemplo n.º 6
0
def AdjustExtensionsmenu(enable, PlugDescriptor):
	if enable:
		plugins.addPlugin(PlugDescriptor)
	else:
		try:
			plugins.removePlugin(PlugDescriptor)
		except ValueError as ve:
			if PlugDescriptor != extRunDescriptor:
				print("[EPGRefresh] AdjustExtensionsmenu got confused, tried to remove non-existant plugin entry... ignoring.")
Ejemplo n.º 7
0
def AdjustExtensionsmenu(enable, PlugDescriptor):
	if enable:
		plugins.addPlugin(PlugDescriptor)
	else:
		try:
			plugins.removePlugin(PlugDescriptor)
		except ValueError as ve:
			if PlugDescriptor != extRunDescriptor:
				print("[EPGRefresh] AdjustExtensionsmenu got confused, tried to remove non-existant plugin entry... ignoring.")
Ejemplo n.º 8
0
	def keySave(self):
		self.saveAll()
		if not config.plugins.imdb.showinplugins.value:
			for plugin in plugins.getPlugins(PluginDescriptor.WHERE_PLUGINMENU):
				if plugin.name == _("IMDb Details"):
					plugins.removePlugin(plugin)

		plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))
		self.close()
def update_extensions_menu(cfg_el):
    print >> log, '[e2m3u2b] update extensions menu'
    try:
        if cfg_el.value:
            plugins.addPlugin(extDescriptor)
        else:
            plugins.removePlugin(extDescriptor)
    except Exception as e:
        print >> log, '[e2m3u2b] Failed to update extensions menu: ', e
Ejemplo n.º 10
0
	def keySave(self):
		self.saveAll()
		if not config.plugins.imdb.showinplugins.value:
			for plugin in plugins.getPlugins(PluginDescriptor.WHERE_PLUGINMENU):
				if plugin.name == _("IMDb Details"):
					plugins.removePlugin(plugin)

		plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))
		self.close()
Ejemplo n.º 11
0
	def save(self):
		self.saveAll()
		if not config.plugins.epgsearch.showinplugins.value:
			for plugin in plugins.getPlugins(PluginDescriptor.WHERE_PLUGINMENU):
				if plugin.name == _("EPGSearch"):
					plugins.removePlugin(plugin)

		plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))
		self.close()
Ejemplo n.º 12
0
def update_main_menu(cfg_el):
    print('[e2m3u2b] update main menu', file=log)
    try:
        if cfg_el.value:
            plugins.addPlugin(extDescriptorQuickMain)
        else:
            plugins.removePlugin(extDescriptorQuickMain)
    except Exception as e:
        print('[e2m3u2b] Failed to update main menu: ', e, file=log)
Ejemplo n.º 13
0
def AdjustPlugin(enable, PlugDescriptor):
	try:
		if enable:
			plugins.addPlugin(PlugDescriptor)
		else:
			plugins.removePlugin(PlugDescriptor)
	except ValueError:
		pass
	except:
		debugOut("AdjustPlugin-Error:\n" + str(format_exc()), forced=True)
Ejemplo n.º 14
0
def AdjustPlugin(enable, PlugDescriptor):
    try:
        if enable:
            plugins.addPlugin(PlugDescriptor)
        else:
            plugins.removePlugin(PlugDescriptor)
    except ValueError:
        pass
    except:
        debugOut("AdjustPlugin-Error:\n" + str(format_exc()), forced=True)
Ejemplo n.º 15
0
def update_main_menu(cfg_el):
    print >> log, '[e2m3u2b] [{}] update main menu'.format(
        time.strftime('%c', time.localtime(time.time())))
    try:
        if cfg_el.value:
            plugins.addPlugin(extDescriptorQuickMain)
        else:
            plugins.removePlugin(extDescriptorQuickMain)
    except Exception, e:
        print >> log, '[e2m3u2b] Failed to update main menu: ', e
Ejemplo n.º 16
0
	def save(self):
		purgeOrbposConfig()
		self.saveAll()
		if not config.plugins.epgsearch.showinplugins.value:
			for plugin in plugins.getPlugins(PluginDescriptor.WHERE_PLUGINMENU):
				if plugin.name == _("EPGSearch"):
					plugins.removePlugin(plugin)

		plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))
		self.close()
Ejemplo n.º 17
0
def housekeepingFilmmenu(el):
    if el.value:
        plugins.addPlugin(filmDescriptor_addto)
    else:
        try:
            plugins.removePlugin(filmDescriptor_addto)
        except ValueError as ve:
            doLog(
                "[AutoTimer] housekeepingFilmmenu got confused, tried to remove non-existant plugin entry... ignoring."
            )
Ejemplo n.º 18
0
def addEventinfomenu(el):
	if el.value == "1":
		plugins.addPlugin(eventinfoDescriptor)
	elif el.value == "3":
		plugins.addPlugin(eventinfoDescriptor)
	else:
		try:
			plugins.removePlugin(eventinfoDescriptor)
		except ValueError as ve:
			print("[EPGRefresh] housekeepingExtensionsmenu got confused, tried to remove non-existant plugin entry... ignoring.")
Ejemplo n.º 19
0
	def keySave(self):
		self.saveAll()

		for pl in pluginlist:
			if not pl[0].value:
				for plugin in plugins.getPlugins(pl[1].where):
					if plugin is pl[1]:
						plugins.removePlugin(plugin)

		plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))
		self.close()
Ejemplo n.º 20
0
	def keySave(self):
		self.saveAll()

		for pl in pluginlist:
			if not pl[0].value:
				for plugin in plugins.getPlugins(pl[1].where):
					if plugin is pl[1]:
						plugins.removePlugin(plugin)

		plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))
		self.close()
Ejemplo n.º 21
0
	def Save(self):
		self.saveAll()
		if not config.plugins.autotimer.show_in_plugins.value:
			for plugin in plugins.getPlugins(PluginDescriptor.WHERE_PLUGINMENU):
				if plugin.name == "AutoTimer":
					plugins.removePlugin(plugin)

		if not config.plugins.autotimer.show_in_extensionsmenu.value:
			for plugin in plugins.getPlugins(PluginDescriptor.WHERE_EXTENSIONSMENU):
				if plugin.name == "AutoTimer":
					plugins.removePlugin(plugin)
				
		plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))
		self.close()
Ejemplo n.º 22
0
	def keySave(self):
		self.saveAll()
		global imdb_headers
		if config.plugins.imdb.language.value:
			imdb_headers = {'Accept-Language': config.plugins.imdb.language.value}
		else:
			imdb_headers = {}
		if not config.plugins.imdb.showinplugins.value:
			for plugin in plugins.getPlugins(PluginDescriptor.WHERE_PLUGINMENU):
				if plugin.name == _("IMDb Details"):
					plugins.removePlugin(plugin)

		plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))
		self.close()
Ejemplo n.º 23
0
def Plugins(**kwargs):
	name = 'MediaPlayer2'
	descr = _('Play back media files with subtitles')
	list = []
	list.append(PluginDescriptor(name=name, description=descr, where=PluginDescriptor.WHERE_PLUGINMENU, icon="plugin.png", fnc=main))
	if config.plugins.mediaplayer2.extensionsMenu.getValue():
		list.append(PluginDescriptor(name=name, description=descr, where=PluginDescriptor.WHERE_EXTENSIONSMENU, fnc=main))
		
	if config.plugins.mediaplayer2.mainMenu.getValue():
		for p in plugins.getPlugins(where=PluginDescriptor.WHERE_MENU):
			if p.name == "MediaPlayer":
				plugins.removePlugin(p)
				break
		list.append(PluginDescriptor(name=name, description=descr, where=PluginDescriptor.WHERE_MENU, needsRestart=False, fnc=startSetup))
	return list
Ejemplo n.º 24
0
def Plugins(**kwargs):
	name = 'MediaPlayer2'
	descr = _('Play back media files with subtitles')
	list = []
	list.append(PluginDescriptor(name=name, description=descr, where=PluginDescriptor.WHERE_PLUGINMENU, icon="plugin.png", fnc=main))
	if config.plugins.mediaplayer2.extensionsMenu.getValue():
		list.append(PluginDescriptor(name=name, description=descr, where=PluginDescriptor.WHERE_EXTENSIONSMENU, fnc=main))
		
	if config.plugins.mediaplayer2.mainMenu.getValue():
		for p in plugins.getPlugins(where=PluginDescriptor.WHERE_MENU):
			if p.name == "MediaPlayer":
				plugins.removePlugin(p)
				break
		list.append(PluginDescriptor(name=name, description=descr, where=PluginDescriptor.WHERE_MENU, needsRestart=False, fnc=menu))
	return list
		
Ejemplo n.º 25
0
	def save(self):
		#print "saving"
		self.updateTimer.stop()
		self.saveAll()
		if not config.plugins.xmltvimport.showinplugins.value:
			for plugin in plugins.getPlugins(PluginDescriptor.WHERE_PLUGINMENU):
				if plugin.name == _("XMLTV-Importer"):
					plugins.removePlugin(plugin)

		if not config.plugins.xmltvimport.showinextensions.value:
			for plugin in plugins.getPlugins(PluginDescriptor.WHERE_EXTENSIONSMENU):
				if plugin.name == _("XMLTV-Importer"):
					plugins.removePlugin(plugin)
				
		plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))
		self.close(True,self.session)
Ejemplo n.º 26
0
    def save(self):
        #print "saving"
        self.updateTimer.stop()
        self.saveAll()
        if not config.plugins.xmltvimport.showinplugins.value:
            for plugin in plugins.getPlugins(
                    PluginDescriptor.WHERE_PLUGINMENU):
                if plugin.name == _("XMLTV-Importer"):
                    plugins.removePlugin(plugin)

        if not config.plugins.xmltvimport.showinextensions.value:
            for plugin in plugins.getPlugins(
                    PluginDescriptor.WHERE_EXTENSIONSMENU):
                if plugin.name == _("XMLTV-Importer"):
                    plugins.removePlugin(plugin)

        plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))
        self.close(True, self.session)
Ejemplo n.º 27
0
def housekeepingPluginmenu(el):
	if el.value:
		plugins.addPlugin(activateDescriptor)
	else:
		plugins.removePlugin(activateDescriptor)
Ejemplo n.º 28
0
def autostart(reason, *args, **kwargs):
	if reason == 0:
		if hasattr(PluginComponent, 'pluginSort_baseAddPlugin'):
			print("[PluginSort] Something went wrong as our autostart handler was called multiple times for startup, printing traceback and ignoring.")
			import traceback, sys
			traceback.print_stack(limit=5, file=sys.stdout)
		else:
			PluginComponent.pluginSort_baseAddPlugin = PluginComponent.addPlugin
			PluginComponent.addPlugin = PluginComponent_addPlugin

			# we use a copy for installed plugins because we might change the 'where'-lists
			plugins.installedPluginList = plugins.pluginList[:]
			def PluginComponent__setattr__(self, key, value):
				if key == 'installedPluginList': return
				else: self.__dict__[key] = value
			PluginComponent.__setattr__ = PluginComponent__setattr__

			if hasattr(plugins, 'pluginHider_baseGetPlugins'):
				pluginlist = plugins.pluginHider_baseGetPlugins([PluginDescriptor.WHERE_PLUGINMENU, PluginDescriptor.WHERE_EXTENSIONSMENU, PluginDescriptor.WHERE_MOVIELIST, PluginDescriptor.WHERE_EVENTINFO])
			else:
				pluginlist = plugins.getPlugins([PluginDescriptor.WHERE_PLUGINMENU, PluginDescriptor.WHERE_EXTENSIONSMENU, PluginDescriptor.WHERE_MOVIELIST, PluginDescriptor.WHERE_EVENTINFO])

			# "fix" weight of plugins already added to list, future ones will be fixed automatically
			fixed = []
			for plugin in pluginlist:
				if plugin in fixed: continue # skip double entries

				# create individual entries for multiple wheres, this is potentially harmful!
				if len(plugin.where) > 1:
					# remove all entries except for a potential autostart one (highly unlikely to mix autostart with one of the above, but you never know :D)
					if PluginDescriptor.WHERE_AUTOSTART in plugin.where:
						plugin.where.remove(PluginDescriptor.WHERE_AUTOSTART)
						hadAutostart = True
					else:
						hadAutostart = False
					plugins.removePlugin(plugin)
					plugins.addPlugin(plugin) # this is our own addPlugin now, which automatically creates copies

					# HACK: re-add autostart entry to internal list inside PluginComponent
					if hadAutostart:
						plugin.where = [ PluginDescriptor.WHERE_AUTOSTART ]
						plugins.pluginList.append(plugin)

				# we're keeping the entry, just fix the weight
				else:
					newWeight = pluginWeights.get(plugin)
					print("[PluginSort] Fixing weight for %s (was %d, now %d)" % (plugin.name, plugin.weight, newWeight))
					plugin.weight = newWeight

				fixed.append(plugin)

			# let movieepg fix extensions list sorting if installed, else do this ourselves
			if not fileExists(resolveFilename(SCOPE_PLUGINS, "Extensions/MovieEPG/plugin.py")):
				def InfoBarPlugins_getPluginList(self, *args, **kwargs):
					l = InfoBarPlugins.pluginSort_baseGetPluginList(self, *args, **kwargs)
					try:
						l.sort(key=lambda e: (e[0][1].args[0].weight, e[2]))
					except Exception as e:
						print("[PluginSort] Failed to sort extensions", e)
					return l

				InfoBarPlugins.pluginSort_baseGetPluginList = InfoBarPlugins.getPluginList
				InfoBarPlugins.getPluginList = InfoBarPlugins_getPluginList


			PluginBrowser.PluginBrowser = SortingPluginBrowser
	else:
		if hasattr(PluginComponent, 'pluginSort_baseAddPlugin'):
			PluginComponent.addPlugin = PluginComponent.pluginSort_baseAddPlugin
			del PluginComponent.pluginSort_baseAddPlugin
		if hasattr(InfoBarPlugins, 'pluginSort_baseGetPluginList'):
			InfoBarPlugins.getPluginList = InfoBarPlugins.pluginSort_baseGetPluginList
			del InfoBarPlugins.pluginSort_baseGetPluginList
		PluginBrowser.PluginBrowser = OriginalPluginBrowser
Ejemplo n.º 29
0
class CrossEPG_Setup(Screen):
	def __init__(self, session):
		if (getDesktop(0).size().width() < 800):
			skin = "%s/skins/setup_sd.xml" % (os.path.dirname(sys.modules[__name__].__file__))
		else:
			skin = "%s/skins/setup_hd.xml" % (os.path.dirname(sys.modules[__name__].__file__))
		f = open(skin, "r")
		self.skin = f.read()
		f.close()
		Screen.__init__(self, session)

		patchtype = getEPGPatchType()
		if patchtype == 0 or patchtype == 1 or patchtype == 3:
			self.fastpatch = True
		else:
			self.fastpatch = False
		
		self.session = session

		self.config = CrossEPG_Config()
		self.config.load()

		self.lamedbs = self.config.getAllLamedbs()

		self.lamedbs_desc = []
		self.mountpoint = []
		self.mountdescription = []
		self.automatictype = []

		self.show_extension = self.config.show_extension
		self.show_plugin = self.config.show_plugin
		self.show_force_reload_as_plugin = self.config.show_force_reload_as_plugin

		# make devices entries
		if self.config.isQBOXHD():
			self.mountdescription.append(_("Internal flash"))
			self.mountpoint.append("/var/crossepg/data")

		for partition in harddiskmanager.getMountedPartitions():
			if (partition.mountpoint != '/') and (partition.mountpoint != '') and self.isMountedInRW(partition.mountpoint):
				self.mountpoint.append(partition.mountpoint + "/crossepg")

				if partition.description != '':
					self.mountdescription.append(partition.description)
				else:
					self.mountdescription.append(partition.mountpoint)
				
		if not self.config.isQBOXHD():		# for other decoders we add internal flash as last entry (it's unsuggested)
			self.mountdescription.append(_("Internal flash (unsuggested)"))
			self.mountpoint.append(self.config.home_directory + "/data")
			
		# make lamedb entries
		for lamedb in self.lamedbs:
			if lamedb == "lamedb":
				self.lamedbs_desc.append(_("main lamedb"))
			else:
				self.lamedbs_desc.append(lamedb.replace("lamedb.", "").replace(".", " "))
				
		# make automatic type entries
		self.automatictype.append(_("disabled"))
		self.automatictype.append(_("once a day"))
		self.automatictype.append(_("every hour (only in standby)"))

		self.list = []
		self["config"] = ConfigList(self.list, session = self.session)
		self["config"].onSelectionChanged.append(self.setInfo)
		self["information"] = Label("")
		self["key_red"] = Button(_("Back"))
		self["key_green"] = Button()
		self["key_yellow"] = Button()
		self["key_blue"] = Button("")
		self["config_actions"] = NumberActionMap(["SetupActions", "InputAsciiActions", "KeyboardInputActions", "ColorActions"],
		{
			"red": self.quit,
			"cancel": self.quit,
			"left": self.keyLeft,
			"right": self.keyRight,
			"home": self.keyHome,
			"end": self.keyEnd,
			"1": self.keyNumberGlobal,
			"2": self.keyNumberGlobal,
			"3": self.keyNumberGlobal,
			"4": self.keyNumberGlobal,
			"5": self.keyNumberGlobal,
			"6": self.keyNumberGlobal,
			"7": self.keyNumberGlobal,
			"8": self.keyNumberGlobal,
			"9": self.keyNumberGlobal,
			"0": self.keyNumberGlobal
		}, -1) # to prevent left/right overriding the listbox

		self.makeList()

	def isMountedInRW(self, path):
		testfile = path + "/tmp-rw-test"
		os.system("touch " + testfile)
		if os.path.exists(testfile):
			os.system("rm -f " + testfile)
			return True
		return False
		
	def showWarning(self):	
		self.session.open(MessageBox, _("PLEASE READ!\nNo disk found. An hard drive or an usb pen is HARDLY SUGGESTED. If you still want use your internal flash pay attention to:\n(1) If you don't have enough free space your box may completely block and you need to flash it again\n(2) Many write operations on your internal flash may damage your flash memory"), type = MessageBox.TYPE_ERROR)
	
	def keyLeft(self):
		self["config"].handleKey(KEY_LEFT)
		self.update()
		#self.setInfo()

	def keyRight(self):
		self["config"].handleKey(KEY_RIGHT)
		self.update()
		#self.setInfo()

	def keyHome(self):
		self["config"].handleKey(KEY_HOME)
		self.update()
		#self.setInfo()

	def keyEnd(self):
		self["config"].handleKey(KEY_END)
		self.update()
		#self.setInfo()

	def keyNumberGlobal(self, number):
		self["config"].handleKey(KEY_0 + number)
		self.update()
		#self.setInfo()

	def makeList(self):
		self.list = []

		device_default = None
		i = 0
		for mountpoint in self.mountpoint:
			if mountpoint == self.config.db_root:
				device_default = self.mountdescription[i]
			i += 1

		# default device is really important... if miss a default we force it on first entry and update now the main config
		if device_default == None:
			self.config.db_root = self.mountpoint[0]
			device_default = self.mountdescription[0]
			
		lamedb_default = _("main lamedb")
		if self.config.lamedb != "lamedb":
			lamedb_default = self.config.lamedb.replace("lamedb.", "").replace(".", " ")

		scheduled_default = None
		if self.config.download_standby_enabled:
			scheduled_default = _("every hour (only in standby)")
		elif self.config.download_daily_enabled:
			scheduled_default = _("once a day")
		else:
			scheduled_default = _("disabled")

		self.list.append((_("Storage device"), ConfigSelection(self.mountdescription, device_default)))
		if len(self.lamedbs_desc) > 1:
			self.list.append((_("Preferred lamedb"), ConfigSelection(self.lamedbs_desc, lamedb_default)))

		self.list.append((_("Enable csv import"), ConfigYesNo(self.config.csv_import_enabled > 0)))
		self.list.append((_("Force epg reload on boot"), ConfigYesNo(self.config.force_load_on_boot > 0)))
		self.list.append((_("Download on tune"), ConfigYesNo(self.config.download_tune_enabled > 0)))
		self.list.append((_("Scheduled download"), ConfigSelection(self.automatictype, scheduled_default)))

		if self.config.download_daily_enabled:
			ttime = localtime()
			ltime = (ttime[0], ttime[1], ttime[2], self.config.download_daily_hours, self.config.download_daily_minutes, ttime[5], ttime[6], ttime[7], ttime[8])
			self.list.append((_("Scheduled download at"), ConfigClock(mktime(ltime))))

		if not self.fastpatch:
			self.list.append((_("Reboot after a scheduled download"), ConfigYesNo(self.config.download_daily_reboot > 0)))
			self.list.append((_("Reboot after a manual download"), ConfigYesNo(self.config.download_manual_reboot > 0)))
		self.list.append((_("Show as plugin"), ConfigYesNo(self.config.show_plugin > 0)))
		self.list.append((_("Show as extension"), ConfigYesNo(self.config.show_extension > 0)))
		self.list.append((_("Show 'Force reload' as plugin"), ConfigYesNo(self.config.show_force_reload_as_plugin > 0)))

		self["config"].setList(self.list)
		self.setInfo()

	def update(self):
		redraw = False
		self.config.db_root = self.mountpoint[self.list[0][1].getIndex()]
		
		i = 1
		if len(self.lamedbs_desc) > 1:
			self.config.lamedb = self.lamedbs[self.list[i][1].getIndex()]
			i += 1

		self.config.csv_import_enabled = int(self.list[i][1].getValue())
		self.config.force_load_on_boot = int(self.list[i+1][1].getValue())
		self.config.download_tune_enabled = int(self.list[i+2][1].getValue())

		dailycache = self.config.download_daily_enabled
		standbycache = self.config.download_standby_enabled
		if self.list[i+3][1].getIndex() == 0:
			self.config.download_daily_enabled = 0
			self.config.download_standby_enabled = 0
		elif self.list[i+3][1].getIndex() == 1:
			self.config.download_daily_enabled = 1
			self.config.download_standby_enabled = 0
		else:
			self.config.download_daily_enabled = 0
			self.config.download_standby_enabled = 1

		if dailycache != self.config.download_daily_enabled or standbycache != self.config.download_standby_enabled:
			redraw = True

		i += 4
		if dailycache:
			self.config.download_daily_hours = self.list[i][1].getValue()[0]
			self.config.download_daily_minutes = self.list[i][1].getValue()[1]
			i += 1

		if not self.fastpatch:
			self.config.download_daily_reboot = int(self.list[i][1].getValue())
			self.config.download_manual_reboot = int(self.list[i+1][1].getValue())
			i += 2

		self.config.show_plugin = int(self.list[i][1].getValue())
		self.config.show_extension = int(self.list[i+1][1].getValue())
		self.config.show_force_reload_as_plugin = int(self.list[i+2][1].getValue())

		if redraw:
			self.makeList()

	def setInfo(self):
		index = self["config"].getCurrentIndex()
		if len(self.lamedbs_desc) <= 1 and index > 0:
			index += 1
		if self.config.download_daily_enabled == 0 and index > 5:
			index += 1
		if self.fastpatch and index > 6:
			index += 2

		if index == 0:
			self["information"].setText(_("Drive where you save data.\nThe drive MUST be mounted in rw. If you can't see your device here probably is mounted as read only or autofs handle it only in read only mode. In case of mount it manually and try again"))
		elif index == 1:
			self["information"].setText(_("Lamedb used for epg.dat conversion.\nThis option doesn't work with crossepg patch v2"))
		elif index == 2:
			self["information"].setText(_("Import *.csv and *.bin from %s/import or %s/import\n(*.bin are binaries with a csv as stdout)") % (self.config.db_root, self.config.home_directory))
		elif index == 3:
			self["information"].setText(_("Reload epg at every boot.\nNormally it's not necessary but recover epg after an enigma2 crash"))
		elif index == 4:
			self["information"].setText(_("Only for opentv providers.\nIf you zap on channel used from a provider it download the epg in background"))
		elif index == 5:
			if self.config.download_standby_enabled:
				self["information"].setText(_("When the decoder is in standby opentv providers will be automatically downloaded every hour.\nXMLTV providers will be always downloaded only once a day"))
			elif self.config.download_daily_enabled:
				self["information"].setText(_("Download epg once a day"))
			else:
				self["information"].setText(_("Scheduled download disabled"))
		elif index == 6:
			self["information"].setText(_("Time for scheduled daily download"))
		elif index == 7:
			self["information"].setText(_("Automatically reboot the decoder after a scheduled download"))
		elif index == 8:
			self["information"].setText(_("Automatically reboot the decoder after a manual download"))
		elif index == 9:
			self["information"].setText(_("Show crossepg in plugin menu"))
		elif index == 10:
			self["information"].setText(_("Show crossepg in extensions menu"))
		
	def quit(self):
		self.config.last_full_download_timestamp = 0
		self.config.last_partial_download_timestamp = 0
		self.config.configured = 1
		self.config.save()
		try:
			if self.config.db_root[-8:] == "crossepg":
				config.misc.epgcache_filename.setValue(self.config.db_root[:-9] + "/epg.dat")
			else:
				config.misc.epgcache_filename.setValue(self.config.db_root + "/epg.dat")
			config.misc.epgcache_filename.callNotifiersOnSaveAndCancel = True
			config.misc.epgcache_filename.save()
			configfile.save()
		except Exception, e:
			print "custom epgcache filename not supported by current enigma2 version"
			
		if getEPGPatchType() == -1:
			# exec crossepg_prepare_pre_start for unpatched images
			os.system(self.config.home_directory + "/crossepg_prepare_pre_start.sh")
			
		if self.show_extension != self.config.show_extension or self.show_plugin != self.config.show_plugin:
			for plugin in plugins.getPlugins(PluginDescriptor.WHERE_PLUGINMENU):
				if plugin.name == "CrossEPG Downloader":
					plugins.removePlugin(plugin)
				
			for plugin in plugins.getPlugins(PluginDescriptor.WHERE_EXTENSIONSMENU):
				if plugin.name == "CrossEPG Downloader":
					plugins.removePlugin(plugin)
				
			plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))
			
		crossepg_auto.forcePoll()
		
		if self.config.db_root == self.config.home_directory + "/data" and not self.config.isQBOXHD():
			self.showWarning()
			
		self.close()
Ejemplo n.º 30
0
def autostart(reason, *args, **kwargs):
    if reason == 0:
        if hasattr(PluginComponent, 'pluginSort_baseAddPlugin'):
            print(
                "[PluginSort] Something went wrong as our autostart handler was called multiple times for startup, printing traceback and ignoring."
            )
            import traceback, sys
            traceback.print_stack(limit=5, file=sys.stdout)
        else:
            PluginComponent.pluginSort_baseAddPlugin = PluginComponent.addPlugin
            PluginComponent.addPlugin = PluginComponent_addPlugin

            # we use a copy for installed plugins because we might change the 'where'-lists
            plugins.installedPluginList = plugins.pluginList[:]

            def PluginComponent__setattr__(self, key, value):
                if key == 'installedPluginList': return
                else: self.__dict__[key] = value

            PluginComponent.__setattr__ = PluginComponent__setattr__

            if hasattr(plugins, 'PluginComponent.pluginHider_baseGetPlugins'):
                pluginlist = plugins.pluginHider_baseGetPlugins([
                    PluginDescriptor.WHERE_PLUGINMENU,
                    PluginDescriptor.WHERE_EXTENSIONSMENU,
                    PluginDescriptor.WHERE_MOVIELIST,
                    PluginDescriptor.WHERE_EVENTINFO
                ])
            else:
                pluginlist = plugins.getPlugins([
                    PluginDescriptor.WHERE_PLUGINMENU,
                    PluginDescriptor.WHERE_EXTENSIONSMENU,
                    PluginDescriptor.WHERE_MOVIELIST,
                    PluginDescriptor.WHERE_EVENTINFO
                ])

            # "fix" weight of plugins already added to list, future ones will be fixed automatically
            fixed = []
            for plugin in pluginlist:
                if plugin in fixed: continue  # skip double entries

                # create individual entries for multiple wheres, this is potentially harmful!
                if len(plugin.where) > 1:
                    # remove all entries except for a potential autostart one (highly unlikely to mix autostart with one of the above, but you never know :D)
                    if PluginDescriptor.WHERE_AUTOSTART in plugin.where:
                        plugin.where.remove(PluginDescriptor.WHERE_AUTOSTART)
                        hadAutostart = True
                    else:
                        hadAutostart = False
                    plugins.removePlugin(plugin)
                    plugins.addPlugin(
                        plugin
                    )  # this is our own addPlugin now, which automatically creates copies

                    # HACK: re-add autostart entry to internal list inside PluginComponent
                    if hadAutostart:
                        plugin.where = [PluginDescriptor.WHERE_AUTOSTART]
                        plugins.pluginList.append(plugin)

                # we're keeping the entry, just fix the weight
                else:
                    newWeight = pluginWeights.get(plugin)
                    print(
                        "[PluginSort] Fixing weight for %s (was %d, now %d)" %
                        (plugin.name, plugin.weight, newWeight))
                    plugin.weight = newWeight

                fixed.append(plugin)

            # let movieepg fix extensions list sorting if installed, else do this ourselves
            if not fileExists(
                    resolveFilename(SCOPE_PLUGINS,
                                    "Extensions/MovieEPG/plugin.py")):

                def InfoBarPlugins_getPluginList(self, *args, **kwargs):
                    l = InfoBarPlugins.pluginSort_baseGetPluginList(
                        self, *args, **kwargs)
                    try:
                        l.sort(key=lambda e: (e[0][1].args[0].weight, e[2]))
                    except Exception as e:
                        print("[PluginSort] Failed to sort extensions", e)
                    return l

                InfoBarPlugins.pluginSort_baseGetPluginList = InfoBarPlugins.getPluginList
                InfoBarPlugins.getPluginList = InfoBarPlugins_getPluginList

            PluginBrowser.PluginBrowser = SortingPluginBrowser
    else:
        if hasattr(PluginComponent, 'pluginSort_baseAddPlugin'):
            PluginComponent.addPlugin = PluginComponent.pluginSort_baseAddPlugin
            del PluginComponent.pluginSort_baseAddPlugin
        if hasattr(InfoBarPlugins, 'pluginSort_baseGetPluginList'):
            InfoBarPlugins.getPluginList = InfoBarPlugins.pluginSort_baseGetPluginList
            del InfoBarPlugins.pluginSort_baseGetPluginList
        PluginBrowser.PluginBrowser = OriginalPluginBrowser
Ejemplo n.º 31
0
def housekeepingExtensionsmenu(el):
	if el.value:
		plugins.addPlugin(extDescriptor)
	else:
		plugins.removePlugin(extDescriptor)
Ejemplo n.º 32
0
def housekeepingPluginmenu(el):
    if el.value:
        plugins.addPlugin(activateDescriptor)
    else:
        plugins.removePlugin(activateDescriptor)