Пример #1
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()
Пример #2
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()