Exemplo n.º 1
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)
Exemplo n.º 2
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()
Exemplo n.º 3
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()
Exemplo n.º 4
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()
Exemplo n.º 5
0
	def __init__(self):
		assert not HdmiCec.instance, "only one HdmiCec instance is allowed!"
		HdmiCec.instance = self

		self.wait = eTimer()
		self.wait.timeout.get().append(self.sendCmd)
		self.waitKeyEvent = eTimer()
		self.waitKeyEvent.timeout.get().append(self.sendKeyEvent)
		self.queueKeyEvent = []
		self.repeat = eTimer()
		self.repeat.timeout.get().append(self.wakeupMessages)
		self.queue = []

		self.delay = eTimer()
		self.delay.timeout.get().append(self.sendStandbyMessages)
		self.useStandby = True

		eHdmiCEC.getInstance().messageReceived.get().append(self.messageReceived)
		config.misc.standbyCounter.addNotifier(self.onEnterStandby, initial_call = False)
		config.misc.DeepStandby.addNotifier(self.onEnterDeepStandby, initial_call = False)
		self.setFixedPhysicalAddress(config.hdmicec.fixed_physical_address.value)

		self.volumeForwardingEnabled = False
		self.volumeForwardingDestination = 0
		self.wakeup_from_tv = False
		eActionMap.getInstance().bindAction('', -maxint - 1, self.keyEvent)
		config.hdmicec.volume_forwarding.addNotifier(self.configVolumeForwarding)
		config.hdmicec.enabled.addNotifier(self.configVolumeForwarding)
		if config.hdmicec.enabled.value:
			if config.hdmicec.report_active_menu.value:
				if config.hdmicec.report_active_source.value and NavigationInstance.instance and not NavigationInstance.instance.isRestartUI():
					self.sendMessage(0, "sourceinactive")
				self.sendMessage(0, "menuactive")
			if config.hdmicec.handle_deepstandby_events.value and (not getFPWasTimerWakeup() or (config.usage.startup_to_standby.value == "no" and config.misc.prev_wakeup_time_type.value == 3)):
				self.onLeaveStandby()
Exemplo n.º 6
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()
Exemplo n.º 7
0
    def __init__(self):
        assert not HdmiCec.instance, "only one HdmiCec instance is allowed!"
        HdmiCec.instance = self

        self.wait = eTimer()
        self.wait.timeout.get().append(self.sendCmd)
        self.queue = []

        eHdmiCEC.getInstance().messageReceived.get().append(
            self.messageReceived)
        config.misc.standbyCounter.addNotifier(self.onEnterStandby,
                                               initial_call=False)
        config.misc.DeepStandby.addNotifier(self.onEnterDeepStandby,
                                            initial_call=False)
        self.setFixedPhysicalAddress(
            config.hdmicec.fixed_physical_address.value)

        self.volumeForwardingEnabled = False
        self.volumeForwardingDestination = 0
        eActionMap.getInstance().bindAction('', -maxint - 1, self.keyEvent)
        config.hdmicec.volume_forwarding.addNotifier(
            self.configVolumeForwarding)
        config.hdmicec.enabled.addNotifier(self.configVolumeForwarding)
        if config.hdmicec.handle_deepstandby_events.value:
            if not getFPWasTimerWakeup():
                self.wakeupMessages()
Exemplo n.º 8
0
	def __init__(self, session, alt_bouquet_count):
		self.reclist = {}
		self.session = session
		self.anchor = config.plugins.RecInfobar.anchor.value
		self.acount = alt_bouquet_count

		Screen.__init__(self, session)
		self.skinName = ["RecInfoBar_" + self.__class__.__name__, "RecInfoBar"]
		self.labels = ["chNum", "chName", "timelen", "chProv", "chBouq", "recName", "chTuner", "remaining", "chSnr"]
		for x in self.labels:
			self[x] = Label("")
		self.RecIndicator = None
		self.updateTimer = eTimer()
		self.updateTimer.callback.append(self.updateInfo)
		self.onClose.append(self.__onClose)
		self.onShow.append(self.__onShow)
		config.plugins.RecInfobar.x.addNotifier(self.__changePosition, False)
		config.plugins.RecInfobar.y.addNotifier(self.__changePosition, False)
		config.plugins.RecInfobar.rec_indicator.addNotifier(self.stateRecIndicator)
		self.onLayoutFinish.append(self.__onLayoutFinished)
		self.rec_ref = None
		self.zap_ref = None 
		self.no_decode = False
		self.SetPosition = False
		config.misc.rectimerstate.value = False
		config.misc.rectimerstate.save()
		NavigationInstance.instance.RecordTimer.on_state_change.append(self.timerEntryOnStateChange)
		config.recording.asktozap.addNotifier(self.asktozapChanged)
		if config.plugins.RecInfobar.check_wakeup.value and getFPWasTimerWakeup():
			self.checkTimer = eTimer()
			self.checkTimer.callback.append(self.checkWakeup)
			self.checkTimer.start(20000, True)
Exemplo n.º 9
0
	def __init__(self, session, alt_bouquet_count):
		self.reclist = {}
		self.session = session
		self.anchor = config.plugins.RecInfobar.anchor.value
		self.acount = alt_bouquet_count

		Screen.__init__(self, session)
		self.skinName = ["RecInfoBar_" + self.__class__.__name__, "RecInfoBar"]
		self.labels = ["chNum","chName","timelen","chProv","chBouq","recName","chTuner", "remaining", "chSnr"]
		for x in self.labels:
			self[x] = Label("")
		self.RecIndicator = None
		self.updateTimer = eTimer()
		self.updateTimer.callback.append(self.updateInfo)
		self.onClose.append(self.__onClose)
		self.onShow.append(self.__onShow)
		config.plugins.RecInfobar.x.addNotifier(self.__changePosition, False)
		config.plugins.RecInfobar.y.addNotifier(self.__changePosition, False)
		config.plugins.RecInfobar.rec_indicator.addNotifier(self.stateRecIndicator)
		self.onLayoutFinish.append(self.__onLayoutFinished)
		self.rec_ref = None
		self.zap_ref = None 
		self.no_decode = False
		self.SetPosition = False
		config.misc.rectimerstate.value = False
		config.misc.rectimerstate.save()
		NavigationInstance.instance.RecordTimer.on_state_change.append(self.timerEntryOnStateChange)
		config.recording.asktozap.addNotifier(self.asktozapChanged)
		if config.plugins.RecInfobar.check_wakeup.value and getFPWasTimerWakeup():
			self.checkTimer = eTimer()
			self.checkTimer.callback.append(self.checkWakeup)
			self.checkTimer.start(20000, True)
Exemplo n.º 10
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()
Exemplo n.º 11
0
 def checkNextAfterEventAuto(self):
     if getFPWasTimerWakeup(
     ) and config.plugins.vps.allow_wakeup.value and len(
             self.session.nav.RecordTimer.timer_list) > 0:
         next_timer = self.session.nav.RecordTimer.timer_list[0]
         if next_timer.vpsplugin_enabled and next_timer.afterEvent == AFTEREVENT.AUTO and (
                 next_timer.begin -
             (config.plugins.vps.initial_time.value * 60) - 300) < time():
             next_timer.vpsplugin_wasTimerWakeup = True
    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()
Exemplo n.º 13
0
	def runCheckDeepstandby(self):
		print>>log, "[XMLTVImport] Run check deep standby after import"
		if config.plugins.epgimport.shutdown.value and config.plugins.epgimport.deepstandby.value == 'wakeup':
			if config.plugins.epgimport.deepstandby_afterimport.value and getFPWasTimerWakeup():
				config.plugins.epgimport.deepstandby_afterimport.value = False
				if Screens.Standby.inStandby and not self.session.nav.getRecordings() and not Screens.Standby.inTryQuitMainloop:
					print>>log, "[XMLTVImport] Returning to deep standby after wake up for import"
					self.session.open(Screens.Standby.TryQuitMainloop, 1)
				else:
					print>>log, "[XMLTVImport] No return to deep standby, not standby or running recording"
Exemplo n.º 14
0
	def runCheckDeepstandby(self):
		print>>log, "[XMLTVImport] Run check deep standby after import"
		if config.plugins.epgimport.shutdown.value and config.plugins.epgimport.deepstandby.value == 'wakeup':
			if config.plugins.epgimport.deepstandby_afterimport.value and getFPWasTimerWakeup():
				config.plugins.epgimport.deepstandby_afterimport.value = False
				if Screens.Standby.inStandby and not self.session.nav.getRecordings() and not Screens.Standby.inTryQuitMainloop:
					print>>log, "[XMLTVImport] Returning to deep standby after wake up for import"
					self.session.open(Screens.Standby.TryQuitMainloop, 1)
				else:
					print>>log, "[XMLTVImport] No return to deep standby, not standby or running recording"
def onBootStartCheck():
	global autoStartTimer
	print>>log, "[EPGImport] onBootStartCheck"
	now = int(time.time())
	wake = autoStartTimer.getStatus()
	print>>log, "[EPGImport] now=%d wake=%d wake-now=%d" % (now, wake, wake-now)
	if (wake < 0) or (wake - now > 600):
		on_start = False
		if config.plugins.epgimport.runboot.value == "1":
			on_start = True
			print>>log, "[EPGImport] is boot"
		elif config.plugins.epgimport.runboot.value == "2" and not getFPWasTimerWakeup():
			on_start = True
			print>>log, "[EPGImport] is manual boot"
		elif config.plugins.epgimport.runboot.value == "3" and getFPWasTimerWakeup():
			on_start = True
			print>>log, "[EPGImport] is automatic boot"
		flag = '/tmp/.EPGImportAnswerBoot'
		if config.plugins.epgimport.runboot_restart.value and config.plugins.epgimport.runboot.value != "3":
			if os.path.exists(flag):
				on_start = False
				print>>log, "[EPGImport] not starting import - is restart enigma2"
			else:
				try:
					open(flag, 'wb').close()
				except:
					print>>log, "Failed to create /tmp/.EPGImportAnswerBoot"
		if config.plugins.epgimport.runboot_day.value:
			from time import localtime as my_localtime
			now = my_localtime()
			cur_day = int(now.tm_wday)
			if not config.plugins.extra_epgimport.day_import[cur_day].value:
				on_start = False
				print>>log, "[EPGImport] wakeup day of week does not match"
		if on_start:
			print>>log, "[EPGImport] starting import because auto-run on boot is enabled"
			autoStartTimer.runImport()
	else:
		print>>log, "[EPGImport] import to start in less than 10 minutes anyway, skipping..."
Exemplo n.º 16
0
    def __init__(self):
        try:
            if HdmiCec.instance:
                raise AssertionError("only one HdmiCec instance is allowed!")
        except:
            pass
        HdmiCec.instance = self

        self.wait = eTimer()
        self.wait.timeout.get().append(self.sendCmd)
        self.waitKeyEvent = eTimer()
        self.waitKeyEvent.timeout.get().append(self.sendKeyEvent)
        self.queueKeyEvent = []
        self.repeat = eTimer()
        self.repeat.timeout.get().append(self.wakeupMessages)
        self.queue = []

        self.delay = eTimer()
        self.delay.timeout.get().append(self.sendStandbyMessages)
        self.useStandby = True

        self.handlingStandbyFromTV = False

        eHdmiCEC.getInstance().messageReceived.get().append(
            self.messageReceived)
        config.misc.standbyCounter.addNotifier(self.onEnterStandby,
                                               initial_call=False)
        config.misc.DeepStandby.addNotifier(self.onEnterDeepStandby,
                                            initial_call=False)
        self.setFixedPhysicalAddress(
            config.hdmicec.fixed_physical_address.value)

        self.volumeForwardingEnabled = False
        self.volumeForwardingDestination = 0
        self.wakeup_from_tv = False
        eActionMap.getInstance().bindAction('', -sys.maxsize - 1,
                                            self.keyEvent)
        config.hdmicec.volume_forwarding.addNotifier(
            self.configVolumeForwarding)
        config.hdmicec.enabled.addNotifier(self.configVolumeForwarding)
        if config.hdmicec.enabled.value:
            if config.hdmicec.report_active_menu.value:
                if config.hdmicec.report_active_source.value and NavigationInstance.instance and not NavigationInstance.instance.isRestartUI(
                ):
                    self.sendMessage(0, "sourceinactive")
                self.sendMessage(0, "menuactive")
            if config.hdmicec.handle_deepstandby_events.value and (
                    not getFPWasTimerWakeup() or
                (config.usage.startup_to_standby.value == "no"
                 and config.misc.prev_wakeup_time_type.value == 3)):
                self.onLeaveStandby()
Exemplo n.º 17
0
def onBootStartCheck():
	global autoStartTimer
	print>>log, "[XMLTVImport] onBootStartCheck"
	now = int(time.time())
	wake = autoStartTimer.getStatus()
	print>>log, "[XMLTVImport] now=%d wake=%d wake-now=%d" % (now, wake, wake - now)
	if (wake < 0) or (wake - now > 600):
		on_start = False
		if config.plugins.epgimport.runboot.value == "1":
			on_start = True
			print>>log, "[XMLTVImport] is boot"
		elif config.plugins.epgimport.runboot.value == "2" and not getFPWasTimerWakeup():
			on_start = True
			print>>log, "[XMLTVImport] is manual boot"
		elif config.plugins.epgimport.runboot.value == "3" and getFPWasTimerWakeup():
			on_start = True
			print>>log, "[XMLTVImport] is automatic boot"
		flag = '/tmp/.EPGImportAnswerBoot'
		if config.plugins.epgimport.runboot_restart.value and config.plugins.epgimport.runboot.value != "3":
			if os.path.exists(flag):
				on_start = False
				print>>log, "[XMLTVImport] not starting import - is restart enigma2"
			else:
				try:
					open(flag, 'wb').close()
				except:
					print>>log, "Failed to create /tmp/.EPGImportAnswerBoot"
		if config.plugins.epgimport.runboot_day.value:
			now = time.localtime()
			cur_day = int(now.tm_wday)
			if not config.plugins.extra_epgimport.day_import[cur_day].value:
				on_start = False
				print>>log, "[XMLTVImport] wakeup day of week does not match"
		if on_start:
			print>>log, "[XMLTVImport] starting import because auto-run on boot is enabled"
			autoStartTimer.runImport()
	else:
		print>>log, "[XMLTVImport] import to start in less than 10 minutes anyway, skipping..."
Exemplo n.º 18
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()
Exemplo n.º 19
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)
Exemplo n.º 20
0
 def __init__(self):
     assert HdmiCec.instance is None, "only one HdmiCec instance is allowed!"
     HdmiCec.instance = self
     self.wait = eTimer()
     self.wait.timeout.get().append(self.sendMsgQ)
     self.queue = [
     ]  # if config.hdmicec.minimum_send_interval.value != "0" queue send message ->  (sendMsgQ)
     self.waitKeyEvent = eTimer()
     self.waitKeyEvent.timeout.get().append(self.sendKeyEventQ)
     self.queueKeyEvent = [
     ]  # if config.hdmicec.minimum_send_interval.value != "0" queue key event -> sendKeyEventQ
     self.repeat = eTimer()
     self.repeat.timeout.get().append(self.sendWakeupMessages)
     self.delay = eTimer()
     self.delay.timeout.get().append(self.sendStandbyMessages)
     self.useStandby = True
     self.handlingStandbyFromTV = False
     if config.hdmicec.enabled.value and config.hdmicec.fixed_physical_address.value[
             1:3] != ".0":
         print("[HdmiCEC][init]phsyical address changed by setup value:",
               config.hdmicec.fixed_physical_address.value)
         setFixedPhysicalAddress(
             config.hdmicec.fixed_physical_address.value)
     else:
         print("[HdmiCEC][init] no set physical address ")
         setFixedPhysicalAddress(
             "0.0.0.0"
         )  # no fixed physical address send 0 to eHdmiCec C++ driver
     eHdmiCEC.getInstance().messageReceived.get().append(
         self.messageReceived)
     config.misc.standbyCounter.addNotifier(self.onEnterStandby,
                                            initial_call=False)
     #		config.misc.DeepStandby.addNotifier(self.onEnterDeepStandby, initial_call=False)
     self.volumeForwardingEnabled = False
     self.volumeForwardingDestination = 0
     self.wakeup_from_tv = False
     eActionMap.getInstance().bindAction("", -maxsize - 1, self.keyEvent)
     config.hdmicec.volume_forwarding.addNotifier(
         self.configVolumeForwarding)
     config.hdmicec.enabled.addNotifier(self.configVolumeForwarding)
     if config.hdmicec.enabled.value:
         if config.hdmicec.report_active_menu.value:
             if config.hdmicec.report_active_source.value and NavigationInstance.instance and not NavigationInstance.instance.isRestartUI(
             ):
                 self.sendMessage(0, "sourceinactive")
             self.sendMessage(0, "menuactive")
         if config.hdmicec.handle_deepstandby_events.value and not getFPWasTimerWakeup(
         ):
             self.onLeaveStandby()
Exemplo n.º 21
0
	def __init__(self):
		assert not HdmiCec.instance, "only one HdmiCec instance is allowed!"
		HdmiCec.instance = self

		eHdmiCEC.getInstance().messageReceived.get().append(self.messageReceived)
		config.misc.standbyCounter.addNotifier(self.onEnterStandby, initial_call = False)
		config.misc.DeepStandby.addNotifier(self.onEnterDeepStandby, initial_call = False)
		self.setFixedPhysicalAddress(config.hdmicec.fixed_physical_address.getValue())

		self.volumeForwardingEnabled = False
		self.volumeForwardingDestination = 0
		eRCInput.getInstance().pyKeyEvent.get().append(self.keyEvent)
		config.hdmicec.volume_forwarding.addNotifier(self.configVolumeForwarding)
		if config.hdmicec.handle_deepstandby_events.getValue():
			if not getFPWasTimerWakeup():
				self.wakeupMessages()
Exemplo n.º 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.__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)
Exemplo n.º 23
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 = 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.__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()
Exemplo n.º 24
0
 def __init__(self):
     if config.hdmicec.enabled.value:
         HdmiCec.instance = self
         self.wait = eTimer()
         self.wait.timeout.get().append(self.sendCmd)
         self.queue = []
         eHdmiCEC.getInstance().messageReceived.get().append(self.messageReceived)
         config.misc.standbyCounter.addNotifier(self.onEnterStandby, initial_call=False)
         config.misc.DeepStandby.addNotifier(self.onEnterDeepStandby, initial_call=False)
         self.setFixedPhysicalAddress(config.hdmicec.fixed_physical_address.value)
         self.volumeForwardingEnabled = False
         self.volumeForwardingDestination = 0
         eActionMap.getInstance().bindAction('', -maxint - 1, self.keyEvent)
         config.hdmicec.volume_forwarding.addNotifier(self.configVolumeForwarding)
         config.hdmicec.enabled.addNotifier(self.configVolumeForwarding)
         if config.hdmicec.handle_deepstandby_events.value:
             if not getFPWasTimerWakeup():
                 self.wakeupMessages()
         dummy = self.checkifPowerupWithoutWakingTv()
Exemplo n.º 25
0
    def __init__(self):
        assert not HdmiCec.instance, "only one HdmiCec instance is allowed!"
        HdmiCec.instance = self

        eHdmiCEC.getInstance().messageReceived.get().append(
            self.messageReceived)
        config.misc.standbyCounter.addNotifier(self.onEnterStandby,
                                               initial_call=False)
        config.misc.DeepStandby.addNotifier(self.onEnterDeepStandby,
                                            initial_call=False)
        self.setFixedPhysicalAddress(
            config.hdmicec.fixed_physical_address.getValue())

        self.volumeForwardingEnabled = False
        self.volumeForwardingDestination = 0
        eRCInput.getInstance().pyKeyEvent.get().append(self.keyEvent)
        config.hdmicec.volume_forwarding.addNotifier(
            self.configVolumeForwarding)
        if config.hdmicec.handle_deepstandby_events.getValue():
            if not getFPWasTimerWakeup():
                self.wakeupMessages()
Exemplo n.º 26
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()
Exemplo n.º 27
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()
Exemplo n.º 28
0
	def afterFinishImportCheck(self):
		if config.plugins.epgimport.deepstandby.value == 'wakeup' and getFPWasTimerWakeup():
			if os.path.exists("/tmp/enigmastandby") or os.path.exists("/tmp/.EPGImportAnswerBoot"):
				print>>log, "[XMLTVImport] is restart enigma2"
			else:
				wake = self.getStatus()
				now_t = time.time()
				now = int(now_t)
				if 0 < wake - now <= 60 * 5:
					if config.plugins.epgimport.standby_afterwakeup.value:
						if not Screens.Standby.inStandby:
							Notifications.AddNotification(Screens.Standby.Standby)
							print>>log, "[XMLTVImport] Run to standby after wake up"
					if config.plugins.epgimport.shutdown.value:
						if not config.plugins.epgimport.standby_afterwakeup.value:
							if not Screens.Standby.inStandby:
								Notifications.AddNotification(Screens.Standby.Standby)
								print>>log, "[XMLTVImport] Run to standby after wake up for checking"
						if not config.plugins.epgimport.deepstandby_afterimport.value:
							config.plugins.epgimport.deepstandby_afterimport.value = True
							self.wait_timer = enigma.eTimer()
							self.wait_timer.timeout.get().append(self.startStandby)
							print>>log, "[XMLTVImport] start wait_timer (10sec) for goto standby"
							self.wait_timer.start(10000, True)
Exemplo n.º 29
0
	def afterFinishImportCheck(self):
		if config.plugins.epgimport.deepstandby.value == 'wakeup' and getFPWasTimerWakeup():
			if os.path.exists("/tmp/enigmastandby") or os.path.exists("/tmp/.EPGImportAnswerBoot"):
				print>>log, "[EPGImport] is restart enigma2"
			else:
				wake = self.getStatus()
				now_t = time.time()
				now = int(now_t)
				if 0 < wake - now <= 60*5:
					if config.plugins.epgimport.standby_afterwakeup.value:
						if not Screens.Standby.inStandby:
							Notifications.AddNotification(Screens.Standby.Standby)
							print>>log, "[EPGImport] Run to standby after wake up"
					if config.plugins.epgimport.shutdown.value:
						if not config.plugins.epgimport.standby_afterwakeup.value:
							if not Screens.Standby.inStandby:
								Notifications.AddNotification(Screens.Standby.Standby)
								print>>log, "[EPGImport] Run to standby after wake up for checking"
						if not config.plugins.epgimport.deepstandby_afterimport.value:
							config.plugins.epgimport.deepstandby_afterimport.value = True
							self.wait_timer = enigma.eTimer()
							self.wait_timer.timeout.get().append(self.startStandby)
							print>>log, "[EPGImport] start wait_timer (10sec) for goto standby"
							self.wait_timer.start(10000, True)
Exemplo n.º 30
0
	def __init__(self):
		assert not HdmiCec.instance, "only one HdmiCec instance is allowed!"
		HdmiCec.instance = self

		self.wait = eTimer()
		self.wait.timeout.get().append(self.sendCmd)
		self.repeat = eTimer()
		self.repeat.timeout.get().append(self.wakeupMessages)
		self.queue = []

		eHdmiCEC.getInstance().messageReceived.get().append(self.messageReceived)
		config.misc.standbyCounter.addNotifier(self.onEnterStandby, initial_call = False)
		config.misc.DeepStandby.addNotifier(self.onEnterDeepStandby, initial_call = False)
		self.setFixedPhysicalAddress(config.hdmicec.fixed_physical_address.value)

		self.volumeForwardingEnabled = False
		self.volumeForwardingDestination = 0
		eActionMap.getInstance().bindAction('', -maxint - 1, self.keyEvent)
		config.hdmicec.volume_forwarding.addNotifier(self.configVolumeForwarding)
		config.hdmicec.enabled.addNotifier(self.configVolumeForwarding)
		if config.hdmicec.enabled.value and config.hdmicec.handle_deepstandby_events.value and not getFPWasTimerWakeup():
			self.onLeaveStandby()
Exemplo n.º 31
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)
Exemplo n.º 32
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()
Exemplo n.º 33
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()
Exemplo n.º 34
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)
Exemplo n.º 35
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)
Exemplo n.º 36
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()
Exemplo n.º 37
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
Exemplo n.º 38
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)
Exemplo n.º 39
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)
Exemplo n.º 40
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
Exemplo n.º 41
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
Exemplo n.º 42
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
Exemplo n.º 43
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
Exemplo n.º 44
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', 'et8000')
                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
        return
Exemplo n.º 45
0
	def checkNextAfterEventAuto(self):
		if getFPWasTimerWakeup() and config.plugins.vps.allow_wakeup.value and len(self.session.nav.RecordTimer.timer_list) > 0:
			next_timer = self.session.nav.RecordTimer.timer_list[0]
			if next_timer.vpsplugin_enabled and next_timer.afterEvent == AFTEREVENT.AUTO and (next_timer.begin - (config.plugins.vps.initial_time.value * 60) - 300) < time():
				next_timer.vpsplugin_wasTimerWakeup = True
Exemplo n.º 46
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)
Exemplo n.º 47
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)