예제 #1
2
파일: Standby.py 프로젝트: Jaloga/enigma2
	def Power(self):
		print "leave standby"
		if (getBrandOEM() in ('fulan')):
			open("/proc/stb/hdmi/output", "w").write("on")
		#set input to encoder
		self.avswitch.setInput("ENCODER")
		#restart last played service
		#unmute adc
		self.leaveMute()
		# set LCDminiTV 
		if SystemInfo["Display"] and SystemInfo["LCDMiniTV"]:
			setLCDModeMinitTV(config.lcd.modeminitv.value)
		#remove wakup files and reset wakup state
		PowerTimer.resetTimerWakeup()
		RecordTimer.resetTimerWakeup()
		#kill me
		self.close(True)
예제 #2
1
 def Power(self):
     print 'leave standby'
     self.avswitch.setInput('ENCODER')
     self.leaveMute()
     if SystemInfo['Display'] and SystemInfo['LCDMiniTV']:
         setLCDModeMinitTV(config.lcd.modeminitv.getValue())
     PowerTimer.resetTimerWakeup()
     RecordTimer.resetTimerWakeup()
     self.close(True)
예제 #3
1
파일: Standby.py 프로젝트: OpenSH4/enigma2
	def Power(self):
		print "leave standby"
		#set input to encoder
		self.avswitch.setInput("ENCODER")
		#restart last played service
		#unmute adc
		self.leaveMute()
		# set LCDminiTV 
		if SystemInfo["Display"] and SystemInfo["LCDMiniTV"]:
			setLCDModeMinitTV(config.lcd.modeminitv.value)
		#remove wakup files and reset wakup state
		PowerTimer.resetTimerWakeup()
		RecordTimer.resetTimerWakeup()
		#kill me
		self.close(True)
	def __init__(self):
		if NavigationInstance.instance is not None:
			raise NavigationInstance.instance

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

		import Navigation as Nav
		Nav.navcore = self

		self.pnav = pNavigation()
		self.pnav.m_event.get().append(self.dispatchEvent)
		self.pnav.m_record_event.get().append(self.dispatchRecordEvent)
		self.event = [ ]
		self.record_event = [ ]
		self.currentlyPlayingServiceReference = None
		self.currentlyPlayingServiceOrGroup = None
		self.currentlyPlayingService = None
		self.RecordTimer = RecordTimer.RecordTimer()
		self.__wasTimerWakeup = getFPWasTimerWakeup()
		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()
예제 #5
1
 def Power(self):
     print "[Standby] leave standby"
     if (getBrandOEM() in ('fulan')):
         open("/proc/stb/hdmi/output", "w").write("on")
     #set input to encoder
     self.avswitch.setInput("ENCODER")
     #restart last played service
     #unmute adc
     self.leaveMute()
     # set LCDminiTV
     if SystemInfo["Display"] and SystemInfo["LCDMiniTV"]:
         setLCDModeMinitTV(config.lcd.modeminitv.value)
     #remove wakup files and reset wakup state
     PowerTimer.resetTimerWakeup()
     RecordTimer.resetTimerWakeup()
     #kill me
     self.close(True)
예제 #6
1
	def Power(self):
		print "leave standby"
		#set input to encoder
		self.avswitch.setInput("ENCODER")
		#restart last played service
		#unmute adc
		self.leaveMute()
		# set LCDminiTV 
		if SystemInfo["Display"] and SystemInfo["LCDMiniTV"]:
			setLCDModeMinitTV(config.lcd.modeminitv.value)
		#remove wakup files and reset wakup state
		PowerTimer.resetTimerWakeup()
		RecordTimer.resetTimerWakeup()
		#kill me
		if os.path.exists("/usr/scripts/standby.sh") is True:
			os.system("chmod 755 /usr/scripts/standby.sh")
			os.system("/usr/scripts/standby.sh")
		else:
			print "/usr/scripts/standby.sh not found"
		self.close(True)
예제 #7
0
    def __init__(self, nextRecordTimerAfterEventActionAuto=False):
        if NavigationInstance.instance is not None:
            raise NavigationInstance.instance

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

        import Navigation as Nav
        Nav.navcore = self

        self.pnav = pNavigation()
        self.pnav.m_event.get().append(self.dispatchEvent)
        self.pnav.m_record_event.get().append(self.dispatchRecordEvent)
        self.event = []
        self.record_event = []
        self.currentlyPlayingServiceReference = None
        self.currentlyPlayingService = None
        self.RecordTimer = RecordTimer.RecordTimer()
        if getFPWasTimerWakeup():
            if nextRecordTimerAfterEventActionAuto:
                # We need to give the systemclock the chance to sync with the transponder time,
                # before we will make the decision about whether or not we need to shutdown
                # after the upcoming recording has completed
                self.recordshutdowntimer = eTimer()
                self.recordshutdowntimer.callback.append(
                    self.checkShutdownAfterRecording)
                self.recordshutdowntimer.start(30000, True)
        self.SleepTimer = SleepTimer.SleepTimer()
예제 #8
0
파일: Navigation.py 프로젝트: takitr/dvbapp
	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)
예제 #9
0
    def __init__(self,
                 nextRecordTimerAfterEventActionAuto=False,
                 nextPowerManagerAfterEventActionAuto=False):
        if NavigationInstance.instance is not None:
            raise NavigationInstance.instance

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

        import Navigation as Nav
        Nav.navcore = self

        self.pnav = pNavigation()
        self.pnav.m_event.get().append(self.dispatchEvent)
        self.pnav.m_record_event.get().append(self.dispatchRecordEvent)
        self.event = []
        self.record_event = []
        self.currentlyPlayingServiceReference = None
        self.currentlyPlayingServiceOrGroup = None
        self.currentlyPlayingService = None
        self.RecordTimer = RecordTimer.RecordTimer()
        self.PowerTimer = PowerTimer.PowerTimer()
        self.__wasTimerWakeup = False
        self.__nextRecordTimerAfterEventActionAuto = nextRecordTimerAfterEventActionAuto
        self.__nextPowerManagerAfterEventActionAuto = nextPowerManagerAfterEventActionAuto
        if getFPWasTimerWakeup():
            self.__wasTimerWakeup = True
            self._processTimerWakeup()
예제 #10
0
	def __init__(self, nextRecordTimerAfterEventActionAuto=False):
		from Screens.ChannelSelection import ChannelSelection
		if NavigationInstance.instance is not None:
			raise NavigationInstance.instance
		
		NavigationInstance.instance = self
		self.ServiceHandler = eServiceCenter.getInstance()
		
		import Navigation as Nav
		Nav.navcore = self
		
		self.pnav = pNavigation()
		self.nav_event_conn = self.pnav.m_event.connect(self.dispatchEvent)
		self.nav_record_event_conn = self.pnav.m_record_event.connect(self.dispatchRecordEvent)
		self.event = [ ]
		self.record_event = [ ]
		self.currentlyPlayingServiceReference = None
		self.currentlyPlayingService = None
		self.immediatePlay = False
		self.RecordTimer = RecordTimer.RecordTimer()
		self.__wasTimerWakeup = False
		if getFPWasTimerWakeup():
			clearFPWasTimerWakeup()
			if getFPWasTimerWakeup(): # sanity check to detect if the FP driver is working correct!
				print "buggy fp driver detected!!! please update drivers.... ignore timer wakeup!"
			else:
				self.__wasTimerWakeup = True
				if config.misc.prev_wakeup_time.value and config.misc.prev_wakeup_time_type.value == 0:
					if not Screens.Standby.inTryQuitMainloop: # not a shutdown messagebox is open
						Notifications.AddNotificationWithID("Standby", Screens.Standby.Standby, domain="RecordTimer")
		self.SleepTimer = SleepTimer.SleepTimer()
		self.scheduledServiceReference = None
		ChannelSelection.initialized.addNotifier(self.serviceListInitialized, initial_call = True)
예제 #11
0
	def __init__(self, nextRecordTimerAfterEventActionAuto=False):
		if NavigationInstance.instance is not None:
			raise NavigationInstance.instance
		
		NavigationInstance.instance = self
		self.ServiceHandler = eServiceCenter.getInstance()
		
		import Navigation as Nav
		Nav.navcore = self
		
		self.pnav = pNavigation()
		self.pnav.m_event.get().append(self.dispatchEvent)
		self.pnav.m_record_event.get().append(self.dispatchRecordEvent)
		self.event = [ ]
		self.record_event = [ ]
		self.currentlyPlayingServiceReference = None
		self.currentlyPlayingService = None
		self.RecordTimer = RecordTimer.RecordTimer()
		if getFPWasTimerWakeup():
			clearFPWasTimerWakeup()
			if getFPWasTimerWakeup(): # sanity check to detect if the FP driver is working correct!
				print "buggy fp driver detected!!! please update drivers.... ignore timer wakeup!"
			elif nextRecordTimerAfterEventActionAuto and (len(self.getRecordings()) or abs(self.RecordTimer.getNextRecordingTime() - time()) <= 360):
				if not Screens.Standby.inTryQuitMainloop: # not a shutdown messagebox is open
					RecordTimer.RecordTimerEntry.TryQuitMainloop(False) # start shutdown handling
		self.SleepTimer = SleepTimer.SleepTimer()
    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()
예제 #13
0
	def Power(self):
		print "leave standby"
		#set input to encoder
		self.avswitch.setInput("ENCODER")
		#restart last played service
		#unmute adc
		self.leaveMute()
		# set LCDminiTV
		if SystemInfo["Display"] and SystemInfo["LCDMiniTV"]:
			setLCDModeMinitTV(config.lcd.modeminitv.value)
		if (getBrandOEM() in ('fulan','clap') or getBoxType() in ('sf8008')):
			open("/proc/stb/hdmi/output", "w").write("on")
		#remove wakup files and reset wakup state
		PowerTimer.resetTimerWakeup()
		RecordTimer.resetTimerWakeup()
		#kill me
		if os.path.exists("/usr/scripts/standby.sh") is True:
			os.system("chmod 755 /usr/scripts/standby.sh")
			os.system("/usr/scripts/standby.sh")
		else:
			print "/usr/scripts/standby.sh not found"
		self.close(True)
예제 #14
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)
예제 #15
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()
예제 #16
0
def test_timer(repeat=0,
               timer_start=3600,
               timer_length=1000,
               sim_length=86400 * 7):

    import NavigationInstance

    at = time.time()

    t = NavigationInstance.instance.RecordTimer
    print t
    print "old mwt:", t.MaxWaitTime
    t.MaxWaitTime = 86400 * 1000

    t.processed_timers = []
    t.timer_list = []

    # generate a timer to test
    import xml.etree.cElementTree
    import RecordTimer

    timer = RecordTimer.createTimer(
        xml.etree.cElementTree.fromstring("""
		<timer 
			begin="%d" 
			end="%d"
			serviceref="1:0:1:6DD2:44D:1:C00000:0:0:0:" 
			repeated="%d" 
			name="Test Event Name" 
			description="Test Event Description" 
			afterevent="nothing" 
			eit="56422" 
			disabled="0" 
			justplay="0">
	</timer>""" % (at + timer_start, at + timer_start + timer_length, repeat)))

    t.record(timer)

    # run virtual environment
    enigma.run(sim_length)

    print "done."

    timers = t.processed_timers + t.timer_list

    print "start: %s" % (time.ctime(at + 10))

    assert len(timers) == 1

    for t in timers:
        print "begin=%d, end=%d, repeated=%d, state=%d" % (
            t.begin - at, t.end - at, t.repeated, t.state)
        print "begin: %s" % (time.ctime(t.begin))
        print "end: %s" % (time.ctime(t.end))

    # if repeat, check if the calculated repeated time of day matches the initial time of day
    if repeat:
        t_initial = time.localtime(at + timer_start)
        t_repeated = time.localtime(timers[0].begin)
        print t_initial
        print t_repeated

    if t_initial[3:6] != t_repeated[3:6]:
        raise tests.TestError("repeated timer time of day does not match")
예제 #17
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)
예제 #18
0
	def __init__(self, wakeupData=None):
		if NavigationInstance.instance is not None:
			raise NavigationInstance.instance

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

		import Navigation as Nav
		Nav.navcore = self

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

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

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

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

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

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

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

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

		if wasTimerWakeup:
			self.__wasTimerWakeup = True
			print "-"*100
			if self.wakeuptime > 0:
				print "[NAVIGATION] wakeup time was %s" % ctime(self.wakeuptime)
			else:
				print "[NAVIGATION] wakeup time was not set"
			if now <= 31536000:
				self.timesynctimer = eTimer()
				self.timesynctimer.callback.append(self.TimeSynctimer)
				self.timesynctimer.start(5000, True)
				print"[NAVIGATION] wait for time sync"
				print "~"*100
			else:
				self.wakeupCheck()
		else:
			if now > 31536000:
				if self.timertime > 0:
					print "[NAVIGATION] next '%s' starts at %s" % ({0:"record-timer",1:"zap-timer",2:"power-timer",3:"plugin-timer"}[self.wakeuptyp], ctime(self.timertime))
				else:
					print "[NAVIGATION] no next timers"
				print "="*100
예제 #19
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
예제 #20
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
예제 #21
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)
예제 #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 = 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)
예제 #23
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()
예제 #24
0
def test_timer(repeat = 0, timer_start = 3600, timer_length = 1000, sim_length = 86400 * 7):

	import NavigationInstance
	
	at = time.time()
	
	t = NavigationInstance.instance.RecordTimer
	print t
	print "old mwt:", t.MaxWaitTime
	t.MaxWaitTime = 86400 * 1000
	
	# hack:
	NavigationInstance.instance.SleepTimer.MaxWaitTime = 86400 * 1000

	t.processed_timers = [ ]
	t.timer_list = [ ]


	# generate a timer to test
	import xml.etree.cElementTree
	import RecordTimer

	timer = RecordTimer.createTimer(xml.etree.cElementTree.fromstring(
	"""
		<timer 
			begin="%d" 
			end="%d"
			serviceref="1:0:1:6DD2:44D:1:C00000:0:0:0:" 
			repeated="%d" 
			name="Test Event Name" 
			description="Test Event Description" 
			afterevent="nothing" 
			eit="56422" 
			disabled="0" 
			justplay="0">
	</timer>""" % (at + timer_start, at + timer_start + timer_length, repeat)
	))

	t.record(timer)

	# run virtual environment
	enigma.run(sim_length)
	
	print "done."
	
	timers = t.processed_timers  + t.timer_list
	
	print "start: %s" % (time.ctime(at + 10))
	
	assert len(timers) == 1
	
	for t in timers:
		print "begin=%d, end=%d, repeated=%d, state=%d" % (t.begin - at, t.end - at, t.repeated, t.state)
		print "begin: %s" % (time.ctime(t.begin))
		print "end: %s" % (time.ctime(t.end))

	# if repeat, check if the calculated repeated time of day matches the initial time of day
	if repeat:
		t_initial = time.localtime(at + timer_start)
		t_repeated = time.localtime(timers[0].begin)
		print t_initial
		print t_repeated
		
	if t_initial[3:6] != t_repeated[3:6]:
		raise tests.TestError("repeated timer time of day does not match")
예제 #25
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()
예제 #26
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)