Ejemplo n.º 1
0
def timeCallback(isCallback=True):
	"""Time Callback/Autostart management."""
	thInstance = eDVBLocalTimeHandler.getInstance()
	if isCallback:
		# NOTE: this assumes the clock is actually ready when called back
		# this may not be true, but we prefer silently dying to waiting forever
		thInstance.m_timeUpdated.get().remove(timeCallback)
	elif not thInstance.ready():
		thInstance.m_timeUpdated.get().append(timeCallback)
		return

	if config.plugins.epgrefresh.wakeup.value:
		now = localtime()
		begin = int(mktime(
			(now.tm_year, now.tm_mon, now.tm_mday,
			config.plugins.epgrefresh.begin.value[0],
			config.plugins.epgrefresh.begin.value[1],
			0, now.tm_wday, now.tm_yday, now.tm_isdst)
		))
		# booted +- 6min from begin of timespan
		cur_day = int(now.tm_wday)
		if abs(time() - begin) < 360 and config.plugins.epgrefresh_extra.day_refresh[cur_day].value:
			from Tools.Notifications import AddNotificationWithCallback
			from Tools.BoundFunction import boundFunction
			# XXX: we use a notification because this will be suppressed otherwise
			AddNotificationWithCallback(
				boundFunction(standbyQuestionCallback, epgrefresh.session),
				MessageBox,
				_("This might have been an automated bootup to refresh the EPG. For this to happen it is recommended to put the receiver to Standby.\nDo you want to do this now?"),
				timeout = 30
			)
	epgrefresh.start()
Ejemplo n.º 2
0
def autostart(reason, **kwargs):
	if reason == 0 and kwargs.has_key("session"):
		session = kwargs["session"]
		epgrefresh.session = session

		if config.plugins.epgrefresh.enabled.value:
			if config.plugins.epgrefresh.wakeup.value:
				now = localtime()
				begin = int(mktime(
					(now.tm_year, now.tm_mon, now.tm_mday,
					config.plugins.epgrefresh.begin.value[0],
					config.plugins.epgrefresh.begin.value[1],
					0, now.tm_wday, now.tm_yday, now.tm_isdst)
				))
				# booted +- 10min from begin of timespan
				if abs(time() - begin) < 600:
					from Screens.MessageBox import MessageBox
					from Tools.Notifications import AddNotificationWithCallback
					from Tools.BoundFunction import boundFunction
					# XXX: we use a notification because this will be suppressed otherwise
					AddNotificationWithCallback(
						boundFunction(standbyQuestionCallback, session),
						MessageBox,
						_("This might have been an automated bootup to refresh the EPG. For this to happen it is recommended to put the receiver to Standby.\nDo you want to do this now?"),
						timeout = 15
					)

			epgrefresh.start(session)

	elif reason == 1:
		epgrefresh.stop()
Ejemplo n.º 3
0
    def render(self, req):
        statetext = "config changed."
        for key, value in iteritems(req.args):
            value = value[0]
            if key == "enabled":
                config.plugins.epgrefresh.enabled.value = True if value == "true" else False
            elif key == "enablemessage":
                config.plugins.epgrefresh.enablemessage.value = True if value == "true" else False
            elif key == "begin":
                value = int(value)
                if value:
                    t = localtime(value)
                    config.plugins.epgrefresh.begin.value = [
                        t.tm_hour, t.tm_min
                    ]
            elif key == "end":
                value = int(value)
                if value:
                    t = localtime(int(value))
                    config.plugins.epgrefresh.end.value = [t.tm_hour, t.tm_min]
            elif key == "interval_seconds":
                value = int(value)
                if value:
                    config.plugins.epgrefresh.interval_seconds.value = value
            elif key == "delay_standby":
                value = int(value)
                if value:
                    config.plugins.epgrefresh.delay_standby.value = value
            elif key == "inherit_autotimer":
                config.plugins.epgrefresh.inherit_autotimer.value = True if value == "true" else False
            elif key == "afterevent":
                config.plugins.epgrefresh.afterevent.value = True if value == "true" else False
            elif key == "force":
                config.plugins.epgrefresh.force.value = True if value == "true" else False
            elif key == "wakeup":
                config.plugins.epgrefresh.wakeup.value = True if value == "true" else False
            elif key == "parse_autotimer":
                if value in epgrefresh.parse_autotimer.choices:
                    epgrefresh.parse_autotimer.value = value
            elif key == "adapter":
                if value in config.plugins.epgrefresh.adapter.choices:
                    config.plugins.epgrefresh.adapter.value = value

        config.plugins.epgrefresh.save()

        if config.plugins.epgrefresh.enabled.value:
            epgrefresh.start()
        else:
            epgrefresh.stop()

        req.setResponseCode(http.OK)
        req.setHeader('Content-type', 'application/xhtml+xml')
        req.setHeader('charset', 'UTF-8')

        return """<?xml version=\"1.0\" encoding=\"UTF-8\" ?>
<e2simplexmlresult>
 <e2state>true</e2state>
 <e2statetext>%s</e2statetext>
</e2simplexmlresult>""" % (statetext, )
	def render(self, req):
		statetext = "config changed."
		for key, value in req.args.iteritems():
			value = value[0]
			if key == "enabled":
				config.plugins.epgrefresh.enabled.value = True if value == "true" else False
			elif key == "enablemessage":
				config.plugins.epgrefresh.enablemessage.value = True if value == "true" else False
			elif key == "begin":
				value = int(value)
				if value:
					t = localtime(value)
					config.plugins.epgrefresh.begin.value = [t.tm_hour, t.tm_min]
			elif key == "end":
				value = int(value)
				if value:
					t = localtime(int(value))
					config.plugins.epgrefresh.end.value = [t.tm_hour, t.tm_min]
			elif key == "interval":
				value = int(value)
				if value:
					config.plugins.epgrefresh.interval.value = value
			elif key == "delay_standby":
				value = int(value)
				if value:
					config.plugins.epgrefresh.delay_standby.value = value
			elif key == "inherit_autotimer":
				config.plugins.epgrefresh.inherit_autotimer.value = True if value == "true" else False
			elif key == "afterevent":
				config.plugins.epgrefresh.afterevent.value = True if value == "true" else False
			elif key == "force":
				config.plugins.epgrefresh.force.value = True if value == "true" else False
			elif key == "wakeup":
				config.plugins.epgrefresh.wakeup.value = True if value == "true" else False
			elif key == "parse_autotimer":
				config.plugins.epgrefresh.parse_autotimer.value = True if value == "true" else False
			elif key == "background":
				statetext += " parameter \"background\" is deprecated. please use new \"adapter\" parameter instead."
				config.plugins.epgrefresh.adapter.value = "pip_hidden" if value == "true" else "main"
			elif key == "adapter":
				if value in config.plugins.epgrefresh.adapter.choices:
					config.plugins.epgrefresh.adapter.value = value

		config.plugins.epgrefresh.save()

		if config.plugins.epgrefresh.enabled.value:
			epgrefresh.start()
		else:
			epgrefresh.stop()

		req.setResponseCode(http.OK)
		req.setHeader('Content-type', 'application; xhtml+xml')
		req.setHeader('charset', 'UTF-8')

		return """<?xml version=\"1.0\" encoding=\"UTF-8\" ?>
<e2simplexmlresult>
 <e2state>true</e2state>
 <e2statetext>%s</e2statetext>
</e2simplexmlresult>""" % (statetext,)
Ejemplo n.º 5
0
def timeCallback(isCallback=True):
    """Time Callback/Autostart management."""
    thInstance = eDVBLocalTimeHandler.getInstance()
    if isCallback:
        # NOTE: this assumes the clock is actually ready when called back
        # this may not be true, but we prefer silently dying to waiting forever
        thInstance.m_timeUpdated.get().remove(timeCallback)
    elif not thInstance.ready():
        thInstance.m_timeUpdated.get().append(timeCallback)
        return
    epgrefresh.start()
Ejemplo n.º 6
0
def timeCallback(isCallback=True):
	"""Time Callback/Autostart management."""
	thInstance = eDVBLocalTimeHandler.getInstance()
	if isCallback:
		# NOTE: this assumes the clock is actually ready when called back
		# this may not be true, but we prefer silently dying to waiting forever
		thInstance.m_timeUpdated.get().remove(timeCallback)
	elif not thInstance.ready():
		thInstance.m_timeUpdated.get().append(timeCallback)
		return
	epgrefresh.start()
Ejemplo n.º 7
0
def autostart(reason, **kwargs):
	if reason == 0 and "session" in kwargs:
		session = kwargs["session"]
		epgrefresh.session = session

		if config.plugins.epgrefresh.enabled.value:
			# check if box was woken up by a timer, if so, check if epgrefresh set this timer
			if session.nav.wasTimerWakeup() and config.misc.prev_wakeup_time.value == config.plugins.epgrefresh.wakeup_time.value:
				# if box is not in idle mode, do that
				from Screens.Standby import Standby, inStandby
				if not inStandby:
					from Tools import Notifications
					Notifications.AddNotificationWithID("Standby", Standby)
			epgrefresh.start()

	elif reason == 1:
		epgrefresh.stop()
	def render(self, req):
		for key, value in req.args.iteritems():
			value = value[0]
			if key == "enabled":
				config.plugins.epgrefresh.enabled.value = True if value == "true" else False
			elif key == "begin":
				config.plugins.epgrefresh.begin.value = int(value)
			elif key == "end":
				config.plugins.epgrefresh.end.value = int(value)
			elif key == "interval":
				config.plugins.epgrefresh.interval.value = int(value)
			elif key == "delay_standby":
				config.plugins.epgrefresh.delay_standby.value = int(value)
			elif key == "inherit_autotimer":
				config.plugins.epgrefresh.inherit_autotimer.value = True if value == "true" else False
			elif key == "afterevent":
				config.plugins.epgrefresh.afterevent.value = True if value == "true" else False
			elif key == "force":
				config.plugins.epgrefresh.force.value = True if value == "true" else False
			elif key == "wakeup":
				config.plugins.epgrefresh.wakeup.value = True if value == "true" else False
			elif key == "pase_autotimer":
				config.plugins.epgrefresh.parse_autotimer.value = True if value == "true" else False
			elif key == "background":
				config.plugins.epgrefresh.background.value = True if value == "true" else False

		config.plugins.epgrefresh.save()

		if config.plugins.epgrefresh.enabled.value:
			epgrefresh.start()
		else:
			epgrefresh.stop()

		req.setResponseCode(http.OK)
		req.setHeader('Content-type', 'application; xhtml+xml')
		req.setHeader('charset', 'UTF-8')

		return """<?xml version=\"1.0\" encoding=\"UTF-8\" ?>
Ejemplo n.º 9
0
    def render(self, req):
        for key, value in req.args.iteritems():
            value = value[0]
            if key == "enabled":
                config.plugins.epgrefresh.enabled.value = True if value == "true" else False
            elif key == "begin":
                config.plugins.epgrefresh.begin.value = int(value)
            elif key == "end":
                config.plugins.epgrefresh.end.value = int(value)
            elif key == "interval":
                config.plugins.epgrefresh.interval.value = int(value)
            elif key == "delay_standby":
                config.plugins.epgrefresh.delay_standby.value = int(value)
            elif key == "inherit_autotimer":
                config.plugins.epgrefresh.inherit_autotimer.value = True if value == "true" else False
            elif key == "afterevent":
                config.plugins.epgrefresh.afterevent.value = True if value == "true" else False
            elif key == "force":
                config.plugins.epgrefresh.force.value = True if value == "true" else False
            elif key == "wakeup":
                config.plugins.epgrefresh.wakeup.value = True if value == "true" else False
            elif key == "pase_autotimer":
                config.plugins.epgrefresh.parse_autotimer.value = True if value == "true" else False

        config.plugins.epgrefresh.save()

        if config.plugins.epgrefresh.enabled.value:
            epgrefresh.start()
        else:
            epgrefresh.stop()

        req.setResponseCode(http.OK)
        req.setHeader('Content-type', 'application; xhtml+xml')
        req.setHeader('charset', 'UTF-8')

        return """<?xml version=\"1.0\" encoding=\"UTF-8\" ?>
Ejemplo n.º 10
0
def doneConfiguring(session, **kwargs):
	if config.plugins.epgrefresh.enabled.value:
		epgrefresh.start(session)
Ejemplo n.º 11
0
def _startAfterConfig(session):
    if config.plugins.epgrefresh.enabled.value:
        if not epgrefresh.isRunning():
            epgrefresh.start(session)
Ejemplo n.º 12
0
def _startAfterConfig(session):
    if config.plugins.epgrefresh.enabled.value:
        if not epgrefresh.isRunning():
            epgrefresh.start(session)
Ejemplo n.º 13
0
	def render(self, req):
		statetext = "config changed."
		for key, value in iteritems(req.args):
			value = value[0]
			if key == "enabled":
				config.plugins.epgrefresh.enabled.value = True if value == "true" else False
			elif key == "enablemessage":
				config.plugins.epgrefresh.enablemessage.value = True if value == "true" else False
			elif key == "begin":
				value = int(value)
				if value:
					t = localtime(value)
					config.plugins.epgrefresh.begin.value = [t.tm_hour, t.tm_min]
			elif key == "end":
				value = int(value)
				if value:
					t = localtime(int(value))
					config.plugins.epgrefresh.end.value = [t.tm_hour, t.tm_min]
			elif key == "interval_seconds":
				value = int(value)
				if value:
					config.plugins.epgrefresh.interval_seconds.value = value
			elif key == "delay_standby":
				value = int(value)
				if value:
					config.plugins.epgrefresh.delay_standby.value = value
			elif key == "inherit_autotimer":
				config.plugins.epgrefresh.inherit_autotimer.value = True if value == "true" else False
			elif key == "afterevent":
				config.plugins.epgrefresh.afterevent.value = True if value == "true" else False
			elif key == "force":
				config.plugins.epgrefresh.force.value = True if value == "true" else False
			elif key == "wakeup":
				config.plugins.epgrefresh.wakeup.value = True if value == "true" else False
			elif key == "parse_autotimer":
				if value in config.plugins.epgrefresh.parse_autotimer.choices:
					config.plugins.epgrefresh.parse_autotimer.value = value
				elif value == "true":
					config.plugins.epgrefresh.parse_autotimer.value = "always"
				else:
					config.plugins.epgrefresh.parse_autotimer.value = "never"
			elif key == "adapter":
				if value in config.plugins.epgrefresh.adapter.choices:
					config.plugins.epgrefresh.adapter.value = value
			elif key == "skipProtectedServices":
				if value in config.plugins.epgrefresh.skipProtectedServices.choices:
					config.plugins.epgrefresh.skipProtectedServices.value = value

		config.plugins.epgrefresh.save()

		if config.plugins.epgrefresh.enabled.value:
			epgrefresh.start()
		else:
			epgrefresh.stop()

		req.setResponseCode(http.OK)
		req.setHeader('Content-type', 'application/xhtml+xml')
		req.setHeader('charset', 'UTF-8')

		return """<?xml version=\"1.0\" encoding=\"UTF-8\" ?>
<e2simplexmlresult>
 <e2state>true</e2state>
 <e2statetext>%s</e2statetext>
</e2simplexmlresult>""" % (statetext,)