Exemplo n.º 1
0
	def refresh(self):
		if self.doStopRunningRefresh:
			self.cleanUp()
			return
		
		if self.forcedScan:
			self.nextService()
		else:
			# Abort if a scan finished later than our begin of timespan
			if self.beginOfTimespan < config.plugins.epgrefresh.lastscan.value:
				return
			if config.plugins.epgrefresh.force.value \
				or (Screens.Standby.inStandby and \
					not self.session.nav.RecordTimer.isRecording()):

				self.nextService()
			# We don't follow our rules here - If the Box is still in Standby and not recording we won't reach this line
			else:
				if not checkTimespan(
					config.plugins.epgrefresh.begin.value,
					config.plugins.epgrefresh.end.value):

					print("[EPGRefresh] Gone out of timespan while refreshing, sorry!")
					self.cleanUp()
				else:
					print("[EPGRefresh] Box no longer in Standby or Recording started, rescheduling")

					# Recheck later
					epgrefreshtimer.add(EPGRefreshTimerEntry(
							time() + config.plugins.epgrefresh.delay_standby.value*60,
							self.refresh,
							nocheck = True)
					)
Exemplo n.º 2
0
    def refresh(self):
        if self.forcedScan:
            self.nextService()
        else:
            # Abort if a scan finished later than our begin of timespan
            if self.beginOfTimespan < config.plugins.epgrefresh.lastscan.value:
                return
            if config.plugins.epgrefresh.force.value \
             or (Screens.Standby.inStandby and \
              not self.session.nav.RecordTimer.isRecording()):

                self.nextService()
            # We don't follow our rules here - If the Box is still in Standby and not recording we won't reach this line
            else:
                if not checkTimespan(config.plugins.epgrefresh.begin.value,
                                     config.plugins.epgrefresh.end.value):

                    print(
                        "[EPGRefresh] Gone out of timespan while refreshing, sorry!"
                    )
                    self.cleanUp()
                else:
                    print(
                        "[EPGRefresh] Box no longer in Standby or Recording started, rescheduling"
                    )

                    # Recheck later
                    epgrefreshtimer.add(
                        EPGRefreshTimerEntry(
                            time() +
                            config.plugins.epgrefresh.delay_standby.value * 60,
                            self.refresh,
                            nocheck=True))
Exemplo n.º 3
0
    def nextService(self):
        # Debug
        print("[EPGRefresh] Maybe zap to next service")

        try:
            # Get next reference
            service = self.scanServices.pop(0)
        except IndexError:
            # Debug
            print("[EPGRefresh] Done refreshing EPG")

            # Clean up
            self.cleanUp()
        else:
            # If the current adapter is unable to run in background and we are in fact in background now,
            # fall back to main picture
            if (not self.refreshAdapter.backgroundCapable
                    and Screens.Standby.inStandby):
                print(
                    "[EPGRefresh] Adapter is not able to run in background or not available, falling back to MainPictureAdapter"
                )
                self.maybeStopAdapter()
                self.refreshAdapter = MainPictureAdapter(self.session)
                self.refreshAdapter.prepare()

            # Play next service
            # XXX: we might want to check the return value
            self.refreshAdapter.play(eServiceReference(service.sref))

            # Start Timer
            delay = service.duration or config.plugins.epgrefresh.interval_seconds.value
            epgrefreshtimer.add(
                EPGRefreshTimerEntry(time() + delay,
                                     self.refresh,
                                     nocheck=True))
Exemplo n.º 4
0
	def _onCacheStateChanged(self, cState):
		sref = self.currentServiceRef
		if sref is None:
			print("[EPGRefresh] - got EPG message but no epgrefresh running... ignore")
			return

		if cState.state in (cachestate.load_finished, cachestate.save_finished, cachestate.aborted):
			print("[EPGRefresh] - assuming the state is not relevant for EPGRefresh. State:" + str(cState.state))
			return

		sdata = sref.getUnsignedData
		tsid = sdata(2)
		onid = sdata(3)
		ns = sdata(4)

		if cState.tsid != tsid or cState.onid != onid or cState.dvbnamespace != ns:
			print("[EPGRefresh] - ignored EPG message for wrong transponder %04x:%04x:%08x <> %04x:%04x:%08x" %(cState.tsid, cState.onid, cState.dvbnamespace, tsid, onid, ns))
			return

		print("[EPGRefresh] - state is:" + str(cState.state))

		self.epgTimeoutTimer.stop()
		if cState.state == cachestate.started:
			print("[EPGRefresh] - EPG update started for transponder %04x:%04x:%08x" %(tsid, onid, ns))
		elif cState.state == cachestate.stopped or cState.state == cachestate.deferred:
			print("[EPGRefresh] - EPG update finished for transponder %04x:%04x:%08x" %(tsid, onid, ns))

			if self.refreshAdapter:
				self.refreshAdapter.stop()

			epgrefreshtimer.add(EPGRefreshTimerEntry(
					time(),
					self.refresh,
					nocheck = True)
			)
Exemplo n.º 5
0
    def nextService(self):
        # Debug
        print("[EPGRefresh] Maybe zap to next service")

        try:
            # Get next reference
            service = self.scanServices.pop(0)
        except IndexError:
            # Debug
            print("[EPGRefresh] Done refreshing EPG")

            # Clean up
            self.cleanUp()
        else:
            # If the current adapter is unable to run in background and we are in fact in background now,
            # fall back to main picture
            if not self.refreshAdapter.backgroundCapable and Screens.Standby.inStandby:
                print(
                    "[EPGRefresh] Adapter is not able to run in background or not available, falling back to MainPictureAdapter"
                )
                self.maybeStopAdapter()
                self.refreshAdapter = MainPictureAdapter(self.session)
                self.refreshAdapter.prepare()

                # Play next service
                # XXX: we might want to check the return value
            self.refreshAdapter.play(eServiceReference(service.sref))

            # Start Timer
            delay = service.duration or config.plugins.epgrefresh.interval_seconds.value
            epgrefreshtimer.add(EPGRefreshTimerEntry(time() + delay, self.refresh, nocheck=True))
Exemplo n.º 6
0
	def nextService(self):
		# Debug
		print "[EPGRefresh] Maybe zap to next service"

		try:
			# Get next reference
			service = self.scanServices.pop(0)
		except IndexError:
			# Debug
			print "[EPGRefresh] Done refreshing EPG"

			# Clean up
			self.cleanUp()
		else:
			# Play next service
			# XXX: we might want to check the return value
			self.refreshAdapter.play(eServiceReference(service.sref))

			# Start Timer
			delay = service.duration or config.plugins.epgrefresh.interval.value
			epgrefreshtimer.add(EPGRefreshTimerEntry(
				time() + delay*60,
				self.refresh,
				nocheck = True)
			)
Exemplo n.º 7
0
	def nextService(self):
		# Debug
		print("[EPGRefresh] Maybe zap to next service")

		try:
			# Get next reference
			service = self.scanServices.pop(0)
		except IndexError:
			# Debug
			print("[EPGRefresh] Done refreshing EPG")

			# Clean up
			self.cleanUp()
		else:
			# Play next service
			# XXX: we might want to check the return value
			self.refreshAdapter.play(eServiceReference(service.sref))

			# Start Timer
			delay = service.duration or config.plugins.epgrefresh.interval.value
			epgrefreshtimer.add(EPGRefreshTimerEntry(
				time() + delay*60,
				self.refresh,
				nocheck = True)
			)
Exemplo n.º 8
0
	def _onCacheStateChanged(self, cState):
		sref = self.currentServiceRef
		if sref is None:
			print("[EPGRefresh] - got EPG message but no epgrefresh running... ignore")
			return

		if cState.state in (cachestate.load_finished, cachestate.save_finished, cachestate.aborted):
			print("[EPGRefresh] - assuming the state is not relevant for EPGRefresh. State:" + str(cState.state))
			return

		sdata = sref.getUnsignedData
		tsid = sdata(2)
		onid = sdata(3)
		ns = sdata(4)

		if cState.tsid != tsid or cState.onid != onid or cState.dvbnamespace != ns:
			print("[EPGRefresh] - ignored EPG message for wrong transponder %04x:%04x:%08x <> %04x:%04x:%08x" %(cState.tsid, cState.onid, cState.dvbnamespace, tsid, onid, ns))
			return

		print("[EPGRefresh] - state is:" + str(cState.state))

		self.epgTimeoutTimer.stop()
		if cState.state == cachestate.started:
			print("[EPGRefresh] - EPG update started for transponder %04x:%04x:%08x" %(tsid, onid, ns))
		elif cState.state == cachestate.stopped or cState.state == cachestate.deferred:
			print("[EPGRefresh] - EPG update finished for transponder %04x:%04x:%08x" %(tsid, onid, ns))

			if self.refreshAdapter:
				self.refreshAdapter.stop()

			epgrefreshtimer.add(EPGRefreshTimerEntry(
					time(),
					self.refresh,
					nocheck = True)
			)
    def nextService(self):
        # Debug
        print("[EPGRefresh] Maybe zap to next service")

        try:
            # Get next reference
            service = self.scanServices.pop(0)
        except IndexError:
            # Debug
            print("[EPGRefresh] Done refreshing EPG")

            # Clean up
            self.cleanUp()
        else:
            if self.myEpgCacheInstance is None and config.plugins.epgrefresh.usetimebased.value == False:
                # get eEPGCache instance if None and eEPGCache-signal based is used
                print("[EPGRefresh] - myEpgCacheInstance is None. Get it")
                self.myEpgCacheInstance = eEPGCache.getInstance()
                self.EpgCacheStateChanged_conn = self.myEpgCacheInstance.cacheState.connect(
                    self._onCacheStateChanged)

            if self.isServiceProtected(service):
                if (
                        not self.forcedScan
                ) or config.plugins.epgrefresh.skipProtectedServices.value == "always":
                    print("[EPGRefresh] Service is protected, skipping!")
                    self.refresh()
                    return

            # If the current adapter is unable to run in background and we are in fact in background now,
            # fall back to main picture
            if (not self.refreshAdapter.backgroundCapable
                    and Screens.Standby.inStandby):
                print(
                    "[EPGRefresh] Adapter is not able to run in background or not available, falling back to MainPictureAdapter"
                )
                self.maybeStopAdapter()
                self.refreshAdapter = MainPictureAdapter(self.session)
                self.refreshAdapter.prepare()

            if config.plugins.epgrefresh.usetimebased.value == False:
                # set timeout timer for eEPGCache-signal based refresh
                self.epgTimeoutTimer.start(5000, True)
            # Play next service
            # XXX: we might want to check the return value
            self.currentServiceRef = eServiceReference(service.sref)
            self.refreshAdapter.play(self.currentServiceRef)
            ref = ServiceReference(service.sref)
            channelname = ref.getServiceName().replace('\xc2\x86', '').replace(
                '\xc2\x87', '')
            print("[EPGRefresh] - Service is: %s" % (str(channelname)))

            if config.plugins.epgrefresh.usetimebased.value:
                # Start Timer
                delay = service.duration or config.plugins.epgrefresh.interval_seconds.value
                epgrefreshtimer.add(
                    EPGRefreshTimerEntry(time() + delay,
                                         self.refresh,
                                         nocheck=True))
Exemplo n.º 10
0
 def epgTimeout(self):
     if eDVBSatelliteEquipmentControl.getInstance().isRotorMoving():
         # rotor is moving, timeout raised too early...check again in 5 seconds
         self.epgTimeoutTimer.start(5000, True)
     else:
         # epgcache-signal is not responding...maybe service/transponder is already running or cache was already updated...? step to next entry
         print(
             "[EPGRefresh] - finished channel without epg update. Reason: epgTimeout"
         )
         epgrefreshtimer.add(
             EPGRefreshTimerEntry(time(), self.refresh, nocheck=True))
Exemplo n.º 11
0
	def epgTimeout(self):
		if eDVBSatelliteEquipmentControl.getInstance().isRotorMoving():
			# rotor is moving, timeout raised too early...check again in 5 seconds
			self.epgTimeoutTimer.start(5000, True)
		else:
			# epgcache-signal is not responding...maybe service/transponder is already running or cache was already updated...? step to next entry
			print("[EPGRefresh] - finished channel without epg update. Reason: epgTimeout")
			epgrefreshtimer.add(EPGRefreshTimerEntry(
					time(),
					self.refresh,
					nocheck = True)
			)
Exemplo n.º 12
0
	def nextService(self):
		# Debug
		print("[EPGRefresh] Maybe zap to next service")

		try:
			# Get next reference
			service = self.scanServices.pop(0)
		except IndexError:
			# Debug
			print("[EPGRefresh] Done refreshing EPG")

			# Clean up
			self.cleanUp()
		else:
			if self.myEpgCacheInstance is None and config.plugins.epgrefresh.usetimebased.value == False:
				# get eEPGCache instance if None and eEPGCache-signal based is used
				print("[EPGRefresh] - myEpgCacheInstance is None. Get it")
				self.myEpgCacheInstance = eEPGCache.getInstance()
				self.EpgCacheStateChanged_conn = self.myEpgCacheInstance.cacheState.connect(self._onCacheStateChanged)

			if self.isServiceProtected(service):
				if (not self.forcedScan) or config.plugins.epgrefresh.skipProtectedServices.value == "always":
					print("[EPGRefresh] Service is protected, skipping!")
					self.refresh()
					return
			
			# If the current adapter is unable to run in background and we are in fact in background now,
			# fall back to main picture
			if (not self.refreshAdapter.backgroundCapable and Screens.Standby.inStandby):
				print("[EPGRefresh] Adapter is not able to run in background or not available, falling back to MainPictureAdapter")
				self.maybeStopAdapter()
				self.refreshAdapter = MainPictureAdapter(self.session)
				self.refreshAdapter.prepare()

			if config.plugins.epgrefresh.usetimebased.value == False:
				# set timeout timer for eEPGCache-signal based refresh
				self.epgTimeoutTimer.start(5000, True)
			# Play next service
			# XXX: we might want to check the return value
			self.currentServiceRef = eServiceReference(service.sref)
			self.refreshAdapter.play(self.currentServiceRef)
			ref = ServiceReference(service.sref)
			channelname = ref.getServiceName().replace('\xc2\x86', '').replace('\xc2\x87', '')
			print("[EPGRefresh] - Service is: %s" %(str(channelname)))
					
			if config.plugins.epgrefresh.usetimebased.value:
				# Start Timer
				delay = service.duration or config.plugins.epgrefresh.interval_seconds.value
				epgrefreshtimer.add(EPGRefreshTimerEntry(
					time() + delay,
					self.refresh,
					nocheck = True)
				)
Exemplo n.º 13
0
    def refresh(self):
        if self.wait.isActive():
            self.wait.stop()
        if self.forcedScan:
            self.nextService()
        else:
            if self.beginOfTimespan < config.plugins.epgrefresh.lastscan.value:
                if not self.wait.isActive():
                    self.isrunning = False
                return
            check_standby = False
            stop_service = False
            if Screens.Standby.inStandby:
                check_standby = True
            if not config.plugins.epgrefresh.force.value and check_standby:
                rec_time = self.session.nav.RecordTimer.getNextRecordingTime()
                interval = config.plugins.epgrefresh.interval_seconds.value
                if interval <= 20:
                    interval = 25
                if rec_time > 0 and (rec_time - time()) <= interval:
                    stop_service = True
            if config.plugins.epgrefresh.force.value or (
                    check_standby
                    and not self.session.nav.RecordTimer.isRecording()
                    and not stop_service):
                self.nextService()
            else:
                if not checkTimespan(config.plugins.epgrefresh.begin.value,
                                     config.plugins.epgrefresh.end.value):

                    print(
                        "[EPGRefresh] Gone out of timespan while refreshing, sorry!"
                    )
                    self.cleanUp()
                else:
                    print(
                        "[EPGRefresh] Box no longer in Standby or Recording started, rescheduling"
                    )
                    if check_standby and config.plugins.epgrefresh.adapter.value == "main":
                        self.session.nav.stopService()
                    epgrefreshtimer.add(
                        EPGRefreshTimerEntry(
                            time() +
                            config.plugins.epgrefresh.delay_standby.value * 60,
                            self.refresh,
                            nocheck=True))
Exemplo n.º 14
0
	def refresh(self):
		if self.wait.isActive():
			self.wait.stop()
		if self.forcedScan:
			self.nextService()
		else:
			if self.beginOfTimespan < config.plugins.epgrefresh.lastscan.value:
				if not self.wait.isActive():
					self.isrunning = False
				return
			check_standby = False
			stop_service = False
			if Screens.Standby.inStandby:
				check_standby = True
			if not config.plugins.epgrefresh.force.value and check_standby:
				rec_time = self.session.nav.RecordTimer.getNextRecordingTime()
				interval = config.plugins.epgrefresh.interval_seconds.value
				if interval <= 20:
					interval = 25
				if rec_time > 0 and (rec_time - time()) <= interval:
					stop_service = True
			if config.plugins.epgrefresh.force.value or (check_standby and not self.session.nav.RecordTimer.isRecording() and not stop_service):
				self.nextService()
			else:
				if not checkTimespan(
					config.plugins.epgrefresh.begin.value,
					config.plugins.epgrefresh.end.value):

					print("[EPGRefresh] Gone out of timespan while refreshing, sorry!")
					self.cleanUp()
				else:
					print("[EPGRefresh] Box no longer in Standby or Recording started, rescheduling")
					if check_standby and config.plugins.epgrefresh.adapter.value == "main":
						self.session.nav.stopService()
					epgrefreshtimer.add(EPGRefreshTimerEntry(
							time() + config.plugins.epgrefresh.delay_standby.value*60,
							self.refresh,
							nocheck = True)
					)
Exemplo n.º 15
0
	def nextService(self):
		# Debug
		print "[EPGRefresh] Maybe zap to next service"

		try:
			# Get next reference
			service = self.scanServices.pop(0)
		except IndexError:
			# Debug
			print "[EPGRefresh] Done refreshing EPG"

			# Clean up
			self.cleanUp()
		else:
			# Play next service
			self.session.nav.playService(eServiceReference(service.sref))

			# Start Timer
			delay = service.duration or config.plugins.epgrefresh.interval.value
			epgrefreshtimer.add(EPGRefreshTimerEntry(
				time() + delay*60,
				self.refresh,
				nocheck = True)
			)
Exemplo n.º 16
0
	def createWaitTimer(self):
		self.beginOfTimespan = time()
		epgrefreshtimer.add(EPGRefreshTimerEntry(time() + 30, self.prepareRefresh))
Exemplo n.º 17
0
    def createWaitTimer(self):
        self.beginOfTimespan = time()

        # Add wait timer to epgrefreshtimer
        epgrefreshtimer.add(
            EPGRefreshTimerEntry(time() + 30, self.prepareRefresh))