def run(self): req = self._req if self._stillAlive: req.setResponseCode(http.OK) req.setHeader("Content-type", "application/xhtml+xml") req.setHeader("charset", "UTF-8") reactor.callFromThread( lambda: req.write( '<?xml version="1.0" encoding="UTF-8" ?>\n<e2autotimersimulate api_version="' + str(API_VERSION) + '">\n' ) ) def finishRequest(): req.write("</e2autotimersimulate>") req.finish() id = req.args.get("id") if id: self.id = int(id[0]) else: self.id = None try: autotimer.parseEPG(simulateOnly=True, uniqueId=self.id, callback=self.intermediateWrite) except Exception as e: def finishRequest(): req.write("<exception>" + str(e) + "</exception><|PURPOSEFULLYBROKENXML<") req.finish() if self._stillAlive: reactor.callFromThread(finishRequest)
def run(self): req = self._req if self._stillAlive: req.setResponseCode(http.OK) req.setHeader('Content-type', 'application/xhtml+xml') req.setHeader('charset', 'UTF-8') reactor.callFromThread(lambda: req.write( "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<e2autotimersimulate api_version=\"" + str(API_VERSION) + "\">\n")) def finishRequest(): req.write('</e2autotimersimulate>') req.finish() try: autotimer.parseEPG(simulateOnly=True, callback=self.intermediateWrite) except Exception as e: def finishRequest(): req.write('<exception>' + str(e) + '</exception><|PURPOSEFULLYBROKENXML<') req.finish() if self._stillAlive: reactor.callFromThread(finishRequest)
def query(self): self.timer.stop() from Screens.Standby import inStandby print "[AutoTimer] Auto Poll" if config.plugins.autotimer.skip_during_records.getValue() and NavigationInstance.instance.RecordTimer.isRecording(): print("[AutoTimer] Skip check during running records") else: if config.plugins.autotimer.onlyinstandby.value and inStandby: print "[AutoTimer] Auto Poll Started" # Ignore any program errors try: ret = autotimer.parseEPG(autoPoll = True) except Exception: # Dump error to stdout import traceback, sys traceback.print_exc(file=sys.stdout) elif not config.plugins.autotimer.onlyinstandby.value: print "[AutoTimer] Auto Poll Started" # Ignore any program errors try: ret = autotimer.parseEPG(autoPoll = True) except Exception: # Dump error to stdout import traceback, sys traceback.print_exc(file=sys.stdout) self.timer.startLongTimer(config.plugins.autotimer.interval.value*60)
def query(self): self.timer.stop() from Screens.Standby import inStandby print "[AutoTimer] Auto Poll" if config.plugins.autotimer.skip_during_records.getValue( ) and NavigationInstance.instance.RecordTimer.isRecording(): print("[AutoTimer] Skip check during running records") else: if config.plugins.autotimer.onlyinstandby.value and inStandby: print "[AutoTimer] Auto Poll Started" # Ignore any program errors try: ret = autotimer.parseEPG(autoPoll=True) except Exception: # Dump error to stdout import traceback, sys traceback.print_exc(file=sys.stdout) elif not config.plugins.autotimer.onlyinstandby.value: print "[AutoTimer] Auto Poll Started" # Ignore any program errors try: ret = autotimer.parseEPG(autoPoll=True) except Exception: # Dump error to stdout import traceback, sys traceback.print_exc(file=sys.stdout) self.timer.startLongTimer(config.plugins.autotimer.interval.value * 60)
def render(self, req): self.req = req # todo timeout / error handling id = req.args.get("id") if id: id = int(id[0]) autotimer.parseEPG(simulateOnly=True, uniqueId=id, callback=self.parsecallback) return server.NOT_DONE_YET
def render(self, req): self.req = req # todo timeout / error handling id = req.args.get("id") if id: id = int(id[0]) else: return self.returnResult(req, False, _("missing parameter \"id\"")) autotimer.parseEPG(simulateOnly=True, uniqueId=id, callback=self.parsecallback) return server.NOT_DONE_YET
def editorCallback(ret): if ret: from plugin import autotimer autotimer.readXml() autotimer.add(ret) # Save modified xml autotimer.writeXml() autotimer.readXml() autotimer.parseEPG()
def query(self): self.timer.stop() from Screens.Standby import inStandby print "[Record Series] Auto Poll" doparse = True if config.plugins.autotimer.skip_during_records.getValue() and NavigationInstance.instance.RecordTimer.isRecording(): print("[Record Series] Skip check during running records") doparse = False if config.plugins.autotimer.skip_during_epgrefresh.value: try: from Plugins.Extensions.EPGRefresh.EPGRefresh import epgrefresh if epgrefresh.isrunning: print("[Record Series] Skip check during running EPGRefresh") doparse = False except: pass if not inStandby and config.plugins.autotimer.onlyinstandby.value: print("[Record Series] Skip check while not in Standby") doparse = False if doparse: print "[Record Series] Auto Poll Started" # Ignore any program errors try: ret = autotimer.parseEPG(autoPoll=True) except Exception: # Dump error to stdout import traceback, sys traceback.print_exc(file=sys.stdout) #TODO back to hours #self.timer.startLongTimer(config.plugins.autotimer.interval.value * 3600) self.timer.startLongTimer(config.plugins.autotimer.interval.value * 60)
def query(self): self.timer.stop() from Screens.Standby import inStandby print"[AutoTimer] current auto poll", datetime.now().strftime('%Y-%m-%d %H:%M:%S') doparse = True if config.plugins.autotimer.skip_during_records.getValue() and NavigationInstance.instance.RecordTimer.isRecording(): print("[AutoTimer] Skip check during running records") doparse = False if config.plugins.autotimer.skip_during_epgrefresh.value: try: from Plugins.Extensions.EPGRefresh.EPGRefresh import epgrefresh if epgrefresh.isrunning: print("[AutoTimer] Skip check during running EPGRefresh") doparse = False except: pass if not inStandby and config.plugins.autotimer.onlyinstandby.value: print("[AutoTimer] Skip check while not in Standby") doparse = False if doparse: print("[AutoTimer] Auto Poll Started") # Ignore any program errors try: ret = autotimer.parseEPG(autoPoll=True) except Exception: # Dump error to stdout import traceback import sys traceback.print_exc(file=sys.stdout) multiplier = config.plugins.autotimer.unit.value == "hour" and 60 or 1 self.timer.startLongTimer(config.plugins.autotimer.interval.value * 60 * multiplier) print"[AutoTimer] next auto poll at", (datetime.now() + timedelta(minutes=config.plugins.autotimer.interval.value * multiplier)).strftime('%Y-%m-%d %H:%M:%S')
def renderBackground(self, req): ret = autotimer.parseEPG(simulateOnly=True) returnlist = [ "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<e2autotimersimulate api_version=\"", str(API_VERSION), "\">\n" ] extend = returnlist.extend for (name, begin, end, serviceref, autotimername) in ret[3]: ref = ServiceReference(str(serviceref)) extend(('<e2simulatedtimer>\n' ' <e2servicereference>', stringToXML(serviceref), '</e2servicereference>\n', ' <e2servicename>', stringToXML(ref.getServiceName().replace( '\xc2\x86', '').replace('\xc2\x87', '')), '</e2servicename>\n', ' <e2name>', stringToXML(name), '</e2name>\n', ' <e2timebegin>', str(begin), '</e2timebegin>\n', ' <e2timeend>', str(end), '</e2timeend>\n', ' <e2autotimername>', stringToXML(autotimername), '</e2autotimername>\n' '</e2simulatedtimer>\n')) returnlist.append('</e2autotimersimulate>') req.setResponseCode(http.OK) req.setHeader('Content-type', 'application/xhtml+xml') req.setHeader('charset', 'UTF-8') return ''.join(returnlist)
def query(self): self.timer.stop() from Screens.Standby import inStandby print "[AutoTimer] Auto Poll" doparse = True if config.plugins.autotimer.skip_during_records.getValue() and NavigationInstance.instance.RecordTimer.isRecording(): print("[AutoTimer] Skip check during running records") doparse = False if config.plugins.autotimer.skip_during_epgrefresh.value: try: from Plugins.Extensions.EPGRefresh.EPGRefresh import epgrefresh if epgrefresh.isrunning: print("[AutoTimer] Skip check during running EPGRefresh") doparse = False except: pass if not inStandby and config.plugins.autotimer.onlyinstandby.value: print("[AutoTimer] Skip check while not in Standby") doparse = False if doparse: print "[AutoTimer] Auto Poll Started" # Ignore any program errors try: ret = autotimer.parseEPG(autoPoll=True) except Exception: # Dump error to stdout import traceback, sys traceback.print_exc(file=sys.stdout) #TODO back to hours #self.timer.startLongTimer(config.plugins.autotimer.interval.value * 3600) self.timer.startLongTimer(config.plugins.autotimer.interval.value * 60)
def query(self): self.timer.stop() from Screens.Standby import inStandby print"[AutoTimer] current auto poll", datetime.now().strftime('%Y-%m-%d %H:%M:%S') doparse = True if config.plugins.autotimer.skip_during_records.getValue() and NavigationInstance.instance.RecordTimer.isRecording(): print("[AutoTimer] Skip check during running records") doparse = False if config.plugins.autotimer.skip_during_epgrefresh.value: try: from Plugins.Extensions.EPGRefresh.EPGRefresh import epgrefresh if epgrefresh.isrunning: print("[AutoTimer] Skip check during running EPGRefresh") doparse = False except: pass if not inStandby and config.plugins.autotimer.onlyinstandby.value: print("[AutoTimer] Skip check while not in Standby") doparse = False if doparse: print("[AutoTimer] Auto Poll Started") # Ignore any program errors try: ret = autotimer.parseEPG(autoPoll=True) except Exception: # Dump error to stdout import traceback, sys traceback.print_exc(file=sys.stdout) multiplier = config.plugins.autotimer.unit.value == "hour" and 60 or 1 self.timer.startLongTimer(config.plugins.autotimer.interval.value * 60 * multiplier) print"[AutoTimer] next auto poll at", (datetime.now() + timedelta(minutes=config.plugins.autotimer.interval.value * multiplier)).strftime('%Y-%m-%d %H:%M:%S')
def renderBackground(self, req): ret = autotimer.parseEPG() output = _( "Found a total of %d matching Events.\n%d Timer were added and\n%d modified,\n%d conflicts encountered,\n%d similars added." ) % (ret[0], ret[1], ret[2], len(ret[4]), len(ret[5])) return self.returnResult(req, True, output)
def run(self): if config.plugins.autotimer.clear_memory.value: self.clearMemory() sem = self.__semaphore queue = self.__queue pump = self.__pump timer = self.__timer self.running = True while 1: sem.acquire() # NOTE: we have to check this here and not using the while to prevent the parser to be started on shutdown if not self.running: break if config.plugins.autotimer.skip_during_records.value: try: import NavigationInstance if NavigationInstance.instance.getRecordings(): doLog("[AutoTimer] Skip check during running records") reactor.callFromThread( timer.startLongTimer, config.plugins.autotimer.interval.value * 3600) continue except: pass try: if config.plugins.autotimer.onlyinstandby.value and Standby.inStandby is None: doLog("[AutoTimer] Skip check during live tv") reactor.callFromThread( timer.startLongTimer, config.plugins.autotimer.interval.value * 3600) continue except: pass if config.plugins.autotimer.skip_during_epgrefresh.value: try: from Plugins.Extensions.EPGRefresh.EPGRefresh import epgrefresh if epgrefresh.isrunning: doLog("[AutoTimer] Skip check during EPGRefresh") reactor.callFromThread( timer.startLongTimer, config.plugins.autotimer.interval.value * 3600) continue except: pass from plugin import autotimer # Ignore any program errors try: queue.append(autotimer.parseEPG()) pump.send(0) except Exception: # Dump error to stdout import traceback, sys traceback.print_exc(file=sys.stdout) #Keep that eTimer in the mainThread reactor.callFromThread( timer.startLongTimer, config.plugins.autotimer.interval.value * 3600)
def editorCallback(ret): if ret: from plugin import autotimer if autotimer is None: from AutoTimer import AutoTimer autotimer = AutoTimer() autotimer.readXml() else: autotimer.readXml() autotimer.add(ret) # Save modified xml autotimer.writeXml() autotimer.readXml() autotimer.parseEPG()
def run(self): req = self._req if self._stillAlive: req.setResponseCode(http.OK) req.setHeader('Content-type', 'application/xhtml+xml') req.setHeader('charset', 'UTF-8') reactor.callFromThread(lambda: req.write("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<e2autotimersimulate api_version=\"" + str(API_VERSION) + "\">\n")) def finishRequest(): req.write('</e2autotimersimulate>') req.finish() try: autotimer.parseEPG(simulateOnly=True, callback=self.intermediateWrite) except Exception as e: def finishRequest(): req.write('<exception>'+str(e)+'</exception><|PURPOSEFULLYBROKENXML<') req.finish() if self._stillAlive: reactor.callFromThread(finishRequest)
def query(self): self.timer.stop() from Screens.Standby import inStandby print "[AutoTimer] Auto Poll" if config.plugins.autotimer.onlyinstandby.value and inStandby: print "[AutoTimer] Auto Poll Started" # Ignore any program errors try: ret = autotimer.parseEPG(autoPoll=True) except Exception: # Dump error to stdout import traceback, sys traceback.print_exc(file=sys.stdout) elif not config.plugins.autotimer.onlyinstandby.value: print "[AutoTimer] Auto Poll Started" # Ignore any program errors try: ret = autotimer.parseEPG(autoPoll=True) except Exception: # Dump error to stdout import traceback, sys traceback.print_exc(file=sys.stdout) self.timer.startLongTimer(config.plugins.autotimer.interval.value * 60)
def query(self): self.timer.stop() from Screens.Standby import inStandby print "[AutoTimer] Auto Poll" if config.plugins.autotimer.onlyinstandby.value and inStandby: print "[AutoTimer] Auto Poll Started" # Ignore any program errors try: ret = autotimer.parseEPG(autoPoll = True) except Exception: # Dump error to stdout import traceback, sys traceback.print_exc(file=sys.stdout) elif not config.plugins.autotimer.onlyinstandby.value: print "[AutoTimer] Auto Poll Started" # Ignore any program errors try: ret = autotimer.parseEPG(autoPoll = True) except Exception: # Dump error to stdout import traceback, sys traceback.print_exc(file=sys.stdout) self.timer.startLongTimer(config.plugins.autotimer.interval.value*60)
def run(self): sem = self.__semaphore queue = self.__queue pump = self.__pump timer = self.__timer self.running = True while 1: sem.acquire() # NOTE: we have to check this here and not using the while to prevent the parser to be started on shutdown if not self.running: break if config.plugins.autotimer.skip_during_records.value: try: import NavigationInstance if NavigationInstance.instance.RecordTimer.isRecording(): doLog("[AutoTimer] Skip check during running records") reactor.callFromThread(timer.startLongTimer, config.plugins.autotimer.interval.value*3600) continue except: pass try: if config.plugins.autotimer.onlyinstandby.value and Standby.inStandby is None: doLog("[AutoTimer] Skip check during live tv") reactor.callFromThread(timer.startLongTimer, config.plugins.autotimer.interval.value*3600) continue except: pass if config.plugins.autotimer.skip_during_epgrefresh.value: try: from Plugins.Extensions.EPGRefresh.EPGRefresh import epgrefresh if epgrefresh.isrunning: doLog("[AutoTimer] Skip check during EPGRefresh") reactor.callFromThread(timer.startLongTimer, config.plugins.autotimer.interval.value*3600) continue except: pass from plugin import autotimer # Ignore any program errors try: queue.append(autotimer.parseEPG()) pump.send(0) except Exception: # Dump error to stdout import traceback, sys traceback.print_exc(file=sys.stdout) #Keep that eTimer in the mainThread reactor.callFromThread(timer.startLongTimer, config.plugins.autotimer.interval.value*3600)
def render(self, req): autotimer = self.getAutoTimerInstance() ret = autotimer.parseEPG() output = _("Found a total of %d matching Events.\n%d Timer were added and %d modified.") % (ret[0], ret[1], ret[2]) if self._remove: autotimer.writeXml() result = """<?xml version=\"1.0\" encoding=\"UTF-8\" ?> <e2simplexmlresult> <e2state>true</e2state> <e2statetext>%s</e2statetext> </e2simplexmlresult> """ % (output) req.setResponseCode(http.OK) req.setHeader('Content-type', 'application; xhtml+xml') req.setHeader('charset', 'UTF-8') return result
def query(self): from plugin import autotimer # Ignore any program errors try: ret = autotimer.parseEPG() except Exception: # Dump error to stdout import traceback, sys traceback.print_exc(file=sys.stdout) else: conflicts = ret[4] if conflicts and config.plugins.autotimer.notifconflict.value: AddPopup( _("%d conflict(s) encountered when trying to add new timers:\n%s") % (len(conflicts), '\n'.join([_("%s: %s at %s") % (x[4], x[0], FuzzyTime(x[2])) for x in conflicts])), MessageBox.TYPE_INFO, 5, NOTIFICATIONID ) self.timer.startLongTimer(config.plugins.autotimer.interval.value*3600)
def render(self, req): autotimer = self.getAutoTimerInstance() ret = autotimer.parseEPG() output = _( "Found a total of %d matching Events.\n%d Timer were added and %d modified." ) % (ret[0], ret[1], ret[2]) if self._remove: autotimer.writeXml() result = """<?xml version=\"1.0\" encoding=\"UTF-8\" ?> <e2simplexmlresult> <e2state>true</e2state> <e2statetext>%s</e2statetext> </e2simplexmlresult> """ % (output) req.setResponseCode(http.OK) req.setHeader('Content-type', 'application; xhtml+xml') req.setHeader('charset', 'UTF-8') return result
def query(self): from plugin import autotimer # Ignore any program errors try: ret = autotimer.parseEPG() except Exception: # Dump error to stdout import traceback, sys traceback.print_exc(file=sys.stdout) else: conflicts = ret[4] if conflicts and config.plugins.autotimer.notifconflict.value: AddPopup( _("%d conflict(s) encountered when trying to add new timers:\n%s" ) % (len(conflicts), '\n'.join([ _("%s: %s at %s") % (x[4], x[0], FuzzyTime(x[2])) for x in conflicts ])), MessageBox.TYPE_INFO, 5, NOTIFICATIONID) self.timer.startLongTimer(config.plugins.autotimer.interval.value * 3600)
def run(self): sem = self.__semaphore queue = self.__queue pump = self.__pump timer = self.__timer self.running = True while 1: sem.acquire() # NOTE: we have to check this here and not using the while to prevent the parser to be started on shutdown if not self.running: break from plugin import autotimer # Ignore any program errors try: queue.append(autotimer.parseEPG()) pump.send(0) except Exception: # Dump error to stdout import traceback, sys traceback.print_exc(file=sys.stdout) timer.startLongTimer(config.plugins.autotimer.interval.value*3600)
def renderBackground(self, req): ret = autotimer.parseEPG(simulateOnly=True) returnlist = ["<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<e2autotimersimulate api_version=\"", str(API_VERSION), "\">\n"] extend = returnlist.extend for (name, begin, end, serviceref, autotimername) in ret[3]: ref = ServiceReference(str(serviceref)) extend(( '<e2simulatedtimer>\n' ' <e2servicereference>', stringToXML(serviceref), '</e2servicereference>\n', ' <e2servicename>', stringToXML(ref.getServiceName().replace('\xc2\x86', '').replace('\xc2\x87', '')), '</e2servicename>\n', ' <e2name>', stringToXML(name), '</e2name>\n', ' <e2timebegin>', str(begin), '</e2timebegin>\n', ' <e2timeend>', str(end), '</e2timeend>\n', ' <e2autotimername>', stringToXML(autotimername), '</e2autotimername>\n' '</e2simulatedtimer>\n' )) returnlist.append('</e2autotimersimulate>') req.setResponseCode(http.OK) req.setHeader('Content-type', 'application/xhtml+xml') req.setHeader('charset', 'UTF-8') return ''.join(returnlist)
def run(self): sem = self.__semaphore queue = self.__queue pump = self.__pump timer = self.__timer self.running = True while 1: sem.acquire() # NOTE: we have to check this here and not using the while to prevent the parser to be started on shutdown if not self.running: break from plugin import autotimer # Ignore any program errors try: queue.append(autotimer.parseEPG()) pump.send(0) except Exception: # Dump error to stdout import traceback, sys traceback.print_exc(file=sys.stdout) timer.startLongTimer(config.plugins.autotimer.interval.value * 3600)
def render(self, req): self.req = req # todo timeout / error handling autotimer.parseEPG(simulateOnly=True, callback = self.parsecallback) return server.NOT_DONE_YET
def renderBackground(self, req): ret = autotimer.parseEPG() output = _("Found a total of %d matching Events.\n%d Timer were added and\n%d modified,\n%d conflicts encountered,\n%d similars added.") % (ret[0], ret[1], ret[2], len(ret[4]), len(ret[5])) return self.returnResult(req, True, output)