Example #1
0
	def __init__(self, nextRecordTimerAfterEventActionAuto=False):
		if NavigationInstance.instance is not None:
			raise NavigationInstance.instance

		NavigationInstance.instance = self
		self.ServiceHandler = eServiceCenter.getInstance()

		import Navigation as Nav
		Nav.navcore = self

		self.pnav = pNavigation()
		self.pnav.m_event.get().append(self.dispatchEvent)
		self.pnav.m_record_event.get().append(self.dispatchRecordEvent)
		self.event = [ ]
		self.record_event = [ ]
		self.currentlyPlayingServiceReference = None
		self.currentlyPlayingServiceOrGroup = None
		self.currentlyPlayingService = None
		self.RecordTimer = RecordTimer.RecordTimer()
		if getFPWasTimerWakeup():
			if nextRecordTimerAfterEventActionAuto:
				# We need to give the systemclock the chance to sync with the transponder time,
				# before we will make the decision about whether or not we need to shutdown
				# after the upcoming recording has completed
				self.recordshutdowntimer = eTimer()
				self.recordshutdowntimer.callback.append(self.checkShutdownAfterRecording)
				self.recordshutdowntimer.start(30000, True)
		self.SleepTimer = SleepTimer.SleepTimer()
Example #2
0
	def __init__(self):
		if NavigationInstance.instance is not None:
			raise NavigationInstance.instance

		NavigationInstance.instance = self
		self.ServiceHandler = eServiceCenter.getInstance()

		import Navigation as Nav
		Nav.navcore = self

		self.pnav = pNavigation()
		self.pnav.m_event.get().append(self.dispatchEvent)
		self.pnav.m_record_event.get().append(self.dispatchRecordEvent)
		self.event = [ ]
		self.record_event = [ ]
		self.currentlyPlayingServiceReference = None
		self.currentlyPlayingServiceOrGroup = None
		self.currentlyPlayingService = None
		self.RecordTimer = RecordTimer.RecordTimer()
		self.__wasTimerWakeup = getFPWasTimerWakeup()
		startup_to_standby = config.usage.startup_to_standby.value
		wakeup_time_type = config.misc.prev_wakeup_time_type.value
		if self.__wasTimerWakeup:
			RecordTimer.RecordTimerEntry.setWasInDeepStandby()
		if config.misc.RestartUI.value:
			config.misc.RestartUI.value = False
			config.misc.RestartUI.save()
			configfile.save()
		elif startup_to_standby == "yes" or self.__wasTimerWakeup and config.misc.prev_wakeup_time.value and ((wakeup_time_type == 0 or wakeup_time_type == 1) or ( wakeup_time_type == 3 and startup_to_standby == "except")):
			if not Screens.Standby.inTryQuitMainloop:
				Notifications.AddNotification(Screens.Standby.Standby)
		if config.misc.prev_wakeup_time.value:
			config.misc.prev_wakeup_time.value = 0
			config.misc.prev_wakeup_time.save()
			configfile.save()
Example #3
0
    def __init__(self, nextRecordTimerAfterEventActionAuto=False):
        if NavigationInstance.instance is not None:
            raise NavigationInstance.instance

        NavigationInstance.instance = self
        self.ServiceHandler = eServiceCenter.getInstance()

        import Navigation as Nav
        Nav.navcore = self

        self.pnav = pNavigation()
        self.pnav.m_event.get().append(self.dispatchEvent)
        self.pnav.m_record_event.get().append(self.dispatchRecordEvent)
        self.event = []
        self.record_event = []
        self.currentlyPlayingServiceReference = None
        self.currentlyPlayingService = None
        self.RecordTimer = RecordTimer.RecordTimer()
        if getFPWasTimerWakeup():
            if nextRecordTimerAfterEventActionAuto:
                # We need to give the systemclock the chance to sync with the transponder time,
                # before we will make the decision about whether or not we need to shutdown
                # after the upcoming recording has completed
                self.recordshutdowntimer = eTimer()
                self.recordshutdowntimer.callback.append(
                    self.checkShutdownAfterRecording)
                self.recordshutdowntimer.start(30000, True)
        self.SleepTimer = SleepTimer.SleepTimer()
Example #4
0
	def __init__(self, nextRecordTimerAfterEventActionAuto=False):
		if NavigationInstance.instance is not None:
			raise NavigationInstance.instance
		
		NavigationInstance.instance = self
		self.ServiceHandler = eServiceCenter.getInstance()
		
		import Navigation as Nav
		Nav.navcore = self
		
		self.pnav = pNavigation()
		self.pnav.m_event.get().append(self.dispatchEvent)
		self.pnav.m_record_event.get().append(self.dispatchRecordEvent)
		self.event = [ ]
		self.record_event = [ ]
		self.currentlyPlayingServiceReference = None
		self.currentlyPlayingService = None
		self.RecordTimer = RecordTimer.RecordTimer()
		if getFPWasTimerWakeup():
			clearFPWasTimerWakeup()
			if getFPWasTimerWakeup(): # sanity check to detect if the FP driver is working correct!
				print "buggy fp driver detected!!! please update drivers.... ignore timer wakeup!"
			elif nextRecordTimerAfterEventActionAuto and (len(self.getRecordings()) or abs(self.RecordTimer.getNextRecordingTime() - time()) <= 360):
				if not Screens.Standby.inTryQuitMainloop: # not a shutdown messagebox is open
					RecordTimer.RecordTimerEntry.TryQuitMainloop(False) # start shutdown handling
		self.SleepTimer = SleepTimer.SleepTimer()
Example #5
0
	def __init__(self, nextRecordTimerAfterEventActionAuto=False):
		from Screens.ChannelSelection import ChannelSelection
		if NavigationInstance.instance is not None:
			raise NavigationInstance.instance
		
		NavigationInstance.instance = self
		self.ServiceHandler = eServiceCenter.getInstance()
		
		import Navigation as Nav
		Nav.navcore = self
		
		self.pnav = pNavigation()
		self.nav_event_conn = self.pnav.m_event.connect(self.dispatchEvent)
		self.nav_record_event_conn = self.pnav.m_record_event.connect(self.dispatchRecordEvent)
		self.event = [ ]
		self.record_event = [ ]
		self.currentlyPlayingServiceReference = None
		self.currentlyPlayingService = None
		self.immediatePlay = False
		self.RecordTimer = RecordTimer.RecordTimer()
		self.__wasTimerWakeup = False
		if getFPWasTimerWakeup():
			clearFPWasTimerWakeup()
			if getFPWasTimerWakeup(): # sanity check to detect if the FP driver is working correct!
				print "buggy fp driver detected!!! please update drivers.... ignore timer wakeup!"
			else:
				self.__wasTimerWakeup = True
				if config.misc.prev_wakeup_time.value and config.misc.prev_wakeup_time_type.value == 0:
					if not Screens.Standby.inTryQuitMainloop: # not a shutdown messagebox is open
						Notifications.AddNotificationWithID("Standby", Screens.Standby.Standby, domain="RecordTimer")
		self.SleepTimer = SleepTimer.SleepTimer()
		self.scheduledServiceReference = None
		ChannelSelection.initialized.addNotifier(self.serviceListInitialized, initial_call = True)
Example #6
0
	def __init__(self, nextRecordTimerAfterEventActionAuto=False):
		if NavigationInstance.instance is not None:
			raise NavigationInstance.instance
		
		NavigationInstance.instance = self
		self.ServiceHandler = eServiceCenter.getInstance()
		
		import Navigation as Nav
		Nav.navcore = self
		
		self.pnav = pNavigation()
		self.nav_event_conn = self.pnav.m_event.connect(self.dispatchEvent)
		self.nav_record_event_conn = self.pnav.m_record_event.connect(self.dispatchRecordEvent)
		self.event = [ ]
		self.record_event = [ ]
		self.currentlyPlayingServiceReference = None
		self.currentlyPlayingService = None
		self.RecordTimer = RecordTimer.RecordTimer()
		self.__wasTimerWakeup = False
		if getFPWasTimerWakeup():
			clearFPWasTimerWakeup()
			if getFPWasTimerWakeup(): # sanity check to detect if the FP driver is working correct!
				print "buggy fp driver detected!!! please update drivers.... ignore timer wakeup!"
			else:
				self.__wasTimerWakeup = True
				if config.misc.prev_wakeup_time.value and config.misc.prev_wakeup_time_type.value == 0:
					if not Screens.Standby.inTryQuitMainloop: # not a shutdown messagebox is open
						Notifications.AddNotificationWithID("Standby", Screens.Standby.Standby, domain="RecordTimer")
		self.SleepTimer = SleepTimer.SleepTimer()
Example #7
0
	def __init__(self):
		if NavigationInstance.instance is not None:
			raise NavigationInstance.instance

		NavigationInstance.instance = self
		self.ServiceHandler = eServiceCenter.getInstance()

		import Navigation as Nav
		Nav.navcore = self

		self.pnav = pNavigation()
		self.pnav.m_event.get().append(self.dispatchEvent)
		self.pnav.m_record_event.get().append(self.dispatchRecordEvent)
		self.event = [ ]
		self.record_event = [ ]
		self.currentlyPlayingServiceReference = None
		self.currentlyPlayingServiceOrGroup = None
		self.currentlyPlayingService = None
		self.RecordTimer = RecordTimer.RecordTimer()
		self.__wasTimerWakeup = getFPWasTimerWakeup()
		if self.__wasTimerWakeup:
			RecordTimer.RecordTimerEntry.setWasInDeepStandby()
		if config.misc.RestartUI.value:
			config.misc.RestartUI.value = False
			config.misc.RestartUI.save()
			configfile.save()
		elif config.usage.startup_to_standby.value or self.__wasTimerWakeup:
			Notifications.AddNotification(Screens.Standby.Standby)
	def __init__(self):
		if NavigationInstance.instance is not None:
			raise NavigationInstance.instance

		NavigationInstance.instance = self
		self.ServiceHandler = eServiceCenter.getInstance()

		import Navigation as Nav
		Nav.navcore = self

		self.pnav = pNavigation()
		self.pnav.m_event.get().append(self.dispatchEvent)
		self.pnav.m_record_event.get().append(self.dispatchRecordEvent)
		self.event = [ ]
		self.record_event = [ ]
		self.currentlyPlayingServiceReference = None
		self.currentlyPlayingServiceOrGroup = None
		self.currentlyPlayingService = None
		self.RecordTimer = RecordTimer.RecordTimer()
		self.__wasTimerWakeup = getFPWasTimerWakeup()
		startup_to_standby = config.usage.startup_to_standby.value
		wakeup_time_type = config.misc.prev_wakeup_time_type.value
		if self.__wasTimerWakeup:
			RecordTimer.RecordTimerEntry.setWasInDeepStandby()
		if config.misc.RestartUI.value:
			config.misc.RestartUI.value = False
			config.misc.RestartUI.save()
			configfile.save()
		elif startup_to_standby == "yes" or self.__wasTimerWakeup and config.misc.prev_wakeup_time.value and ((wakeup_time_type == 0 or wakeup_time_type == 1) or ( wakeup_time_type == 3 and startup_to_standby == "except")):
			if not Screens.Standby.inTryQuitMainloop:
				Notifications.AddNotification(Screens.Standby.Standby)
		if config.misc.prev_wakeup_time.value:
			config.misc.prev_wakeup_time.value = 0
			config.misc.prev_wakeup_time.save()
			configfile.save()
Example #9
0
    def __init__(self,
                 nextRecordTimerAfterEventActionAuto=False,
                 nextPowerManagerAfterEventActionAuto=False):
        if NavigationInstance.instance is not None:
            raise NavigationInstance.instance

        NavigationInstance.instance = self
        self.ServiceHandler = eServiceCenter.getInstance()

        import Navigation as Nav
        Nav.navcore = self

        self.pnav = pNavigation()
        self.pnav.m_event.get().append(self.dispatchEvent)
        self.pnav.m_record_event.get().append(self.dispatchRecordEvent)
        self.event = []
        self.record_event = []
        self.currentlyPlayingServiceReference = None
        self.currentlyPlayingServiceOrGroup = None
        self.currentlyPlayingService = None
        self.RecordTimer = RecordTimer.RecordTimer()
        self.PowerTimer = PowerTimer.PowerTimer()
        self.__wasTimerWakeup = False
        self.__nextRecordTimerAfterEventActionAuto = nextRecordTimerAfterEventActionAuto
        self.__nextPowerManagerAfterEventActionAuto = nextPowerManagerAfterEventActionAuto
        if getFPWasTimerWakeup():
            self.__wasTimerWakeup = True
            self._processTimerWakeup()
Example #10
0
	def __init__(self, nextRecordTimerAfterEventActionAuto=False, nextPowerManagerAfterEventActionAuto=False):
		if NavigationInstance.instance is not None:
			raise NavigationInstance.instance

		NavigationInstance.instance = self
		self.ServiceHandler = eServiceCenter.getInstance()

		import Navigation as Nav
		Nav.navcore = self

		self.pnav = pNavigation()
		self.pnav.m_event.get().append(self.dispatchEvent)
		self.pnav.m_record_event.get().append(self.dispatchRecordEvent)
		self.event = [ ]
		self.record_event = [ ]
		self.currentlyPlayingServiceReference = None
		self.currentlyPlayingServiceOrGroup = None
		self.currentlyPlayingService = None
		self.RecordTimer = RecordTimer.RecordTimer()
		self.PowerTimer = PowerTimer.PowerTimer()
		self.__wasTimerWakeup = False
		self.__nextRecordTimerAfterEventActionAuto = nextRecordTimerAfterEventActionAuto
		self.__nextPowerManagerAfterEventActionAuto = nextPowerManagerAfterEventActionAuto
		if getFPWasTimerWakeup():
			self.__wasTimerWakeup = True
			self._processTimerWakeup()
Example #11
0
	def __init__(self):
		if NavigationInstance.instance is not None:
			raise NavigationInstance.instance

		NavigationInstance.instance = self
		self.ServiceHandler = eServiceCenter.getInstance()

		import Navigation as Nav
		Nav.navcore = self

		self.pnav = pNavigation()
		self.pnav.m_event.get().append(self.dispatchEvent)
		self.pnav.m_record_event.get().append(self.dispatchRecordEvent)
		self.event = [ ]
		self.record_event = [ ]
		self.currentlyPlayingServiceReference = None
		self.currentlyPlayingServiceOrGroup = None
		self.currentlyPlayingService = None
		self.RecordTimer = RecordTimer.RecordTimer()
		self.__wasTimerWakeup = getFPWasTimerWakeup()
		if self.__wasTimerWakeup:
			RecordTimer.RecordTimerEntry.setWasInDeepStandby()
		if config.misc.RestartUI.value:
			config.misc.RestartUI.value = False
			config.misc.RestartUI.save()
			configfile.save()
		elif config.usage.startup_to_standby.value or self.__wasTimerWakeup:
			Notifications.AddNotification(Screens.Standby.Standby)
    def __init__(self,
                 nextRecordTimerAfterEventActionAuto=False,
                 nextPowerManagerAfterEventActionAuto=False):
        if NavigationInstance.instance is not None:
            raise NavigationInstance.instance

        NavigationInstance.instance = self
        self.ServiceHandler = eServiceCenter.getInstance()

        import Navigation as Nav
        Nav.navcore = self

        self.pnav = pNavigation()
        self.pnav.m_event.get().append(self.dispatchEvent)
        self.pnav.m_record_event.get().append(self.dispatchRecordEvent)
        self.event = []
        self.record_event = []
        self.currentlyPlayingServiceReference = None
        self.currentlyPlayingServiceOrGroup = None
        self.currentlyPlayingService = None
        self.RecordTimer = RecordTimer.RecordTimer()
        self.PowerTimer = PowerTimer.PowerTimer()
        self.__wasTimerWakeup = False
        self.__nextRecordTimerAfterEventActionAuto = nextRecordTimerAfterEventActionAuto
        self.__nextPowerManagerAfterEventActionAuto = nextPowerManagerAfterEventActionAuto
        if getFPWasTimerWakeup():
            self.__wasTimerWakeup = True
            self._processTimerWakeup()

        self.__isRestartUI = config.misc.RestartUI.value
        startup_to_standby = config.usage.startup_to_standby.value
        wakeup_time_type = config.misc.prev_wakeup_time_type.value
        wakeup_timer_enabled = False
        if config.usage.remote_fallback_import_restart.value:
            ImportChannels()
        if self.__wasTimerWakeup:
            wakeup_timer_enabled = wakeup_time_type == 3 and config.misc.prev_wakeup_time.value
            if not wakeup_timer_enabled:
                RecordTimer.RecordTimerEntry.setWasInDeepStandby()
        if config.misc.RestartUI.value:
            config.misc.RestartUI.value = False
            config.misc.RestartUI.save()
            configfile.save()
        else:
            if config.usage.remote_fallback_import.value and not config.usage.remote_fallback_import_restart.value:
                ImportChannels()
            if startup_to_standby == "yes" or self.__wasTimerWakeup and config.misc.prev_wakeup_time.value and (
                    wakeup_time_type == 0 or wakeup_time_type == 1 or
                (wakeup_time_type == 3 and startup_to_standby == "except")):
                if not Screens.Standby.inTryQuitMainloop:
                    Notifications.AddNotification(
                        Screens.Standby.Standby, wakeup_timer_enabled and 1
                        or True)
        if config.misc.prev_wakeup_time.value:
            config.misc.prev_wakeup_time.value = 0
            config.misc.prev_wakeup_time.save()
            configfile.save()
Example #13
0
    def __init__(self,
                 nextRecordTimerAfterEventActionAuto=False,
                 nextPowerManagerAfterEventActionAuto=False):
        if NavigationInstance.instance is not None:
            raise NavigationInstance.instance

        NavigationInstance.instance = self
        self.ServiceHandler = eServiceCenter.getInstance()

        import Navigation as Nav
        Nav.navcore = self

        self.pnav = pNavigation()
        self.pnav.m_event.get().append(self.dispatchEvent)
        self.pnav.m_record_event.get().append(self.dispatchRecordEvent)
        self.event = []
        self.record_event = []
        self.currentlyPlayingServiceReference = None
        self.currentlyPlayingServiceOrGroup = None
        self.currentlyPlayingService = None
        self.RecordTimer = RecordTimer.RecordTimer()
        self.PowerTimer = PowerTimer.PowerTimer()
        self.__wasTimerWakeup = False
        self.__wasRecTimerWakeup = False
        self.__wasPowerTimerWakeup = False
        if getFPWasTimerWakeup():
            self.__wasTimerWakeup = True
            if nextRecordTimerAfterEventActionAuto and abs(
                    self.RecordTimer.getNextRecordingTime() - time()) <= 360:
                self.__wasRecTimerWakeup = True
                print 'RECTIMER: wakeup to standby detected.'
                f = open("/tmp/was_rectimer_wakeup", "w")
                f.write('1')
                f.close()
                # as we woke the box to record, place the box in standby.
                self.standbytimer = eTimer()
                self.standbytimer.callback.append(self.gotostandby)
                self.standbytimer.start(15000, True)

            elif nextPowerManagerAfterEventActionAuto:
                self.__wasPowerTimerWakeup = True
                print 'POWERTIMER: wakeup to standby detected.'
                f = open("/tmp/was_powertimer_wakeup", "w")
                f.write('1')
                f.close()
                # as a PowerTimer WakeToStandby was actiond to it.
                self.standbytimer = eTimer()
                self.standbytimer.callback.append(self.gotostandby)
                self.standbytimer.start(15000, True)
Example #14
0
	def __init__(self, nextRecordTimerAfterEventActionAuto=False, nextPowerManagerAfterEventActionAuto=False):
		print 'nextRecordTimerAfterEventActionAuto',nextRecordTimerAfterEventActionAuto
		print 'nextPowerManagerAfterEventActionAuto',nextPowerManagerAfterEventActionAuto
		if NavigationInstance.instance is not None:
			raise NavigationInstance.instance

		NavigationInstance.instance = self
		self.ServiceHandler = eServiceCenter.getInstance()

		import Navigation as Nav
		Nav.navcore = self

		self.pnav = pNavigation()
		self.pnav.m_event.get().append(self.dispatchEvent)
		self.pnav.m_record_event.get().append(self.dispatchRecordEvent)
		self.event = [ ]
		self.record_event = [ ]
		self.currentlyPlayingServiceReference = None
		self.currentlyPlayingServiceOrGroup = None
		self.currentlyPlayingService = None
		self.RecordTimer = RecordTimer.RecordTimer()
		self.PowerTimer = PowerTimer.PowerTimer()
		if getFPWasTimerWakeup():
			if nextRecordTimerAfterEventActionAuto:
				print 'RECTIMER: wakeup to standby detected.'
				open("/tmp/was_rectimer_wakeup", "w").write('1')
				# We need to give the systemclock the chance to sync with the transponder time,
				# before we will make the decision about whether or not we need to shutdown
				# after the upcoming recording has completed
# 				self.recordshutdowntimer = eTimer()
# 				self.recordshutdowntimer.callback.append(self.checkShutdownAfterRecording)
# 				self.recordshutdowntimer.start(15000, True)
				rec_time = self.RecordTimer.getNextRecordingTime()
				if rec_time > 0 and (rec_time - time()) < 300:
					print "another recording starts in", rec_time - time(), "seconds... goto standby"
					# as we woke the box to record, place the box in standby.
					self.standbytimer = eTimer()
					self.standbytimer.callback.append(self.gotostandby)
					self.standbytimer.start(15000, True)

			elif nextPowerManagerAfterEventActionAuto:
				print 'POWERTIMER: wakeup to standby detected.'
				open("/tmp/was_powertimer_wakeup", "w").write('1')
				# We need to give the system the chance to fully startup,
				# before we initiate the standby command.
				self.standbytimer = eTimer()
				self.standbytimer.callback.append(self.gotostandby)
				self.standbytimer.start(15000, True)
		self.SleepTimer = SleepTimer.SleepTimer()
	def __init__(self, nextRecordTimerAfterEventActionAuto=False, nextPowerManagerAfterEventActionAuto=False):
		if NavigationInstance.instance is not None:
			raise NavigationInstance.instance

		NavigationInstance.instance = self
		self.ServiceHandler = eServiceCenter.getInstance()

		import Navigation as Nav
		Nav.navcore = self

		self.pnav = pNavigation()
		self.pnav.m_event.get().append(self.dispatchEvent)
		self.pnav.m_record_event.get().append(self.dispatchRecordEvent)
		self.event = [ ]
		self.record_event = [ ]
		self.currentlyPlayingServiceReference = None
		self.currentlyPlayingServiceOrGroup = None
		self.currentlyPlayingService = None
		self.RecordTimer = RecordTimer.RecordTimer()
		self.PowerTimer = PowerTimer.PowerTimer()
		self.__wasTimerWakeup = False
		self.__wasRecTimerWakeup = False
		self.__wasPowerTimerWakeup = False
		if getFPWasTimerWakeup():
			self.__wasTimerWakeup = True
			if nextRecordTimerAfterEventActionAuto and abs(self.RecordTimer.getNextRecordingTime() - time()) <= 360:
				self.__wasRecTimerWakeup = True
				print 'RECTIMER: wakeup to standby detected.'
				f = open("/tmp/was_rectimer_wakeup", "w")
				f.write('1')
				f.close()
				# as we woke the box to record, place the box in standby.
				self.standbytimer = eTimer()
				self.standbytimer.callback.append(self.gotostandby)
				self.standbytimer.start(15000, True)

			elif nextPowerManagerAfterEventActionAuto:
				self.__wasPowerTimerWakeup = True
				print 'POWERTIMER: wakeup to standby detected.'
				f = open("/tmp/was_powertimer_wakeup", "w")
				f.write('1')
				f.close()
				# as a PowerTimer WakeToStandby was actiond to it.
				self.standbytimer = eTimer()
				self.standbytimer.callback.append(self.gotostandby)
				self.standbytimer.start(15000, True)
    def __init__(self):
        if NavigationInstance.instance is not None:
            raise NavigationInstance.instance

        NavigationInstance.instance = self
        self.ServiceHandler = eServiceCenter.getInstance()

        import Navigation as Nav
        Nav.navcore = self

        self.pnav = pNavigation()
        self.pnav.m_event.get().append(self.dispatchEvent)
        self.pnav.m_record_event.get().append(self.dispatchRecordEvent)
        self.event = []
        self.record_event = []
        self.currentlyPlayingServiceReference = None
        self.currentlyPlayingServiceOrGroup = None
        self.currentlyPlayingService = None
        self.RecordTimer = RecordTimer.RecordTimer()
        self.__wasTimerWakeup = getFPWasTimerWakeup()
        if self.__wasTimerWakeup:
            RecordTimer.RecordTimerEntry.setWasInDeepStandby()
Example #17
0
	def __init__(self):
		if NavigationInstance.instance is not None:
			raise NavigationInstance.instance

		NavigationInstance.instance = self
		self.ServiceHandler = eServiceCenter.getInstance()

		import Navigation as Nav
		Nav.navcore = self

		self.pnav = pNavigation()
		self.pnav.m_event.get().append(self.dispatchEvent)
		self.pnav.m_record_event.get().append(self.dispatchRecordEvent)
		self.event = [ ]
		self.record_event = [ ]
		self.currentlyPlayingServiceReference = None
		self.currentlyPlayingServiceOrGroup = None
		self.currentlyPlayingService = None
		self.RecordTimer = RecordTimer.RecordTimer()
		self.__wasTimerWakeup = getFPWasTimerWakeup()
		if self.__wasTimerWakeup:
			RecordTimer.RecordTimerEntry.setWasInDeepStandby()
Example #18
0
	def __init__(self, wakeupData=None):
		if NavigationInstance.instance is not None:
			raise NavigationInstance.instance

		NavigationInstance.instance = self
		self.ServiceHandler = eServiceCenter.getInstance()

		import Navigation as Nav
		Nav.navcore = self

		self.pnav = pNavigation()
		self.pnav.m_event.get().append(self.dispatchEvent)
		self.pnav.m_record_event.get().append(self.dispatchRecordEvent)
		self.event = [ ]
		self.record_event = [ ]
		self.currentlyPlayingServiceReference = None
		self.currentlyPlayingServiceOrGroup = None
		self.currentlyPlayingService = None

		self.RecordTimer = None
		self.isRecordTimerImageStandard = False
		for p in plugins.getPlugins(PluginDescriptor.WHERE_RECORDTIMER):
			self.RecordTimer = p()
			if self.RecordTimer:
				break
		if not self.RecordTimer:
			self.RecordTimer = RecordTimer.RecordTimer()
			self.isRecordTimerImageStandard = True

		self.PowerTimer = None
		self.PowerTimer = PowerTimer.PowerTimer()
		self.__wasTimerWakeup = False
		self.__wasRecTimerWakeup = False
		self.__wasPowerTimerWakeup = False

		#wakeup data
		try:
			self.wakeuptime, self.timertime, self.wakeuptyp, self.getstandby, self.recordtime, self.forcerecord = [int(n) for n in wakeupData.split(',')]
		except:
			print "="*100
			print "[NAVIGATION] ERROR: can't read wakeup data"
			self.wakeuptime, self.timertime, self.wakeuptyp, self.getstandby, self.recordtime, self.forcerecord = -1,-1,0,0,-1,0
		#print ctime(self.wakeuptime), ctime(self.timertime), self.wakeuptyp, self.getstandby, ctime(self.recordtime), self.forcerecord
		now = time()
		self.wakeupwindow_plus = self.timertime + 300
		self.wakeupwindow_minus = self.wakeuptime - (config.workaround.wakeupwindow.value * 60)
		self.syncCount = 0

		wasTimerWakeup, wasTimerWakeup_failure = getFPWasTimerWakeup(True)
		#TODO: verify wakeup-state for boxes where only after shutdown removed the wakeup-state (for boxes where "/proc/stb/fp/was_timer_wakeup" is not writable (clearFPWasTimerWakeup() in StbHardware.py has no effect -> after x hours and restart/reboot is wasTimerWakeup = True)

		print "="*100
		if self.wakeuptime > 0: 
			print "[NAVIGATION] wakeup time from deep-standby expected: *** %s ***" %(ctime(self.wakeuptime))
			print "[NAVIGATION] timer wakeup detection window: %s - %s" %(ctime(self.wakeupwindow_minus),ctime(self.wakeupwindow_plus))
			print "-"*100
		thisBox = getBoxType()
		if not config.workaround.deeprecord.value and (wasTimerWakeup_failure or thisBox in ('ixussone', 'uniboxhd1', 'uniboxhd2', 'uniboxhd3', 'sezam5000hd', 'mbtwin', 'beyonwizt3', 'et8000') or getBrandOEM() in ('ebox', 'azbox', 'xp', 'ini', 'fulan', 'entwopia') or getMachineBuild() in ('dags7335' , 'dags7356', 'dags7362')):
			print"[NAVIGATION] FORCED DEEPSTANDBY-WORKAROUND FOR THIS BOXTYPE (%s)" %thisBox
			config.workaround.deeprecord.setValue(True)
			config.workaround.deeprecord.save()
			config.save()

		if config.workaround.deeprecord.value: #work-around for boxes where driver not sent was_timer_wakeup signal to e2
			wasTimerWakeup = False
			print "[NAVIGATION] starting deepstandby-workaround"
			if now <= 31536000: # check for NTP-time sync, if no sync, wait for transponder time
				self.timesynctimer = eTimer()
				self.timesynctimer.callback.append(self.TimeSynctimer)
				self.timesynctimer.start(5000, True)
				print"[NAVIGATION] wait for time sync"
				print "~"*100
			elif now >= self.wakeupwindow_minus and now <= self.wakeupwindow_plus: # if there is a recording sheduled, set the wasTimerWakeup flag
				wasTimerWakeup = True
				f = open("/tmp/was_timer_wakeup_workaround.txt", "w")
				file = f.write(str(wasTimerWakeup))
				f.close()

		print "[NAVIGATION] was timer wakeup = %s" % wasTimerWakeup
		print "[NAVIGATION] current time is %s" % ctime(now)

		if wasTimerWakeup:
			self.__wasTimerWakeup = True
			print "-"*100
			if self.wakeuptime > 0:
				print "[NAVIGATION] wakeup time was %s" % ctime(self.wakeuptime)
			else:
				print "[NAVIGATION] wakeup time was not set"
			if now <= 31536000:
				self.timesynctimer = eTimer()
				self.timesynctimer.callback.append(self.TimeSynctimer)
				self.timesynctimer.start(5000, True)
				print"[NAVIGATION] wait for time sync"
				print "~"*100
			else:
				self.wakeupCheck()
		else:
			if now > 31536000:
				if self.timertime > 0:
					print "[NAVIGATION] next '%s' starts at %s" % ({0:"record-timer",1:"zap-timer",2:"power-timer",3:"plugin-timer"}[self.wakeuptyp], ctime(self.timertime))
				else:
					print "[NAVIGATION] no next timers"
				print "="*100
Example #19
0
	def __init__(self, nextRecordTimerAfterEventActionAuto=False):
		if NavigationInstance.instance is not None:
			raise NavigationInstance.instance

		NavigationInstance.instance = self
		self.ServiceHandler = eServiceCenter.getInstance()

		import Navigation as Nav
		Nav.navcore = self

		self.pnav = pNavigation()
		self.pnav.m_event.get().append(self.dispatchEvent)
		self.pnav.m_record_event.get().append(self.dispatchRecordEvent)
		self.event = [ ]
		self.record_event = [ ]
		self.currentlyPlayingServiceReference = None
		self.currentlyPlayingServiceOrGroup = None
		self.currentlyPlayingService = None
		self.RecordTimer = RecordTimer.RecordTimer()
		self.nextRecordTimerAfterEventActionAuto = nextRecordTimerAfterEventActionAuto
		self.__wasTimerWakeup = False
		self.__wasRecTimerWakeup = False
		self.syncCount = 0

		wasTimerWakeup = getFPWasTimerWakeup()
		if not wasTimerWakeup: #work-around for boxes where driver not sent was_timer_wakeup signal to e2
			print"[NAVIGATION] getNextRecordingTime= %s" % self.RecordTimer.getNextRecordingTime()
			print"[NAVIGATION] current Time=%s" % time()
			print"[NAVIGATION] timediff=%s" % abs(self.RecordTimer.getNextRecordingTime() - time())

			if time() <= 31536000: # check for NTP-time sync, if no sync, wait for transponder time
				self.timesynctimer = eTimer()
				self.timesynctimer.callback.append(self.TimeSynctimer)
				self.timesynctimer.start(5000, True)
				print"[NAVIGATION] wait for time sync"
				
			elif abs(self.RecordTimer.getNextRecordingTime() - time()) <= 360: # if there is a recording sheduled in the next 5 mins, set the wasTimerWakeup flag
				wasTimerWakeup = True
				f = open("/tmp/was_timer_wakeup_workaround.txt", "w")
				file = f.write(str(wasTimerWakeup))
				f.close()

		print"[NAVIGATION] wasTimerWakeup = %s" % wasTimerWakeup

		if wasTimerWakeup:
			self.__wasTimerWakeup = True
			if time() <= 31536000:
				self.timesynctimer = eTimer()
				self.timesynctimer.callback.append(self.TimeSynctimer)
				self.timesynctimer.start(5000, True)
				print"[NAVIGATION] wait for time sync"
	
			elif nextRecordTimerAfterEventActionAuto and abs(self.RecordTimer.getNextRecordingTime() - time()) <= 360:
				self.__wasRecTimerWakeup = True
				print 'RECTIMER: wakeup to standby detected.'
				f = open("/tmp/was_rectimer_wakeup", "w")
				f.write('1')
				f.close()
				# as we woke the box to record, place the box in standby.
				self.standbytimer = eTimer()
				self.standbytimer.callback.append(self.gotostandby)
				self.standbytimer.start(15000, True)
Example #20
0
	def __init__(self, nextRecordTimerAfterEventActionAuto=False):
		if NavigationInstance.instance is not None:
			raise NavigationInstance.instance

		NavigationInstance.instance = self
		self.ServiceHandler = eServiceCenter.getInstance()

		import Navigation as Nav
		Nav.navcore = self

		self.pnav = pNavigation()
		self.pnav.m_event.get().append(self.dispatchEvent)
		self.pnav.m_record_event.get().append(self.dispatchRecordEvent)
		self.event = [ ]
		self.record_event = [ ]
		self.currentlyPlayingServiceReference = None
		self.currentlyPlayingServiceOrGroup = None
		self.currentlyPlayingService = None
		self.RecordTimer = None
		for p in plugins.getPlugins(PluginDescriptor.WHERE_RECORDTIMER):
			self.RecordTimer = p()
			if self.RecordTimer:
				break
		if not self.RecordTimer:
			self.RecordTimer = RecordTimer.RecordTimer()
		self.nextRecordTimerAfterEventActionAuto = nextRecordTimerAfterEventActionAuto
		self.__wasTimerWakeup = False
		self.__wasRecTimerWakeup = False
		self.syncCount = 0
		self.__isRestartUI = config.misc.RestartUI.value
		startup_to_standby = config.usage.startup_to_standby.value
		wakeup_time_type = config.misc.prev_wakeup_time_type.value

		wasTimerWakeup = getFPWasTimerWakeup()
		if not wasTimerWakeup: #work-around for boxes where driver not sent was_timer_wakeup signal to e2
			print"[NAVIGATION] getNextRecordingTime= %s" % self.RecordTimer.getNextRecordingTime()
			print"[NAVIGATION] current Time=%s" % time()
			print"[NAVIGATION] timediff=%s" % abs(self.RecordTimer.getNextRecordingTime() - time())

			if time() <= 31536000: # check for NTP-time sync, if no sync, wait for transponder time
				self.timesynctimer = eTimer()
				self.timesynctimer.callback.append(self.TimeSynctimer)
				self.timesynctimer.start(5000, True)
				print"[NAVIGATION] wait for time sync"
				
			elif abs(self.RecordTimer.getNextRecordingTime() - time()) <= 360: # if there is a recording sheduled in the next 5 mins, set the wasTimerWakeup flag
				wasTimerWakeup = True
				f = open("/tmp/was_timer_wakeup_workaround.txt", "w")
				file = f.write(str(wasTimerWakeup))
				f.close()

		print"[NAVIGATION] wasTimerWakeup = %s" % wasTimerWakeup

		if wasTimerWakeup:
			self.__wasTimerWakeup = True
			if time() <= 31536000:
				self.timesynctimer = eTimer()
				self.timesynctimer.callback.append(self.TimeSynctimer)
				self.timesynctimer.start(5000, True)
				print"[NAVIGATION] wait for time sync"
	
			elif nextRecordTimerAfterEventActionAuto and abs(self.RecordTimer.getNextRecordingTime() - time()) <= 360:
				self.__wasRecTimerWakeup = True
				print 'RECTIMER: wakeup to standby detected.'
				f = open("/tmp/was_rectimer_wakeup", "w")
				f.write('1')
				f.close()
				# as we woke the box to record, place the box in standby.
				self.standbytimer = eTimer()
				self.standbytimer.callback.append(self.gotostandby)
				self.standbytimer.start(15000, True)
		if config.misc.RestartUI.value:
			config.misc.RestartUI.value = False
			config.misc.RestartUI.save()
			configfile.save()
		elif startup_to_standby == "yes" or self.__wasTimerWakeup and config.misc.prev_wakeup_time.value and ((wakeup_time_type == 0 or wakeup_time_type == 1) or ( wakeup_time_type == 3 and startup_to_standby == "except")):
			if not Screens.Standby.inTryQuitMainloop:
				Notifications.AddNotification(Screens.Standby.Standby)
		if config.misc.prev_wakeup_time.value:
			config.misc.prev_wakeup_time.value = 0
			config.misc.prev_wakeup_time.save()
			configfile.save()
Example #21
0
    def __init__(self, wakeupData=None):
        if NavigationInstance.instance is not None:
            raise NavigationInstance.instance
        NavigationInstance.instance = self
        self.ServiceHandler = eServiceCenter.getInstance()
        import Navigation as Nav
        Nav.navcore = self
        self.pnav = pNavigation()
        self.pnav.m_event.get().append(self.dispatchEvent)
        self.pnav.m_record_event.get().append(self.dispatchRecordEvent)
        self.event = []
        self.record_event = []
        self.currentlyPlayingServiceReference = None
        self.currentlyPlayingServiceOrGroup = None
        self.currentlyPlayingService = None
        Screens.Standby.TVstate()
        self.skipWakeup = False
        self.RecordTimer = None
        self.isRecordTimerImageStandard = False
        for p in plugins.getPlugins(PluginDescriptor.WHERE_RECORDTIMER):
            self.RecordTimer = p()
            if self.RecordTimer:
                break

        if not self.RecordTimer:
            self.RecordTimer = RecordTimer.RecordTimer()
            self.isRecordTimerImageStandard = True
        self.PowerTimer = None
        self.PowerTimer = PowerTimer.PowerTimer()
        self.__wasTimerWakeup = False
        self.__wasRecTimerWakeup = False
        self.__wasPowerTimerWakeup = False
        now = time()
        try:
            self.lastshutdowntime, self.wakeuptime, self.timertime, self.wakeuptyp, self.getstandby, self.recordtime, self.forcerecord = [
                int(n) for n in wakeupData.split(',')
            ]
        except:
            print '=' * 100
            print "[NAVIGATION] ERROR: can't read wakeup data"
            self.lastshutdowntime, self.wakeuptime, self.timertime, self.wakeuptyp, self.getstandby, self.recordtime, self.forcerecord = (
                int(now), -1, -1, 0, 0, -1, 0)

        self.syncCount = 0
        hasFakeTime = (now <= 31536000 or now - self.lastshutdowntime <= 120
                       ) and self.getstandby < 2
        wasTimerWakeup, wasTimerWakeup_failure = getFPWasTimerWakeup(True)
        print '=' * 100
        print '[NAVIGATION] was timer wakeup = %s' % wasTimerWakeup
        print "[NAVIGATION] current time is %s -> it's fake-time suspected: %s" % (
            ctime(now), hasFakeTime)
        print '-' * 100
        thisBox = getBoxType()
        if not config.workaround.deeprecord.value and (
                wasTimerWakeup_failure or thisBox in
            ('ixussone', 'uniboxhd1', 'uniboxhd2', 'uniboxhd3', 'sezam5000hd',
             'mbtwin', 'beyonwizt3', 'et8000') or getBrandOEM()
                in ('ebox', 'azbox', 'xp', 'ini', 'fulan', 'entwopia')
                or getMachineBuild() in ('dags7335', 'dags7356', 'dags7362')):
            print '[NAVIGATION] FORCED DEEPSTANDBY-WORKAROUND FOR THIS BOXTYPE (%s)' % thisBox
            print '-' * 100
            config.workaround.deeprecord.setValue(True)
            config.workaround.deeprecord.save()
            config.save()
        if config.workaround.deeprecord.value:
            print '[NAVIGATION] starting deepstandby-workaround'
            self.wakeupwindow_plus = self.timertime + 300
            self.wakeupwindow_minus = self.wakeuptime - config.workaround.wakeupwindow.value * 60
            wasTimerWakeup = False
            if not hasFakeTime and now >= self.wakeupwindow_minus and now <= self.wakeupwindow_plus:
                wasTimerWakeup = True
                f = open('/tmp/was_timer_wakeup_workaround.txt', 'w')
                file = f.write(str(wasTimerWakeup))
                f.close()
        else:
            self.wakeupwindow_plus = self.timertime + 900
            self.wakeupwindow_minus = self.wakeuptime - 3600
        if self.wakeuptime > 0:
            print '[NAVIGATION] wakeup time from deep-standby expected: *** %s ***' % ctime(
                self.wakeuptime)
            if config.workaround.deeprecord.value:
                print '[NAVIGATION] timer wakeup detection window: %s - %s' % (
                    ctime(self.wakeupwindow_minus),
                    ctime(self.wakeupwindow_plus))
        else:
            print '[NAVIGATION] wakeup time was not set'
        print '-' * 100
        if wasTimerWakeup:
            self.__wasTimerWakeup = True
            if not hasFakeTime:
                self.wakeupCheck()
                return
        if hasFakeTime and self.wakeuptime > 0:
            if Screens.Standby.TVinStandby.getTVstandby(
                    'waitfortimesync') and not wasTimerWakeup:
                Screens.Standby.TVinStandby.setTVstate('power')
            self.savedOldTime = now
            self.timesynctimer = eTimer()
            self.timesynctimer.callback.append(self.TimeSynctimer)
            self.timesynctimer.start(5000, True)
            print '[NAVIGATION] wait for time sync'
            print '~' * 100
        else:
            self.wakeupCheck(False)
        return
Example #22
0
 def __init__(self, nextRecordTimerAfterEventActionAuto = False, nextPowerManagerAfterEventActionAuto = False):
     if NavigationInstance.instance is not None:
         raise NavigationInstance.instance
     NavigationInstance.instance = self
     self.ServiceHandler = eServiceCenter.getInstance()
     import Navigation as Nav
     Nav.navcore = self
     self.pnav = pNavigation()
     self.pnav.m_event.get().append(self.dispatchEvent)
     self.pnav.m_record_event.get().append(self.dispatchRecordEvent)
     self.event = []
     self.record_event = []
     self.currentlyPlayingServiceReference = None
     self.currentlyPlayingServiceOrGroup = None
     self.currentlyPlayingService = None
     self.RecordTimer = RecordTimer.RecordTimer()
     self.PowerTimer = PowerTimer.PowerTimer()
     self.nextRecordTimerAfterEventActionAuto = nextRecordTimerAfterEventActionAuto
     self.nextPowerManagerAfterEventActionAuto = nextPowerManagerAfterEventActionAuto
     self.__wasTimerWakeup = False
     self.__wasRecTimerWakeup = False
     self.__wasPowerTimerWakeup = False
     self.syncCount = 0
     wasTimerWakeup = getFPWasTimerWakeup()
     if getBrandOEM() in ('ebox', 'azbox', 'xp', 'ini', 'dags', 'fulan'):
         config.workaround.deeprecord.setValue(True)
         config.workaround.deeprecord.save()
         config.save()
         print '[NAVIGATION] USE DEEPSTAND-WORKAROUND FOR THIS BOXTYPE (%s) !!' % getBoxType()
     if not wasTimerWakeup and config.workaround.deeprecord.value:
         print '=================================================================================='
         print '[NAVIGATION] getNextRecordingTime= %s' % self.RecordTimer.getNextRecordingTime()
         print '[NAVIGATION] nextRecordTimerAfterEventActionAuto= %s' % nextRecordTimerAfterEventActionAuto
         print '[NAVIGATION] current Time=%s' % time()
         print '[NAVIGATION] timediff=%s' % abs(self.RecordTimer.getNextRecordingTime() - time())
         print '=================================================================================='
         print '[NAVIGATION] getNextPowerManagerTime= %s' % self.PowerTimer.getNextPowerManagerTime()
         print '[NAVIGATION] nextPowerManagerAfterEventActionAuto= %s' % nextPowerManagerAfterEventActionAuto
         print '[NAVIGATION] current Time=%s' % time()
         print '[NAVIGATION] timediff=%s' % abs(self.PowerTimer.getNextPowerManagerTime() - time())
         print '=================================================================================='
         if time() <= 31536000:
             self.timesynctimer = eTimer()
             self.timesynctimer.callback.append(self.TimeSynctimer)
             self.timesynctimer.start(5000, True)
             print '[NAVIGATION] [work-around] wait for time sync'
         elif abs(self.RecordTimer.getNextRecordingTime() - time()) <= 360:
             wasTimerWakeup = True
             f = open('/tmp/was_timer_wakeup_workaround.txt', 'w')
             file = f.write(str(wasTimerWakeup))
             f.close()
         elif abs(self.PowerTimer.getNextPowerManagerTime() - time()) <= 360:
             wasTimerWakeup = True
             f = open('/tmp/was_timer_wakeup_workaround.txt', 'w')
             file = f.write(str(wasTimerWakeup))
             f.close()
     print '[NAVIGATION] wasTimerWakeup = %s' % wasTimerWakeup
     if wasTimerWakeup:
         self.__wasTimerWakeup = True
         if time() <= 31536000:
             self.timesynctimer = eTimer()
             self.timesynctimer.callback.append(self.TimeSynctimer)
             self.timesynctimer.start(5000, True)
             print '[NAVIGATION] wait for time sync'
         elif nextRecordTimerAfterEventActionAuto and abs(self.RecordTimer.getNextRecordingTime() - time()) <= 360:
             self.__wasRecTimerWakeup = True
             print 'RECTIMER: wakeup to standby detected.'
             f = open('/tmp/was_rectimer_wakeup', 'w')
             f.write('1')
             f.close()
             self.standbytimer = eTimer()
             self.standbytimer.callback.append(self.gotostandby)
             self.standbytimer.start(15000, True)
         elif nextPowerManagerAfterEventActionAuto:
             self.__wasPowerTimerWakeup = True
             print 'POWERTIMER: wakeup to standby detected.'
             f = open('/tmp/was_powertimer_wakeup', 'w')
             f.write('1')
             f.close()
             self.standbytimer = eTimer()
             self.standbytimer.callback.append(self.gotostandby)
             self.standbytimer.start(15000, True)
     return
Example #23
0
	def __init__(self, nextRecordTimerAfterEventActionAuto=False, nextPowerManagerAfterEventActionAuto=False):
		if NavigationInstance.instance is not None:
			raise NavigationInstance.instance

		NavigationInstance.instance = self
		self.ServiceHandler = eServiceCenter.getInstance()

		import Navigation as Nav
		Nav.navcore = self

		self.pnav = pNavigation()
		self.pnav.m_event.get().append(self.dispatchEvent)
		self.pnav.m_record_event.get().append(self.dispatchRecordEvent)
		self.event = [ ]
		self.record_event = [ ]
		self.currentlyPlayingServiceReference = None
		self.currentlyPlayingServiceOrGroup = None
		self.currentlyPlayingService = None

		self.RecordTimer = None
		for p in plugins.getPlugins(PluginDescriptor.WHERE_RECORDTIMER):
			self.RecordTimer = p()
			if self.RecordTimer:
				break
		if not self.RecordTimer:
			self.RecordTimer = RecordTimer.RecordTimer()

		self.PowerTimer = None
		self.PowerTimer = PowerTimer.PowerTimer()
		self.nextRecordTimerAfterEventActionAuto = nextRecordTimerAfterEventActionAuto
		self.nextPowerManagerAfterEventActionAuto = nextPowerManagerAfterEventActionAuto
		self.__wasTimerWakeup = False
		self.__wasRecTimerWakeup = False
		self.__wasPowerTimerWakeup = False
		self.syncCount = 0

		now = time()
		nextZT = self.RecordTimer.getNextZapTime()
		nextRT = self.RecordTimer.getNextRecordingTime()
		nextPT = self.PowerTimer.getNextPowerManagerTime(getNextTimerTyp = True)
		timediffZT = nextZT - now
		timediffRT = nextRT - now
		timediffPT = nextPT[0][0] - now
		wasTimerWakeup = getFPWasTimerWakeup()
		#TODO: verify wakeup-state for boxes where only after shutdown removed the wakeup-state (for boxes where "/proc/stb/fp/was_timer_wakeup" is not writable (clearFPWasTimerWakeup() in StbHardware.py has no effect -> after x hours and restart/reboot is wasTimerWakeup = True)
		thisBox = getBoxType()
		if thisBox in ('ixussone', 'uniboxhd1', 'uniboxhd2', 'uniboxhd3', 'sezam5000hd', 'mbtwin', 'beyonwizt3') or getBrandOEM() in ('ebox', 'azbox', 'xp', 'ini', 'dags', 'fulan', 'entwopia'):
			config.workaround.deeprecord.setValue(True)
			config.workaround.deeprecord.save()
			config.save()
			print"[NAVIGATION] USE DEEPSTAND-WORKAROUND FOR THIS BOXTYPE (%s) !!" %thisBox

		if not wasTimerWakeup and config.workaround.deeprecord.value: #work-around for boxes where driver not sent was_timer_wakeup signal to e2
			print"=================================================================================="
			print"[NAVIGATION] getNextZapTime= %s" % nextZT
			print"[NAVIGATION] nextRecordTimerAfterEventActionAuto= %s" % nextRecordTimerAfterEventActionAuto
			print"[NAVIGATION] current Time=%s" % now
			print"[NAVIGATION] timediff=%s" % abs(timediffZT)
			print"=================================================================================="
			print"[NAVIGATION] getNextRecordingTime= %s" % nextRT
			print"[NAVIGATION] nextRecordTimerAfterEventActionAuto= %s" % nextRecordTimerAfterEventActionAuto
			print"[NAVIGATION] current Time=%s" % now
			print"[NAVIGATION] timediff=%s" % abs(timediffRT)
			print"=================================================================================="
			print"[NAVIGATION] getNextPowerManagerTime= %s" % nextPT[0][0]
			print"[NAVIGATION] nextPowerManagerAfterEventActionAuto= %s" % nextPowerManagerAfterEventActionAuto
			print"[NAVIGATION] current Time=%s" % now
			print"[NAVIGATION] timediff=%s" % abs(timediffPT)
			print"=================================================================================="

			if now <= 31536000: # check for NTP-time sync, if no sync, wait for transponder time
				self.timesynctimer = eTimer()
				self.timesynctimer.callback.append(self.TimeSynctimer)
				self.timesynctimer.start(5000, True)
				print"[NAVIGATION] [work-around] wait for time sync"
			elif abs(timediffRT) <= 600 or abs(timediffZT) <= 600: # if there is a recording sheduled in the next 10 mins, set the wasTimerWakeup flag (wakeup time is 5 min before timer starts, some boxes starts but earlier than is set)
				wasTimerWakeup = True
				f = open("/tmp/was_timer_wakeup_workaround.txt", "w")
				file = f.write(str(wasTimerWakeup))
				f.close()
			elif abs(timediffPT) <= 600 and (nextPT[0][1] == PowerTimer.TIMERTYPE.WAKEUP or nextPT[0][1] == PowerTimer.TIMERTYPE.WAKEUPTOSTANDBY or nextPT[0][2] == PowerTimer.AFTEREVENT.WAKEUP or nextPT[0][2] == PowerTimer.AFTEREVENT.WAKEUPTOSTANDBY): # if there is a power timer in the next 5 mins, set the wasTimerWakeup flag
				wasTimerWakeup = True
				f = open("/tmp/was_timer_wakeup_workaround.txt", "w")
				file = f.write(str(wasTimerWakeup))
				f.close()

		print"[NAVIGATION] wasTimerWakeup = %s, current time is %s" % (wasTimerWakeup, ctime(now))

		stbytimer = 5 # original is 15

		if wasTimerWakeup:
			self.__wasTimerWakeup = True
			if now <= 31536000:
				self.timesynctimer = eTimer()
				self.timesynctimer.callback.append(self.TimeSynctimer)
				self.timesynctimer.start(5000, True)
				print"[NAVIGATION] wait for time sync"

			elif self.nextRecordTimerAfterEventActionAuto and abs(timediffRT) <= 600:
				self.__wasRecTimerWakeup = True
				print '[NAVIGATION] RECTIMER: wakeup to standby detected. Timer starts at %s' % ctime(nextRT)
				f = open("/tmp/was_rectimer_wakeup", "w")
				f.write('1')
				f.close()
				# as we woke the box to record, place the box in standby.
				self.standbytimer = eTimer()
				self.standbytimer.callback.append(self.gotostandby)
				self.standbytimer.start(stbytimer * 1000, True)

			elif self.nextRecordTimerAfterEventActionAuto and abs(timediffZT) <= 600:
				self.__wasRecTimerWakeup = True
				print '[NAVIGATION] ZAPTIMER: wakeup detected. Timer starts at %s' % ctime(nextZT)
				f = open("/tmp/was_rectimer_wakeup", "w")
				f.write('1')
				f.close()
				if abs(timediffZT) > 60 + stbytimer: #more than 1 minutes to wake up from zaptimer - go in standby
					self.standbytimer = eTimer()
					self.standbytimer.callback.append(self.gotostandby)
					self.standbytimer.start(stbytimer * 1000, True)

			elif self.nextPowerManagerAfterEventActionAuto and abs(timediffPT) <= 600 and (nextPT[0][1] == PowerTimer.TIMERTYPE.WAKEUP or nextPT[0][2] == PowerTimer.AFTEREVENT.WAKEUP):
				self.__wasPowerTimerWakeup = True
				print '[NAVIGATION] POWERTIMER: wakeup detected. Timer starts at %s' % ctime(nextPT[0][0])
				if abs(timediffPT) > 60 + stbytimer: #more than 1 minutes to wake up from powertimer - go in standby
					self.standbytimer = eTimer()
					self.standbytimer.callback.append(self.gotostandby)
					self.standbytimer.start(stbytimer * 1000, True)

			elif self.nextPowerManagerAfterEventActionAuto and abs(timediffPT) <= 600 and (nextPT[0][1] == PowerTimer.TIMERTYPE.WAKEUPTOSTANDBY or nextPT[0][2] == PowerTimer.AFTEREVENT.WAKEUPTOSTANDBY):
				self.__wasPowerTimerWakeup = True
				print '[NAVIGATION] POWERTIMER: wakeup to standby detected. Timer starts at %s' % ctime(nextPT[0][0])
				f = open("/tmp/was_powertimer_wakeup", "w")
				f.write('1')
				f.close()
				# as a PowerTimer WakeToStandby was actiond to it.
				self.standbytimer = eTimer()
				self.standbytimer.callback.append(self.gotostandby)
				self.standbytimer.start(stbytimer * 1000, True)
Example #24
0
	def __init__(self, wakeupData=None):
		if NavigationInstance.instance is not None:
			raise NavigationInstance.instance

		NavigationInstance.instance = self
		self.ServiceHandler = eServiceCenter.getInstance()

		import Navigation as Nav
		Nav.navcore = self

		self.pnav = pNavigation()
		self.pnav.m_event.get().append(self.dispatchEvent)
		self.pnav.m_record_event.get().append(self.dispatchRecordEvent)
		self.event = [ ]
		self.record_event = [ ]
		self.currentlyPlayingServiceReference = None
		self.currentlyPlayingServiceOrGroup = None
		self.currentlyPlayingService = None

		Screens.Standby.TVstate()
		self.skipWakeup = False
		self.skipTVWakeup = False

		self.RecordTimer = None
		self.isRecordTimerImageStandard = False
		if not self.RecordTimer:
			self.RecordTimer = RecordTimer.RecordTimer()
			self.isRecordTimerImageStandard = True

		self.PowerTimer = None
		self.PowerTimer = PowerTimer.PowerTimer()
		self.__wasTimerWakeup = False
		self.__wasRecTimerWakeup = False
		self.__wasPowerTimerWakeup = False

		#wakeup data
		now = time()
		try:
			self.lastshutdowntime, self.wakeuptime, self.timertime, self.wakeuptyp, self.getstandby, self.recordtime, self.forcerecord = [int(n) for n in wakeupData.split(',')]
		except:
			print "="*100
			print "[NAVIGATION] ERROR: can't read wakeup data"
			self.lastshutdowntime, self.wakeuptime, self.timertime, self.wakeuptyp, self.getstandby, self.recordtime, self.forcerecord = int(now),-1,-1,0,0,-1,0
		self.syncCount = 0
		hasFakeTime = (now <= 31536000 or now - self.lastshutdowntime <= 120) and self.getstandby < 2 #set hasFakeTime only if lower than values and was last shutdown to deep standby
		wasTimerWakeup, wasTimerWakeup_failure = getFPWasTimerWakeup(True)
		#TODO: verify wakeup-state for boxes where only after shutdown removed the wakeup-state (for boxes where "/proc/stb/fp/was_timer_wakeup" is not writable (clearFPWasTimerWakeup() in StbHardware.py has no effect -> after x hours and restart/reboot is wasTimerWakeup = True)

		print "="*100
		print "[NAVIGATION] was timer wakeup = %s" %wasTimerWakeup
		print "[NAVIGATION] current time is %s -> it's fake-time suspected: %s" %(ctime(now),hasFakeTime)
		print "-"*100

		thisBox = getBoxType()
		if not config.workaround.deeprecord.value and (wasTimerWakeup_failure or thisBox in ('ixussone', 'uniboxhd1', 'uniboxhd2', 'uniboxhd3', 'sezam5000hd', 'mbtwin', 'beyonwizt3', 'et8000') or getBrandOEM() in ('ebox', 'azbox', 'xp', 'ini', 'fulan', 'entwopia') or getMachineBuild() in ('dags7335' , 'dags7356', 'dags7362')):
			print"[NAVIGATION] FORCED DEEPSTANDBY-WORKAROUND FOR THIS BOXTYPE (%s)" %thisBox
			print "-"*100
			config.workaround.deeprecord.setValue(True)
			config.workaround.deeprecord.save()
			config.save()

		if config.workaround.deeprecord.value: #work-around for boxes where driver not sent was_timer_wakeup signal to e2
			print "[NAVIGATION] starting deepstandby-workaround"
			self.wakeupwindow_plus = self.timertime + 300
			self.wakeupwindow_minus = self.wakeuptime - (config.workaround.wakeupwindow.value * 60)
			wasTimerWakeup = False
			if not hasFakeTime and now >= self.wakeupwindow_minus and now <= self.wakeupwindow_plus: # if there is a recording sheduled, set the wasTimerWakeup flag
				wasTimerWakeup = True
				f = open("/tmp/was_timer_wakeup_workaround.txt", "w")
				file = f.write(str(wasTimerWakeup))
				f.close()
		else:
			#secure wakeup window to prevent a wrong 'wasTimerWakeup' value as timer wakeup detection
			self.wakeupwindow_plus = self.timertime + 900
			self.wakeupwindow_minus = self.wakeuptime - 3600

		if self.wakeuptime > 0:
			print "[NAVIGATION] wakeup time from deep-standby expected: *** %s ***" %(ctime(self.wakeuptime))
			if config.workaround.deeprecord.value:
				print "[NAVIGATION] timer wakeup detection window: %s - %s" %(ctime(self.wakeupwindow_minus),ctime(self.wakeupwindow_plus))
		else:
			print "[NAVIGATION] wakeup time was not set"
		print "-"*100

		if wasTimerWakeup:
			self.__wasTimerWakeup = True
			if not hasFakeTime:
				self.wakeupCheck()
				return

		if hasFakeTime and self.wakeuptime > 0: # check for NTP-time sync, if no sync, wait for transponder time
			if Screens.Standby.TVinStandby.getTVstandby('waitfortimesync') and not wasTimerWakeup:
				self.skipTVWakeup = True
				Screens.Standby.TVinStandby.setTVstate('power')
			self.savedOldTime = now
			self.timesynctimer = eTimer()
			self.timesynctimer.callback.append(self.TimeSynctimer)
			self.timesynctimer.start(5000, True)
			print"[NAVIGATION] wait for time sync"
			print "~"*100
		else:
			self.wakeupCheck(False)
Example #25
0
    def __init__(self, nextRecordTimerAfterEventActionAuto=False):
        if NavigationInstance.instance is not None:
            raise NavigationInstance.instance

        NavigationInstance.instance = self
        self.ServiceHandler = eServiceCenter.getInstance()

        import Navigation as Nav
        Nav.navcore = self

        self.pnav = pNavigation()
        self.pnav.m_event.get().append(self.dispatchEvent)
        self.pnav.m_record_event.get().append(self.dispatchRecordEvent)
        self.event = []
        self.record_event = []
        self.currentlyPlayingServiceReference = None
        self.currentlyPlayingServiceOrGroup = None
        self.currentlyPlayingService = None

        self.RecordTimer = None
        for p in plugins.getPlugins(PluginDescriptor.WHERE_RECORDTIMER):
            self.RecordTimer = p()
            if self.RecordTimer:
                break
        if not self.RecordTimer:
            self.RecordTimer = RecordTimer.RecordTimer()
        self.nextRecordTimerAfterEventActionAuto = nextRecordTimerAfterEventActionAuto
        self.__wasTimerWakeup = False
        self.__wasRecTimerWakeup = False
        self.syncCount = 0

        wasTimerWakeup = getFPWasTimerWakeup()
        if not wasTimerWakeup:  #work-around for boxes where driver not sent was_timer_wakeup signal to e2
            print "[NAVIGATION] getNextRecordingTime= %s" % self.RecordTimer.getNextRecordingTime(
            )
            print "[NAVIGATION] current Time=%s" % time()
            print "[NAVIGATION] timediff=%s" % abs(
                self.RecordTimer.getNextRecordingTime() - time())

            if time(
            ) <= 31536000:  # check for NTP-time sync, if no sync, wait for transponder time
                self.timesynctimer = eTimer()
                self.timesynctimer.callback.append(self.TimeSynctimer)
                self.timesynctimer.start(5000, True)
                print "[NAVIGATION] wait for time sync"

            elif abs(
                    self.RecordTimer.getNextRecordingTime() - time()
            ) <= 360:  # if there is a recording sheduled in the next 5 mins, set the wasTimerWakeup flag
                wasTimerWakeup = True
                f = open("/tmp/was_timer_wakeup_workaround.txt", "w")
                file = f.write(str(wasTimerWakeup))
                f.close()

        print "[NAVIGATION] wasTimerWakeup = %s" % wasTimerWakeup

        if wasTimerWakeup:
            self.__wasTimerWakeup = True
            if time() <= 31536000:
                self.timesynctimer = eTimer()
                self.timesynctimer.callback.append(self.TimeSynctimer)
                self.timesynctimer.start(5000, True)
                print "[NAVIGATION] wait for time sync"

            elif nextRecordTimerAfterEventActionAuto and abs(
                    self.RecordTimer.getNextRecordingTime() - time()) <= 360:
                self.__wasRecTimerWakeup = True
                print 'RECTIMER: wakeup to standby detected.'
                f = open("/tmp/was_rectimer_wakeup", "w")
                f.write('1')
                f.close()
                # as we woke the box to record, place the box in standby.
                self.standbytimer = eTimer()
                self.standbytimer.callback.append(self.gotostandby)
                self.standbytimer.start(15000, True)
Example #26
0
    def __init__(self, nextRecordTimerAfterEventActionAuto=False):
        if NavigationInstance.instance is not None:
            raise NavigationInstance.instance

        NavigationInstance.instance = self
        self.ServiceHandler = eServiceCenter.getInstance()

        import Navigation as Nav
        Nav.navcore = self

        self.pnav = pNavigation()
        self.pnav.m_event.get().append(self.dispatchEvent)
        self.pnav.m_record_event.get().append(self.dispatchRecordEvent)
        self.event = []
        self.record_event = []
        self.currentlyPlayingServiceReference = None
        self.currentlyPlayingServiceOrGroup = None
        self.currentlyPlayingService = None
        self.RecordTimer = None
        for p in plugins.getPlugins(PluginDescriptor.WHERE_RECORDTIMER):
            self.RecordTimer = p()
            if self.RecordTimer:
                break
        if not self.RecordTimer:
            self.RecordTimer = RecordTimer.RecordTimer()
        self.nextRecordTimerAfterEventActionAuto = nextRecordTimerAfterEventActionAuto
        self.__wasTimerWakeup = False
        self.__wasRecTimerWakeup = False
        self.syncCount = 0
        self.__isRestartUI = config.misc.RestartUI.value
        startup_to_standby = config.usage.startup_to_standby.value
        wakeup_time_type = config.misc.prev_wakeup_time_type.value

        wasTimerWakeup = getFPWasTimerWakeup()
        if not wasTimerWakeup:  #work-around for boxes where driver not sent was_timer_wakeup signal to e2
            print "[NAVIGATION] getNextRecordingTime= %s" % self.RecordTimer.getNextRecordingTime(
            )
            print "[NAVIGATION] current Time=%s" % time()
            print "[NAVIGATION] timediff=%s" % abs(
                self.RecordTimer.getNextRecordingTime() - time())

            if time(
            ) <= 31536000:  # check for NTP-time sync, if no sync, wait for transponder time
                self.timesynctimer = eTimer()
                self.timesynctimer.callback.append(self.TimeSynctimer)
                self.timesynctimer.start(5000, True)
                print "[NAVIGATION] wait for time sync"

            elif abs(
                    self.RecordTimer.getNextRecordingTime() - time()
            ) <= 360:  # if there is a recording sheduled in the next 5 mins, set the wasTimerWakeup flag
                wasTimerWakeup = True
                f = open("/tmp/was_timer_wakeup_workaround.txt", "w")
                file = f.write(str(wasTimerWakeup))
                f.close()

        print "[NAVIGATION] wasTimerWakeup = %s" % wasTimerWakeup

        if wasTimerWakeup:
            self.__wasTimerWakeup = True
            if time() <= 31536000:
                self.timesynctimer = eTimer()
                self.timesynctimer.callback.append(self.TimeSynctimer)
                self.timesynctimer.start(5000, True)
                print "[NAVIGATION] wait for time sync"

            elif nextRecordTimerAfterEventActionAuto and abs(
                    self.RecordTimer.getNextRecordingTime() - time()) <= 360:
                self.__wasRecTimerWakeup = True
                print 'RECTIMER: wakeup to standby detected.'
                f = open("/tmp/was_rectimer_wakeup", "w")
                f.write('1')
                f.close()
                # as we woke the box to record, place the box in standby.
                self.standbytimer = eTimer()
                self.standbytimer.callback.append(self.gotostandby)
                self.standbytimer.start(15000, True)
        if config.usage.remote_fallback_import_restart.value:
            ImportChannels()
        if config.misc.RestartUI.value:
            config.misc.RestartUI.value = False
            config.misc.RestartUI.save()
            configfile.save()
        else:
            if config.usage.remote_fallback_import.value and not config.usage.remote_fallback_import_restart.value:
                ImportChannels()
            if startup_to_standby == "yes" or self.__wasTimerWakeup and config.misc.prev_wakeup_time.value and (
                (wakeup_time_type == 0 or wakeup_time_type == 1) or
                (wakeup_time_type == 3 and startup_to_standby == "except")):
                if not Screens.Standby.inTryQuitMainloop:
                    Notifications.AddNotification(Screens.Standby.Standby)
        if config.misc.prev_wakeup_time.value:
            config.misc.prev_wakeup_time.value = 0
            config.misc.prev_wakeup_time.save()
            configfile.save()
Example #27
0
	def __init__(self, wakeupData=None):
		if NavigationInstance.instance is not None:
			raise NavigationInstance.instance

		NavigationInstance.instance = self
		self.ServiceHandler = eServiceCenter.getInstance()

		import Navigation as Nav
		Nav.navcore = self

		self.pnav = pNavigation()
		self.pnav.m_event.get().append(self.dispatchEvent)
		self.pnav.m_record_event.get().append(self.dispatchRecordEvent)
		self.event = [ ]
		self.record_event = [ ]
		self.currentlyPlayingServiceReference = None
		self.currentlyPlayingServiceOrGroup = None
		self.currentlyPlayingService = None

		self.RecordTimer = None
		self.isRecordTimerImageStandard = False
		if not self.RecordTimer:
			self.RecordTimer = RecordTimer.RecordTimer()
			self.isRecordTimerImageStandard = True

		self.PowerTimer = None
		self.PowerTimer = PowerTimer.PowerTimer()
		self.__wasTimerWakeup = False
		self.__wasRecTimerWakeup = False
		self.__wasPowerTimerWakeup = False

		#wakeup data
		try:
			self.wakeuptime, self.timertime, self.wakeuptyp, self.getstandby, self.recordtime, self.forcerecord = [int(n) for n in wakeupData.split(',')]
		except:
			print "="*100
			print "[NAVIGATION] ERROR: can't read wakeup data"
			self.wakeuptime, self.timertime, self.wakeuptyp, self.getstandby, self.recordtime, self.forcerecord = -1,-1,0,0,-1,0
		#print ctime(self.wakeuptime), ctime(self.timertime), self.wakeuptyp, self.getstandby, ctime(self.recordtime), self.forcerecord
		now = time()
		timediff_wakeup = self.wakeuptime - now
		timediff_timer = self.timertime - now
		self.syncCount = 0

		wasTimerWakeup = getFPWasTimerWakeup()
		#TODO: verify wakeup-state for boxes where only after shutdown removed the wakeup-state (for boxes where "/proc/stb/fp/was_timer_wakeup" is not writable (clearFPWasTimerWakeup() in StbHardware.py has no effect -> after x hours and restart/reboot is wasTimerWakeup = True)

		print "="*100
		thisBox = getBoxType()
		if not config.workaround.deeprecord.value and (thisBox in ('ixussone', 'uniboxhd1', 'uniboxhd2', 'uniboxhd3', 'sezam5000hd', 'mbtwin', 'beyonwizt3') or getBrandOEM() in ('ebox', 'azbox', 'xp', 'ini', 'dags', 'fulan', 'entwopia')):
			print"[NAVIGATION] FORCED DEEPSTANDBY-WORKAROUND FOR THIS BOXTYPE (%s)" %thisBox
			config.workaround.deeprecord.setValue(True)
			config.workaround.deeprecord.save()
			config.save()

		if config.workaround.deeprecord.value: #work-around for boxes where driver not sent was_timer_wakeup signal to e2
			wasTimerWakeup = False
			print "[NAVIGATION] starting deepstandby-workaround"
			if now <= 31536000: # check for NTP-time sync, if no sync, wait for transponder time
				self.timesynctimer = eTimer()
				self.timesynctimer.callback.append(self.TimeSynctimer)
				self.timesynctimer.start(5000, True)
				print"[NAVIGATION] wait for time sync"
				print "~"*100
			elif abs(timediff_wakeup) <= 600 or abs(timediff_timer) <= 600: # if there is a recording sheduled in the next 10 mins or starting before 10 mins, set the wasTimerWakeup flag (wakeup time is 5 min before timer starts, some boxes starts but earlier than is set)
				wasTimerWakeup = True
				f = open("/tmp/was_timer_wakeup_workaround.txt", "w")
				file = f.write(str(wasTimerWakeup))
				f.close()

		print "[NAVIGATION] was timer wakeup = %s" % wasTimerWakeup
		print "[NAVIGATION] current time is %s" % ctime(now)

		if wasTimerWakeup:
			self.__wasTimerWakeup = True
			print "-"*100
			if self.wakeuptime > 0:
				print "[NAVIGATION] wakeup time was %s" % ctime(self.wakeuptime)
			else:
				print "[NAVIGATION] wakeup time was not set"
			if now <= 31536000:
				self.timesynctimer = eTimer()
				self.timesynctimer.callback.append(self.TimeSynctimer)
				self.timesynctimer.start(5000, True)
				print"[NAVIGATION] wait for time sync"
				print "~"*100
			else:
				self.wakeupCheck()
		else:
			if now > 31536000:
				if self.timertime > 0:
					print "[NAVIGATION] next '%s' starts at %s" % ({0:"record-timer",1:"zap-timer",2:"power-timer",3:"plugin-timer"}[self.wakeuptyp], ctime(self.timertime))
				else:
					print "[NAVIGATION] no next timers"
				print "="*100
Example #28
0
    def __init__(self,
                 nextRecordTimerAfterEventActionAuto=False,
                 nextPowerManagerAfterEventActionAuto=False):
        if NavigationInstance.instance is not None:
            raise NavigationInstance.instance

        NavigationInstance.instance = self
        self.ServiceHandler = eServiceCenter.getInstance()

        import Navigation as Nav
        Nav.navcore = self

        self.pnav = pNavigation()
        self.pnav.m_event.get().append(self.dispatchEvent)
        self.pnav.m_record_event.get().append(self.dispatchRecordEvent)
        self.event = []
        self.record_event = []
        self.currentlyPlayingServiceReference = None
        self.currentlyPlayingServiceOrGroup = None
        self.currentlyPlayingService = None

        self.RecordTimer = None
        for p in plugins.getPlugins(PluginDescriptor.WHERE_RECORDTIMER):
            self.RecordTimer = p()
            if self.RecordTimer:
                break
        if not self.RecordTimer:
            self.RecordTimer = RecordTimer.RecordTimer()

        self.PowerTimer = None
        self.PowerTimer = PowerTimer.PowerTimer()
        self.nextRecordTimerAfterEventActionAuto = nextRecordTimerAfterEventActionAuto
        self.nextPowerManagerAfterEventActionAuto = nextPowerManagerAfterEventActionAuto
        self.__wasTimerWakeup = False
        self.__wasRecTimerWakeup = False
        self.__wasPowerTimerWakeup = False
        self.syncCount = 0

        now = time()
        nextRT = self.RecordTimer.getNextRecordingTime()
        nextPT = self.PowerTimer.getNextPowerManagerTime(getNextTimerTyp=True)
        timediffRT = nextRT - now
        timediffPT = nextPT[0][0] - now
        wasTimerWakeup = getFPWasTimerWakeup()
        #TODO: verify wakeup-state for boxes where only after shutdown removed the wakeup-state (for boxes where "/proc/stb/fp/was_timer_wakeup" is not writable (clearFPWasTimerWakeup() in StbHardware.py has no effect -> after x hours and restart/reboot is wasTimerWakeup = True)
        thisBox = getBoxType()
        if thisBox in ('ixussone', 'uniboxhd1', 'uniboxhd2', 'uniboxhd3',
                       'sezam5000hd', 'mbtwin',
                       'beyonwizt3') or getBrandOEM() in ('ebox', 'azbox',
                                                          'xp', 'ini', 'dags',
                                                          'fulan'):
            config.workaround.deeprecord.setValue(True)
            config.workaround.deeprecord.save()
            config.save()
            print "[NAVIGATION] USE DEEPSTAND-WORKAROUND FOR THIS BOXTYPE (%s) !!" % thisBox

        if not wasTimerWakeup and config.workaround.deeprecord.value:  #work-around for boxes where driver not sent was_timer_wakeup signal to e2
            print "=================================================================================="
            print "[NAVIGATION] getNextRecordingTime= %s" % nextRT
            print "[NAVIGATION] nextRecordTimerAfterEventActionAuto= %s" % nextRecordTimerAfterEventActionAuto
            print "[NAVIGATION] current Time=%s" % now
            print "[NAVIGATION] timediff=%s" % abs(timediffRT)
            print "=================================================================================="
            print "[NAVIGATION] getNextPowerManagerTime= %s" % nextPT[0][0]
            print "[NAVIGATION] nextPowerManagerAfterEventActionAuto= %s" % nextPowerManagerAfterEventActionAuto
            print "[NAVIGATION] current Time=%s" % now
            print "[NAVIGATION] timediff=%s" % abs(timediffPT)
            print "=================================================================================="

            if now <= 31536000:  # check for NTP-time sync, if no sync, wait for transponder time
                self.timesynctimer = eTimer()
                self.timesynctimer.callback.append(self.TimeSynctimer)
                self.timesynctimer.start(5000, True)
                print "[NAVIGATION] [work-around] wait for time sync"

            elif abs(
                    timediffRT
            ) <= 360:  # if there is a recording sheduled in the next 5 mins, set the wasTimerWakeup flag
                wasTimerWakeup = True
                f = open("/tmp/was_timer_wakeup_workaround.txt", "w")
                file = f.write(str(wasTimerWakeup))
                f.close()
            elif abs(timediffPT) <= 360 and (
                    nextPT[0][1] == PowerTimer.TIMERTYPE.WAKEUP
                    or nextPT[0][1] == PowerTimer.TIMERTYPE.WAKEUPTOSTANDBY
                    or nextPT[0][2] == PowerTimer.AFTEREVENT.WAKEUP
                    or nextPT[0][2] == PowerTimer.AFTEREVENT.WAKEUPTOSTANDBY
            ):  # if there is a power timer in the next 5 mins, set the wasTimerWakeup flag
                wasTimerWakeup = True
                f = open("/tmp/was_timer_wakeup_workaround.txt", "w")
                file = f.write(str(wasTimerWakeup))
                f.close()

        print "[NAVIGATION] wasTimerWakeup = %s" % wasTimerWakeup

        if wasTimerWakeup:
            self.__wasTimerWakeup = True
            if now <= 31536000:
                self.timesynctimer = eTimer()
                self.timesynctimer.callback.append(self.TimeSynctimer)
                self.timesynctimer.start(5000, True)
                print "[NAVIGATION] wait for time sync"

            elif self.nextRecordTimerAfterEventActionAuto and abs(
                    timediffRT) <= 360:
                self.__wasRecTimerWakeup = True
                print 'RECTIMER: wakeup to standby detected.'
                f = open("/tmp/was_rectimer_wakeup", "w")
                f.write('1')
                f.close()
                # as we woke the box to record, place the box in standby.
                self.standbytimer = eTimer()
                self.standbytimer.callback.append(self.gotostandby)
                self.standbytimer.start(15000, True)

            elif self.nextPowerManagerAfterEventActionAuto and abs(
                    timediffPT) <= 360 and (
                        nextPT[0][1] == PowerTimer.TIMERTYPE.WAKEUP
                        or nextPT[0][2] == PowerTimer.AFTEREVENT.WAKEUP):
                self.__wasPowerTimerWakeup = True
                print 'POWERTIMER: wakeup detected.'
                if abs(
                        timediffPT
                ) > 75:  #more than 1 minutes to wake up from powertimer - go in standby
                    self.standbytimer = eTimer()
                    self.standbytimer.callback.append(self.gotostandby)
                    self.standbytimer.start(15000, True)

            elif self.nextPowerManagerAfterEventActionAuto and abs(
                    timediffPT) <= 360 and (
                        nextPT[0][1] == PowerTimer.TIMERTYPE.WAKEUPTOSTANDBY or
                        nextPT[0][2] == PowerTimer.AFTEREVENT.WAKEUPTOSTANDBY):
                self.__wasPowerTimerWakeup = True
                print 'POWERTIMER: wakeup to standby detected.'
                f = open("/tmp/was_powertimer_wakeup", "w")
                f.write('1')
                f.close()
                # as a PowerTimer WakeToStandby was actiond to it.
                self.standbytimer = eTimer()
                self.standbytimer.callback.append(self.gotostandby)
                self.standbytimer.start(15000, True)
Example #29
0
    def __init__(self, wakeupData=None):
        if NavigationInstance.instance is not None:
            raise NavigationInstance.instance

        NavigationInstance.instance = self
        self.ServiceHandler = eServiceCenter.getInstance()

        import Navigation as Nav
        Nav.navcore = self

        self.pnav = pNavigation()
        self.pnav.m_event.get().append(self.dispatchEvent)
        self.pnav.m_record_event.get().append(self.dispatchRecordEvent)
        self.event = []
        self.record_event = []
        self.currentlyPlayingServiceReference = None
        self.currentlyPlayingServiceOrGroup = None
        self.currentlyPlayingService = None

        Screens.Standby.TVstate()
        self.skipWakeup = False

        self.RecordTimer = None
        self.isRecordTimerImageStandard = False
        if not self.RecordTimer:
            self.RecordTimer = RecordTimer.RecordTimer()
            self.isRecordTimerImageStandard = True

        self.PowerTimer = None
        self.PowerTimer = PowerTimer.PowerTimer()
        self.__wasTimerWakeup = False
        self.__wasRecTimerWakeup = False
        self.__wasPowerTimerWakeup = False

        #wakeup data
        now = time()
        try:
            self.lastshutdowntime, self.wakeuptime, self.timertime, self.wakeuptyp, self.getstandby, self.recordtime, self.forcerecord = [
                int(n) for n in wakeupData.split(',')
            ]
        except:
            print "=" * 100
            print "[NAVIGATION] ERROR: can't read wakeup data"
            self.lastshutdowntime, self.wakeuptime, self.timertime, self.wakeuptyp, self.getstandby, self.recordtime, self.forcerecord = int(
                now), -1, -1, 0, 0, -1, 0
        self.syncCount = 0
        hasFakeTime = (
            now <= 31536000 or now - self.lastshutdowntime <= 120
        ) and self.getstandby < 2  #set hasFakeTime only if lower than values and was last shutdown to deep standby
        wasTimerWakeup, wasTimerWakeup_failure = getFPWasTimerWakeup(True)
        #TODO: verify wakeup-state for boxes where only after shutdown removed the wakeup-state (for boxes where "/proc/stb/fp/was_timer_wakeup" is not writable (clearFPWasTimerWakeup() in StbHardware.py has no effect -> after x hours and restart/reboot is wasTimerWakeup = True)

        print "=" * 100
        print "[NAVIGATION] was timer wakeup = %s" % wasTimerWakeup
        print "[NAVIGATION] current time is %s -> it's fake-time suspected: %s" % (
            ctime(now), hasFakeTime)
        print "-" * 100

        thisBox = getBoxType()
        if not config.workaround.deeprecord.value and (
                wasTimerWakeup_failure or thisBox in
            ('ixussone', 'uniboxhd1', 'uniboxhd2', 'uniboxhd3', 'sezam5000hd',
             'mbtwin', 'beyonwizt3', 'et8000') or getBrandOEM()
                in ('ebox', 'azbox', 'xp', 'ini', 'fulan', 'entwopia')
                or getMachineBuild() in ('dags7335', 'dags7356', 'dags7362')):
            print "[NAVIGATION] FORCED DEEPSTANDBY-WORKAROUND FOR THIS BOXTYPE (%s)" % thisBox
            print "-" * 100
            config.workaround.deeprecord.setValue(True)
            config.workaround.deeprecord.save()
            config.save()

        if config.workaround.deeprecord.value:  #work-around for boxes where driver not sent was_timer_wakeup signal to e2
            print "[NAVIGATION] starting deepstandby-workaround"
            self.wakeupwindow_plus = self.timertime + 300
            self.wakeupwindow_minus = self.wakeuptime - (
                config.workaround.wakeupwindow.value * 60)
            wasTimerWakeup = False
            if not hasFakeTime and now >= self.wakeupwindow_minus and now <= self.wakeupwindow_plus:  # if there is a recording sheduled, set the wasTimerWakeup flag
                wasTimerWakeup = True
                f = open("/tmp/was_timer_wakeup_workaround.txt", "w")
                file = f.write(str(wasTimerWakeup))
                f.close()
        else:
            #secure wakeup window to prevent a wrong 'wasTimerWakeup' value as timer wakeup detection
            self.wakeupwindow_plus = self.timertime + 900
            self.wakeupwindow_minus = self.wakeuptime - 3600

        if self.wakeuptime > 0:
            print "[NAVIGATION] wakeup time from deep-standby expected: *** %s ***" % (
                ctime(self.wakeuptime))
            if config.workaround.deeprecord.value:
                print "[NAVIGATION] timer wakeup detection window: %s - %s" % (
                    ctime(self.wakeupwindow_minus),
                    ctime(self.wakeupwindow_plus))
        else:
            print "[NAVIGATION] wakeup time was not set"
        print "-" * 100

        if wasTimerWakeup:
            self.__wasTimerWakeup = True
            if not hasFakeTime:
                self.wakeupCheck()
                return

        if hasFakeTime and self.wakeuptime > 0:  # check for NTP-time sync, if no sync, wait for transponder time
            if Screens.Standby.TVinStandby.getTVstandby(
                    'waitfortimesync') and not wasTimerWakeup:
                Screens.Standby.TVinStandby.setTVstate('power')
            self.savedOldTime = now
            self.timesynctimer = eTimer()
            self.timesynctimer.callback.append(self.TimeSynctimer)
            self.timesynctimer.start(5000, True)
            print "[NAVIGATION] wait for time sync"
            print "~" * 100
        else:
            self.wakeupCheck(False)
Example #30
0
    def __init__(self, wakeupData = None):
        if NavigationInstance.instance is not None:
            raise NavigationInstance.instance
        NavigationInstance.instance = self
        self.ServiceHandler = eServiceCenter.getInstance()
        import Navigation as Nav
        Nav.navcore = self
        self.pnav = pNavigation()
        self.pnav.m_event.get().append(self.dispatchEvent)
        self.pnav.m_record_event.get().append(self.dispatchRecordEvent)
        self.event = []
        self.record_event = []
        self.currentlyPlayingServiceReference = None
        self.currentlyPlayingServiceOrGroup = None
        self.currentlyPlayingService = None
        self.RecordTimer = None
        self.isRecordTimerImageStandard = False
        for p in plugins.getPlugins(PluginDescriptor.WHERE_RECORDTIMER):
            self.RecordTimer = p()
            if self.RecordTimer:
                break

        if not self.RecordTimer:
            self.RecordTimer = RecordTimer.RecordTimer()
            self.isRecordTimerImageStandard = True
        self.PowerTimer = None
        self.PowerTimer = PowerTimer.PowerTimer()
        self.__wasTimerWakeup = False
        self.__wasRecTimerWakeup = False
        self.__wasPowerTimerWakeup = False
        try:
            self.wakeuptime, self.timertime, self.wakeuptyp, self.getstandby, self.recordtime, self.forcerecord = [ int(n) for n in wakeupData.split(',') ]
        except:
            print '=' * 100
            print "[NAVIGATION] ERROR: can't read wakeup data"
            self.wakeuptime, self.timertime, self.wakeuptyp, self.getstandby, self.recordtime, self.forcerecord = (-1, -1, 0, 0, -1, 0)

        now = time()
        timediff_wakeup = self.wakeuptime - now
        timediff_timer = self.timertime - now
        self.syncCount = 0
        wasTimerWakeup = getFPWasTimerWakeup()
        print '=' * 100
        thisBox = getBoxType()
        if not config.workaround.deeprecord.value and (thisBox in ('ixussone', 'uniboxhd1', 'uniboxhd2', 'uniboxhd3', 'sezam5000hd', 'mbtwin', 'beyonwizt3') or getBrandOEM() in ('ebox', 'azbox', 'xp', 'ini', 'dags', 'fulan', 'entwopia')):
            print '[NAVIGATION] FORCED DEEPSTANDBY-WORKAROUND FOR THIS BOXTYPE (%s)' % thisBox
            config.workaround.deeprecord.setValue(True)
            config.workaround.deeprecord.save()
            config.save()
        if config.workaround.deeprecord.value:
            wasTimerWakeup = False
            print '[NAVIGATION] starting deepstandby-workaround'
            if now <= 31536000:
                self.timesynctimer = eTimer()
                self.timesynctimer.callback.append(self.TimeSynctimer)
                self.timesynctimer.start(5000, True)
                print '[NAVIGATION] wait for time sync'
                print '~' * 100
            elif abs(timediff_wakeup) <= 600 or abs(timediff_timer) <= 600:
                wasTimerWakeup = True
                f = open('/tmp/was_timer_wakeup_workaround.txt', 'w')
                file = f.write(str(wasTimerWakeup))
                f.close()
        print '[NAVIGATION] was timer wakeup = %s' % wasTimerWakeup
        print '[NAVIGATION] current time is %s' % ctime(now)
        if wasTimerWakeup:
            self.__wasTimerWakeup = True
            print '-' * 100
            if self.wakeuptime > 0:
                print '[NAVIGATION] wakeup time was %s' % ctime(self.wakeuptime)
            else:
                print '[NAVIGATION] wakeup time was not set'
            if now <= 31536000:
                self.timesynctimer = eTimer()
                self.timesynctimer.callback.append(self.TimeSynctimer)
                self.timesynctimer.start(5000, True)
                print '[NAVIGATION] wait for time sync'
                print '~' * 100
            else:
                self.wakeupCheck()
        elif now > 31536000:
            if self.timertime > 0:
                print "[NAVIGATION] next '%s' starts at %s" % ({0: 'record-timer',
                  1: 'zap-timer',
                  2: 'power-timer',
                  3: 'plugin-timer'}[self.wakeuptyp], ctime(self.timertime))
            else:
                print '[NAVIGATION] no next timers'
            print '=' * 100
        return
Example #31
0
	def __init__(self, nextRecordTimerAfterEventActionAuto=False, nextPowerManagerAfterEventActionAuto=False):
		if NavigationInstance.instance is not None:
			raise NavigationInstance.instance

		NavigationInstance.instance = self
		self.ServiceHandler = eServiceCenter.getInstance()

		import Navigation as Nav
		Nav.navcore = self

		self.pnav = pNavigation()
		self.pnav.m_event.get().append(self.dispatchEvent)
		self.pnav.m_record_event.get().append(self.dispatchRecordEvent)
		self.event = [ ]
		self.record_event = [ ]
		self.currentlyPlayingServiceReference = None
		
		self.RecordTimer = None
		for p in plugins.getPlugins(PluginDescriptor.WHERE_RECORDTIMER):
			self.RecordTimer = p()
			if self.RecordTimer:
				break
		if not self.RecordTimer:

		self.currentlyPlayingServiceOrGroup = None
		self.currentlyPlayingService = None
		self.RecordTimer = RecordTimer.RecordTimer()
		self.PowerTimer = PowerTimer.PowerTimer()
		self.nextRecordTimerAfterEventActionAuto = nextRecordTimerAfterEventActionAuto
		self.nextPowerManagerAfterEventActionAuto = nextPowerManagerAfterEventActionAuto
		self.__wasTimerWakeup = False
		self.__wasRecTimerWakeup = False
		self.__wasPowerTimerWakeup = False
		self.syncCount = 0

		wasTimerWakeup = getFPWasTimerWakeup()
		thisBox = getBoxType()
		if thisBox in ('ixussone', 'uniboxhd1', 'uniboxhd2', 'uniboxhd3', 'sezam5000hd', 'mbtwin', 'beyonwizt3') or getBrandOEM() in ('ebox', 'azbox', 'xp', 'ini', 'dags', 'fulan'):
			config.workaround.deeprecord.setValue(True)
			config.workaround.deeprecord.save()
			config.save()
			print"[NAVIGATION] USE DEEPSTAND-WORKAROUND FOR THIS BOXTYPE (%s) !!" %thisBox
		
		if not wasTimerWakeup and config.workaround.deeprecord.value: #work-around for boxes where driver not sent was_timer_wakeup signal to e2
			print"=================================================================================="
			print"[NAVIGATION] getNextRecordingTime= %s" % self.RecordTimer.getNextRecordingTime()
			print"[NAVIGATION] nextRecordTimerAfterEventActionAuto= %s" % nextRecordTimerAfterEventActionAuto
			print"[NAVIGATION] current Time=%s" % time()
			print"[NAVIGATION] timediff=%s" % abs(self.RecordTimer.getNextRecordingTime() - time())
			print"=================================================================================="
			print"[NAVIGATION] getNextPowerManagerTime= %s" % self.PowerTimer.getNextPowerManagerTime()
			print"[NAVIGATION] nextPowerManagerAfterEventActionAuto= %s" % nextPowerManagerAfterEventActionAuto
			print"[NAVIGATION] current Time=%s" % time()
			print"[NAVIGATION] timediff=%s" % abs(self.PowerTimer.getNextPowerManagerTime() - time())
			print"=================================================================================="

			if time() <= 31536000: # check for NTP-time sync, if no sync, wait for transponder time
				self.timesynctimer = eTimer()
				self.timesynctimer.callback.append(self.TimeSynctimer)
				self.timesynctimer.start(5000, True)
				print"[NAVIGATION] [work-around] wait for time sync"
				
			elif abs(self.RecordTimer.getNextRecordingTime() - time()) <= 360: # if there is a recording sheduled in the next 5 mins, set the wasTimerWakeup flag
				wasTimerWakeup = True
				f = open("/tmp/was_timer_wakeup_workaround.txt", "w")
				file = f.write(str(wasTimerWakeup))
				f.close()
			elif abs(self.PowerTimer.getNextPowerManagerTime() - time()) <= 360: # if there is a power timer in the next 5 mins, set the wasTimerWakeup flag
				wasTimerWakeup = True
				f = open("/tmp/was_timer_wakeup_workaround.txt", "w")
				file = f.write(str(wasTimerWakeup))
				f.close()

		print"[NAVIGATION] wasTimerWakeup = %s" % wasTimerWakeup

		if wasTimerWakeup:
			self.__wasTimerWakeup = True
			if time() <= 31536000:
				self.timesynctimer = eTimer()
				self.timesynctimer.callback.append(self.TimeSynctimer)
				self.timesynctimer.start(5000, True)
				print"[NAVIGATION] wait for time sync"

			elif nextRecordTimerAfterEventActionAuto and abs(self.RecordTimer.getNextRecordingTime() - time()) <= 360:
				self.__wasRecTimerWakeup = True
				print 'RECTIMER: wakeup to standby detected.'
				f = open("/tmp/was_rectimer_wakeup", "w")
				f.write('1')
				f.close()
				# as we woke the box to record, place the box in standby.
				self.standbytimer = eTimer()
				self.standbytimer.callback.append(self.gotostandby)
				self.standbytimer.start(15000, True)

			elif nextPowerManagerAfterEventActionAuto:
				self.__wasPowerTimerWakeup = True
				print 'POWERTIMER: wakeup to standby detected.'
				f = open("/tmp/was_powertimer_wakeup", "w")
				f.write('1')
				f.close()
				# as a PowerTimer WakeToStandby was actiond to it.
				self.standbytimer = eTimer()
				self.standbytimer.callback.append(self.gotostandby)
				self.standbytimer.start(15000, True)

	def wasTimerWakeup(self):
		return self.__wasTimerWakeup

	def wasRecTimerWakeup(self):
		return self.__wasRecTimerWakeup

	def wasPowerTimerWakeup(self):
		return self.__wasPowerTimerWakeup

	def TimeSynctimer(self):
		self.syncCount += 1
		if self.nextRecordTimerAfterEventActionAuto and abs(self.RecordTimer.getNextRecordingTime() - time()) <= 360:
			self.__wasRecTimerWakeup = True
			print 'RECTIMER: wakeup to standby detected.'
			print"[NAVIGATION] getNextRecordingTime= %s" % self.RecordTimer.getNextRecordingTime()
			print"[NAVIGATION] current Time=%s" % time()
			print"[NAVIGATION] timediff=%s" % abs(self.RecordTimer.getNextRecordingTime() - time())
			f = open("/tmp/was_rectimer_wakeup", "w")
			f.write('1')
			f.close()
			self.gotostandby()
		elif self.nextPowerManagerAfterEventActionAuto and abs(self.PowerTimer.getNextPowerManagerTime() - time()) <= 360:
			self.__wasPowerTimerWakeup = True
			print 'POWERTIMER: wakeup to standby detected.'
			print"[NAVIGATION] getNextPowerManagerTime= %s" % self.PowerTimer.getNextPowerManagerTime()
			print"[NAVIGATION] current Time=%s" % time()
			print"[NAVIGATION] timediff=%s" % abs(self.PowerTimer.getNextPowerManagerTime() - time())
			f = open("/tmp/was_powertimer_wakeup", "w")
			f.write('1')
			f.close()
			self.gotostandby()
		else:
			if self.syncCount <= 24 and time() <= 31536000: # max 2 mins or when time is in sync
				self.timesynctimer.start(5000, True)
			else:
				print"[NAVIGATION] No Recordings/PowerTimers found, end work-around"

		if self.nextRecordTimerAfterEventActionAuto:
			print"[NAVIGATION] wasTimerWakeup after time sync = %s, sync time = %s sec." % (self.__wasRecTimerWakeup, self.syncCount * 5)
		elif self.nextPowerManagerAfterEventActionAuto:
			print"[NAVIGATION] wasPowerTimerWakeup after time sync = %s, sync time = %s sec." % (self.__wasPowerTimerWakeup, self.syncCount * 5)

	def gotostandby(self):
		print '[NAVIGATION] TIMER: now entering standby'
		from Tools import Notifications
		Notifications.AddNotification(Screens.Standby.Standby)

	def dispatchEvent(self, i):
		for x in self.event:
			x(i)
		if i == iPlayableService.evEnd:
			self.currentlyPlayingServiceReference = None
			self.currentlyPlayingServiceOrGroup = None
			self.currentlyPlayingService = None

	def dispatchRecordEvent(self, rec_service, event):
#		print "record_event", rec_service, event
		for x in self.record_event:
			x(rec_service, event)

	def playService(self, ref, checkParentalControl=True, forceRestart=False, adjust=True):
		oldref = self.currentlyPlayingServiceOrGroup
		if ref and oldref and ref == oldref and not forceRestart:
			print "ignore request to play already running service(1)"
			return 1
		print "playing", ref and ref.toString()
		if path.exists("/proc/stb/lcd/symbol_signal") and config.lcd.mode.value == '1':
			try:
				if '0:0:0:0:0:0:0:0:0' not in ref.toString():
					signal = 1
				else:
					signal = 0
				f = open("/proc/stb/lcd/symbol_signal", "w")
				f.write(str(signal))
				f.close()
			except:
				f = open("/proc/stb/lcd/symbol_signal", "w")
				f.write("0")
				f.close()
		elif path.exists("/proc/stb/lcd/symbol_signal") and config.lcd.mode.value == '0':
			f = open("/proc/stb/lcd/symbol_signal", "w")
			f.write("0")
			f.close()

		if ref is None:
			self.stopService()
			return 0
		from Components.ServiceEventTracker import InfoBarCount
		InfoBarInstance = InfoBarCount == 1 and InfoBar.instance
		if not checkParentalControl or parentalControl.isServicePlayable(ref, boundFunction(self.playService, checkParentalControl=False, forceRestart=forceRestart, adjust=adjust)):
			if ref.flags & eServiceReference.isGroup:
				oldref = self.currentlyPlayingServiceReference or eServiceReference()
				playref = getBestPlayableServiceReference(ref, oldref)
				print "playref", playref
				if playref and oldref and playref == oldref and not forceRestart:
					print "ignore request to play already running service(2)"
					return 1
				if not playref or (checkParentalControl and not parentalControl.isServicePlayable(playref, boundFunction(self.playService, checkParentalControl = False))):
					self.stopService()
					return 0
			else:
				playref = ref
			if self.pnav:
				self.pnav.stopService()
				self.currentlyPlayingServiceReference = playref
				self.currentlyPlayingServiceOrGroup = ref
				if InfoBarInstance and InfoBarInstance.servicelist.servicelist.setCurrent(ref, adjust):
					self.currentlyPlayingServiceOrGroup = InfoBarInstance.servicelist.servicelist.getCurrent()

				if ref.toString().find('//') == -1 and SystemInfo["isGBIPBOX"]:
					playref = ZAP.gref(ref, self.pnav)

				if self.pnav.playService(playref):
					print "Failed to start", playref
					self.currentlyPlayingServiceReference = None
					self.currentlyPlayingServiceOrGroup = None
				return 0
		elif oldref and InfoBarInstance and InfoBarInstance.servicelist.servicelist.setCurrent(oldref, adjust):
			self.currentlyPlayingServiceOrGroup = InfoBarInstance.servicelist.servicelist.getCurrent()
		return 1

	def getCurrentlyPlayingServiceReference(self):
		return self.currentlyPlayingServiceReference

	def getCurrentlyPlayingServiceOrGroup(self):
		return self.currentlyPlayingServiceOrGroup

	def isMovieplayerActive(self):
		MoviePlayerInstance = MoviePlayer.instance
		if MoviePlayerInstance is not None and '0:0:0:0:0:0:0:0:0' in self.currentlyPlayingServiceReference.toString():
			from Screens.InfoBarGenerics import setResumePoint
			setResumePoint(MoviePlayer.instance.session)
			MoviePlayerInstance.close()

	def recordService(self, ref, simulate=False):
		service = None
		if not simulate: print "recording service: %s" % (str(ref))
		if isinstance(ref, ServiceReference.ServiceReference):
			ref = ref.ref
		if ref:
			if ref.flags & eServiceReference.isGroup:
				ref = getBestPlayableServiceReference(ref, eServiceReference(), simulate)
			service = ref and self.pnav and self.pnav.recordService(ref, simulate)
			if service is None:
				print "record returned non-zero"
		return service

	def stopRecordService(self, service):
		ret = self.pnav and self.pnav.stopRecordService(service)
		return ret

	def getRecordings(self, simulate=False):
		return self.pnav and self.pnav.getRecordings(simulate)

	def getCurrentService(self):
		if not self.currentlyPlayingService:
			self.currentlyPlayingService = self.pnav and self.pnav.getCurrentService()
		return self.currentlyPlayingService

	def stopService(self):
		if self.pnav:
			self.pnav.stopService()
		self.currentlyPlayingServiceReference = None
		self.currentlyPlayingServiceOrGroup = None
		if path.exists("/proc/stb/lcd/symbol_signal"):
			f = open("/proc/stb/lcd/symbol_signal", "w")
			f.write("0")
			f.close()

	def pause(self, p):
		return self.pnav and self.pnav.pause(p)

	def shutdown(self):
		self.RecordTimer.shutdown()
		self.PowerTimer.shutdown()
		self.ServiceHandler = None
		self.pnav = None

	def stopUserServices(self):
		self.stopService()
Example #32
0
	def __init__(self, nextRecordTimerAfterEventActionAuto=False, nextPowerManagerAfterEventActionAuto=False):
		if NavigationInstance.instance is not None:
			raise NavigationInstance.instance

		NavigationInstance.instance = self
		self.ServiceHandler = eServiceCenter.getInstance()

		import Navigation as Nav
		Nav.navcore = self

		self.pnav = pNavigation()
		self.pnav.m_event.get().append(self.dispatchEvent)
		self.pnav.m_record_event.get().append(self.dispatchRecordEvent)
		self.event = [ ]
		self.record_event = [ ]
		self.currentlyPlayingServiceReference = None
		self.currentlyPlayingServiceOrGroup = None
		self.currentlyPlayingService = None
		self.RecordTimer = RecordTimer.RecordTimer()
		self.PowerTimer = PowerTimer.PowerTimer()
		self.nextRecordTimerAfterEventActionAuto = nextRecordTimerAfterEventActionAuto
		self.nextPowerManagerAfterEventActionAuto = nextPowerManagerAfterEventActionAuto
		self.__wasTimerWakeup = False
		self.__wasRecTimerWakeup = False
		self.__wasPowerTimerWakeup = False
		self.syncCount = 0

		wasTimerWakeup = getFPWasTimerWakeup()
		thisBox = getBoxType()
		if thisBox in ('ixussone', 'uniboxhd1', 'uniboxhd2', 'uniboxhd3', 'sezam5000hd', 'mbtwin', 'beyonwizt3') or getBrandOEM() in ('ebox', 'azbox', 'xp', 'ini', 'dags', 'fulan'):
			config.workaround.deeprecord.setValue(True)
			config.workaround.deeprecord.save()
			config.save()
			print"[NAVIGATION] USE DEEPSTAND-WORKAROUND FOR THIS BOXTYPE (%s) !!" %thisBox
		
		if not wasTimerWakeup and config.workaround.deeprecord.value: #work-around for boxes where driver not sent was_timer_wakeup signal to e2
			print"=================================================================================="
			print"[NAVIGATION] getNextRecordingTime= %s" % self.RecordTimer.getNextRecordingTime()
			print"[NAVIGATION] nextRecordTimerAfterEventActionAuto= %s" % nextRecordTimerAfterEventActionAuto
			print"[NAVIGATION] current Time=%s" % time()
			print"[NAVIGATION] timediff=%s" % abs(self.RecordTimer.getNextRecordingTime() - time())
			print"=================================================================================="
			print"[NAVIGATION] getNextPowerManagerTime= %s" % self.PowerTimer.getNextPowerManagerTime()
			print"[NAVIGATION] nextPowerManagerAfterEventActionAuto= %s" % nextPowerManagerAfterEventActionAuto
			print"[NAVIGATION] current Time=%s" % time()
			print"[NAVIGATION] timediff=%s" % abs(self.PowerTimer.getNextPowerManagerTime() - time())
			print"=================================================================================="

			if time() <= 31536000: # check for NTP-time sync, if no sync, wait for transponder time
				self.timesynctimer = eTimer()
				self.timesynctimer.callback.append(self.TimeSynctimer)
				self.timesynctimer.start(5000, True)
				print"[NAVIGATION] [work-around] wait for time sync"
				
			elif abs(self.RecordTimer.getNextRecordingTime() - time()) <= 360: # if there is a recording sheduled in the next 5 mins, set the wasTimerWakeup flag
				wasTimerWakeup = True
				f = open("/tmp/was_timer_wakeup_workaround.txt", "w")
				file = f.write(str(wasTimerWakeup))
				f.close()
			elif abs(self.PowerTimer.getNextPowerManagerTime() - time()) <= 360: # if there is a power timer in the next 5 mins, set the wasTimerWakeup flag
				wasTimerWakeup = True
				f = open("/tmp/was_timer_wakeup_workaround.txt", "w")
				file = f.write(str(wasTimerWakeup))
				f.close()

		print"[NAVIGATION] wasTimerWakeup = %s" % wasTimerWakeup

		if wasTimerWakeup:
			self.__wasTimerWakeup = True
			if time() <= 31536000:
				self.timesynctimer = eTimer()
				self.timesynctimer.callback.append(self.TimeSynctimer)
				self.timesynctimer.start(5000, True)
				print"[NAVIGATION] wait for time sync"

			elif nextRecordTimerAfterEventActionAuto and abs(self.RecordTimer.getNextRecordingTime() - time()) <= 360:
				self.__wasRecTimerWakeup = True
				print 'RECTIMER: wakeup to standby detected.'
				f = open("/tmp/was_rectimer_wakeup", "w")
				f.write('1')
				f.close()
				# as we woke the box to record, place the box in standby.
				self.standbytimer = eTimer()
				self.standbytimer.callback.append(self.gotostandby)
				self.standbytimer.start(15000, True)

			elif nextPowerManagerAfterEventActionAuto:
				self.__wasPowerTimerWakeup = True
				print 'POWERTIMER: wakeup to standby detected.'
				f = open("/tmp/was_powertimer_wakeup", "w")
				f.write('1')
				f.close()
				# as a PowerTimer WakeToStandby was actiond to it.
				self.standbytimer = eTimer()
				self.standbytimer.callback.append(self.gotostandby)
				self.standbytimer.start(15000, True)
Example #33
0
    def __init__(self, wakeupData=None):
        if NavigationInstance.instance is not None:
            raise NavigationInstance.instance
        NavigationInstance.instance = self
        self.ServiceHandler = eServiceCenter.getInstance()
        import Navigation as Nav
        Nav.navcore = self
        self.pnav = pNavigation()
        self.pnav.m_event.get().append(self.dispatchEvent)
        self.pnav.m_record_event.get().append(self.dispatchRecordEvent)
        self.event = []
        self.record_event = []
        self.currentlyPlayingServiceReference = None
        self.currentlyPlayingServiceOrGroup = None
        self.currentlyPlayingService = None
        self.RecordTimer = None
        self.isRecordTimerImageStandard = False
        for p in plugins.getPlugins(PluginDescriptor.WHERE_RECORDTIMER):
            self.RecordTimer = p()
            if self.RecordTimer:
                break

        if not self.RecordTimer:
            self.RecordTimer = RecordTimer.RecordTimer()
            self.isRecordTimerImageStandard = True
        self.PowerTimer = None
        self.PowerTimer = PowerTimer.PowerTimer()
        self.__wasTimerWakeup = False
        self.__wasRecTimerWakeup = False
        self.__wasPowerTimerWakeup = False
        try:
            self.wakeuptime, self.timertime, self.wakeuptyp, self.getstandby, self.recordtime, self.forcerecord = [
                int(n) for n in wakeupData.split(',')
            ]
        except:
            print '=' * 100
            print "[NAVIGATION] ERROR: can't read wakeup data"
            self.wakeuptime, self.timertime, self.wakeuptyp, self.getstandby, self.recordtime, self.forcerecord = (
                -1, -1, 0, 0, -1, 0)

        now = time()
        self.wakeupwindow_plus = self.timertime + 300
        self.wakeupwindow_minus = self.wakeuptime - config.workaround.wakeupwindow.value * 60
        self.syncCount = 0
        wasTimerWakeup, wasTimerWakeup_failure = getFPWasTimerWakeup(True)
        print '=' * 100
        if self.wakeuptime > 0:
            print '[NAVIGATION] wakeup time from deep-standby expected: *** %s ***' % ctime(
                self.wakeuptime)
            print '[NAVIGATION] timer wakeup detection window: %s - %s' % (
                ctime(self.wakeupwindow_minus), ctime(self.wakeupwindow_plus))
            print '-' * 100
        thisBox = getBoxType()
        if not config.workaround.deeprecord.value and (
                wasTimerWakeup_failure or thisBox
                in ('ixussone', 'uniboxhd1', 'uniboxhd2', 'uniboxhd3',
                    'sezam5000hd', 'mbtwin', 'beyonwizt3') or getBrandOEM() in
            ('ebox', 'azbox', 'xp', 'ini', 'dags', 'fulan', 'entwopia')):
            print '[NAVIGATION] FORCED DEEPSTANDBY-WORKAROUND FOR THIS BOXTYPE (%s)' % thisBox
            config.workaround.deeprecord.setValue(True)
            config.workaround.deeprecord.save()
            config.save()
        if config.workaround.deeprecord.value:
            wasTimerWakeup = False
            print '[NAVIGATION] starting deepstandby-workaround'
            if now <= 31536000:
                self.timesynctimer = eTimer()
                self.timesynctimer.callback.append(self.TimeSynctimer)
                self.timesynctimer.start(5000, True)
                print '[NAVIGATION] wait for time sync'
                print '~' * 100
            elif now >= self.wakeupwindow_minus and now <= self.wakeupwindow_plus:
                wasTimerWakeup = True
                f = open('/tmp/was_timer_wakeup_workaround.txt', 'w')
                file = f.write(str(wasTimerWakeup))
                f.close()
        print '[NAVIGATION] was timer wakeup = %s' % wasTimerWakeup
        print '[NAVIGATION] current time is %s' % ctime(now)
        if wasTimerWakeup:
            self.__wasTimerWakeup = True
            print '-' * 100
            if self.wakeuptime > 0:
                print '[NAVIGATION] wakeup time was %s' % ctime(
                    self.wakeuptime)
            else:
                print '[NAVIGATION] wakeup time was not set'
            if now <= 31536000:
                self.timesynctimer = eTimer()
                self.timesynctimer.callback.append(self.TimeSynctimer)
                self.timesynctimer.start(5000, True)
                print '[NAVIGATION] wait for time sync'
                print '~' * 100
            else:
                self.wakeupCheck()
        elif now > 31536000:
            if self.timertime > 0:
                print "[NAVIGATION] next '%s' starts at %s" % (
                    {
                        0: 'record-timer',
                        1: 'zap-timer',
                        2: 'power-timer',
                        3: 'plugin-timer'
                    }[self.wakeuptyp], ctime(self.timertime))
            else:
                print '[NAVIGATION] no next timers'
            print '=' * 100