Beispiel #1
0
 def __init__(self, session):
     self.session = session
     Screen.__init__(self, session)
     self.setup_title = _("XMLTV Import Sources")
     Screen.setTitle(self, self.setup_title)
     self["key_red"] = Button(_("Cancel"))
     self["key_green"] = Button(_("Ok"))
     self["key_yellow"] = Button()  # _("Import now"))
     self["key_blue"] = Button()
     self.onChangedEntry = []
     filter = config.plugins.xmltvimport.sources.getValue().split("|")
     sources = [
         # (description, value, index, selected)
         SelectionEntryComponent(x.description, x.description, 0,
                                 (filter is None)
                                 or (x.description in filter))
         for x in XMLTVConfig.enumSources(CONFIG_PATH, filter=None)
     ]
     self["list"] = SelectionList(sources)
     self["setupActions"] = ActionMap(
         ["SetupActions", "ColorActions", "MenuActions"], {
             "red": self.cancel,
             "green": self.save,
             "yellow": self.doimport,
             "save": self.save,
             "cancel": self.cancel,
             "ok": self["list"].toggleSelection,
             "menu": self.cancel,
         }, -2)
Beispiel #2
0
	def __init__(self, session):
		self.session = session
		Screen.__init__(self, session)
		self.setup_title = _("XMLTV Import Sources")
		Screen.setTitle(self, self.setup_title)
		self["key_red"] = Button(_("Cancel"))
		self["key_green"] = Button(_("Ok"))
		self["key_yellow"] = Button() # _("Import now"))
		self["key_blue"] = Button()
		self.onChangedEntry = []
		filter = config.plugins.xmltvimport.sources.getValue().split("|")
		sources = [
			# (description, value, index, selected)
			SelectionEntryComponent(x.description, x.description, 0, (filter is None) or (x.description in filter))
			for x in XMLTVConfig.enumSources(CONFIG_PATH, filter=None)
			]
		self["list"] = SelectionList(sources)
		self["setupActions"] = ActionMap(["SetupActions", "ColorActions", "MenuActions"],
		{
			"red": self.cancel,
			"green": self.save,
			"yellow": self.doimport,
			"save": self.save,
			"cancel": self.cancel,
			"ok": self["list"].toggleSelection,
			"menu": self.cancel,
		}, -2)
Beispiel #3
0
 def doimport(self):
     if xmltvimport.isImportRunning():
         print >> log, "[XMLTVImport] Already running, won't start again"
         self.session.open(
             MessageBox,
             _("XMLTVImport Plugin\nImport of epg data is still in progress. Please wait."
               ),
             MessageBox.TYPE_ERROR,
             timeout=10,
             close_on_any_key=True)
         return
     cfg = config.plugins.xmltvimport.sources.getValue().split("|")
     sources = [s for s in XMLTVConfig.enumSources(CONFIG_PATH, filter=cfg)]
     if not sources:
         self.session.open(MessageBox,
                           _("No active EPG sources found, nothing to do"),
                           MessageBox.TYPE_INFO,
                           timeout=10,
                           close_on_any_key=True)
         return
     # make it a stack, first on top.
     sources.reverse()
     xmltvimport.sources = sources
     self.session.openWithCallback(
         self.do_import_callback,
         MessageBox,
         _("XMLTVImport Plugin\nImport of epg data will start\nThis may take a few minutes\nIs this ok?"
           ),
         MessageBox.TYPE_YESNO,
         timeout=15,
         default=True)
def importFrom(xmltvimport, sourceXml):
	# Hack to make this test run on Windows (where the reactor cannot handle files)
	if sys.platform.startswith('win'):
		import twisted.python.runtime
		twisted.python.runtime.platform.supportsThreads = lambda: False
		class FakeReactor:
			def addReader(self, r):
				self.r = r
			def removeReader(self, r):
				if self.r is r:
					self.r = None
				else:
					raise Exception, "Removed reader without adding it"
			def run(self):
				while self.r is not None:
					self.r.doRead()
			def stop(self):
				print "reactor stopped"
				pass
		XMLTVImport.reactor = FakeReactor()
	sources = [ s for s in XMLTVConfig.enumSourcesFile(sourceXml, filter = None) ]
	sources.reverse()
	xmltvimport.sources = sources
	xmltvimport.onDone = done
	xmltvimport.beginImport(longDescUntil = time.time() + (5*24*3600))
	XMLTVImport.reactor.run()
Beispiel #5
0
def importFrom(xmltvimport, sourceXml):
    # Hack to make this test run on Windows (where the reactor cannot handle files)
    if sys.platform.startswith('win'):
        import twisted.python.runtime
        twisted.python.runtime.platform.supportsThreads = lambda: False

        class FakeReactor:
            def addReader(self, r):
                self.r = r

            def removeReader(self, r):
                if self.r is r:
                    self.r = None
                else:
                    raise Exception, "Removed reader without adding it"

            def run(self):
                while self.r is not None:
                    self.r.doRead()

            def stop(self):
                print "reactor stopped"
                pass

        XMLTVImport.reactor = FakeReactor()
    sources = [s for s in XMLTVConfig.enumSourcesFile(sourceXml, filter=None)]
    sources.reverse()
    xmltvimport.sources = sources
    xmltvimport.onDone = done
    xmltvimport.beginImport(longDescUntil=time.time() + (5 * 24 * 3600))
    XMLTVImport.reactor.run()
Beispiel #6
0
	def runImport(self):
		cfg = config.plugins.xmltvimport.sources.getValue().split("|")
		sources = [ s for s in XMLTVConfig.enumSources(CONFIG_PATH, filter = cfg) ]
		if sources:
			sources.reverse()
			xmltvimport.sources = sources
			xmltvimport.onDone = doneImport
			xmltvimport.beginImport(longDescUntil = config.plugins.xmltvimport.longDescDays.value * 24 * 3600 + time.time())
Beispiel #7
0
 def runImport(self):
     cfg = config.plugins.xmltvimport.sources.getValue().split("|")
     sources = [s for s in XMLTVConfig.enumSources(CONFIG_PATH, filter=cfg)]
     if sources:
         sources.reverse()
         xmltvimport.sources = sources
         xmltvimport.onDone = doneImport
         xmltvimport.beginImport(
             longDescUntil=config.plugins.xmltvimport.longDescDays.value *
             24 * 3600 + time.time())
Beispiel #8
0
	def doimport(self):
		if xmltvimport.isImportRunning():
			print>>log, "[XMLTVImport] Already running, won't start again"
			self.session.open(MessageBox, _("XMLTVImport Plugin\nImport of epg data is still in progress. Please wait."), MessageBox.TYPE_ERROR, timeout = 10, close_on_any_key = True)
			return
		cfg = config.plugins.xmltvimport.sources.getValue().split("|")
		sources = [ s for s in XMLTVConfig.enumSources(CONFIG_PATH, filter = cfg) ]
		if not sources:
			self.session.open(MessageBox, _("No active EPG sources found, nothing to do"), MessageBox.TYPE_INFO, timeout = 10, close_on_any_key = True)
			return
		# make it a stack, first on top.
		sources.reverse()
		xmltvimport.sources = sources
		self.session.openWithCallback(self.do_import_callback, MessageBox, _("XMLTVImport Plugin\nImport of epg data will start\nThis may take a few minutes\nIs this ok?"), MessageBox.TYPE_YESNO, timeout = 15, default = True)