Example #1
0
	def __init__(self, session, oneShot = False):

		# singleton class - needed to call it at sessionstart
		SkyGetTvGuide.instance = self

		self.session = session
		self.oneShot = oneShot
		
		self.IS_RUNNING = False
		
		self.nonHDeventList = nonHDeventList()
		self.sky_chlist = buildSkyChannellist()
		self.agent = getUserAgent()
		self.headers = getHttpHeader()
		self.headersJSON = getHttpHeaderJSON()
		self.headers1 = getHttpHeader1()
		
		# update current agent for the header, too
		self.headers.update({'User-Agent': self.agent})
		self.headers1.update({'User-Agent': self.agent})
		self.headersJSON.update({'User-Agent': self.agent})
		
		self.pluginName = config.plugins.skyrecorder.pluginname.value
		
		self.ck = {}
		self.sky_log_path = "/usr/lib/enigma2/python/Plugins/Extensions/skyrecorder/sky_log"

		if self.oneShot and config.plugins.skyrecorder.autoupdate_database.value:
		
			# do we really need a new update right now?
			checktime = getCurrentTimestamp()
			nextcheck = checktime
			lastcheck = checktime
			try:
				lastcheck = int(config.plugins.skyrecorder.lastchecked.value)
				nextcheck = int(config.plugins.skyrecorder.next_update.value)
			except Exception:
				sys.exc_clear()
			if ((checktime + 300) >= nextcheck) and (lastcheck < nextcheck): # 5 minutes buffer should be ok, because the STB is starting to fast, sometimes
				print "[skyrecorder] timer AutotimerCheck gesetzt"
				
				# be sure we got a new timestamp, even something went wrong
				config.plugins.skyrecorder.lastchecked.value = checktime
				config.plugins.skyrecorder.lastchecked.save()
				# set new wecker for our timer
				if config.plugins.skyrecorder.database_update_time and config.plugins.skyrecorder.database_update_time.value:
					alarm = setWecker(config.plugins.skyrecorder.database_update_time.value, True) # be sure we shift one day
				else:
					alarm = setWecker([6,0], True) # be sure we shift one day
				config.plugins.skyrecorder.next_update.value = alarm
				config.plugins.skyrecorder.next_update.save()
				configfile.save()
				
				# let us start it right now. needed for wakMeUp function
				self.tempTimer = None
				self.tempTimer = eTimer()
				self.tempTimer.callback.append(self.start(self.oneShot))
				self.tempTimer.start(5000, True) # give us some time to breath, before we start
				
		# set the timer for the next update now
		if config.plugins.skyrecorder.autoupdate_database.value:
			self.refreshTimer = None
			self.refreshTimer = eTimer()
			self.refreshTimer.callback.append(self.start)
			if config.plugins.skyrecorder.next_update and config.plugins.skyrecorder.lastchecked:
				interval = int(config.plugins.skyrecorder.next_update.value) - getCurrentTimestamp()
				if interval > 60 and interval <= 5184000: # 60 seconds buffer, but lower or equal than 1 day
					#self.timerinterval = interval * 1000 # milliseconds
					#self.refreshTimer.start(self.timerinterval)
					self.timerinterval = interval
					self.refreshTimer.startLongTimer(self.timerinterval)
Example #2
0
    def __init__(self, session, id_events, id_channel, id_genre):
        self.session = session

        path = "%s/skins/%s/screen_timer_select.xml" % (getPluginPath(), config.plugins.skyrecorder.anytime_skin.value)
        with open(path, "r") as f:
            self.skin = f.read()
            f.close()

        Screen.__init__(self, session)

        self.id_events = str(id_events)
        self.id_channel = id_channel
        self.id_genre = id_genre

        self.nonHDeventList = nonHDeventList()
        self.sky_chlist = buildSkyChannellist()

        self.pluginName = config.plugins.skyrecorder.pluginname.value
        self.contentSize = config.plugins.skyrecorder.contentsize.value

        self["actions"] = ActionMap(
            [
                "OkCancelActions",
                "ShortcutActions",
                "EPGSelectActions",
                "WizardActions",
                "ColorActions",
                "NumberActions",
                "MenuActions",
                "MoviePlayerActions",
            ],
            {
                "ok": self.keyOK,
                "cancel": self.keyCancel,
                "nextBouquet": self.keyPageUp,
                "prevBouquet": self.keyPageDown,
            },
            -1,
        )

        self["title"] = Label(self.pluginName)
        try:
            self["head"] = Label("Sendetermine")
        except Exception:
            sys.exc_clear()
        self["name"] = Label("Timer Auswahl")
        self["handlung"] = Label(" ")
        self["image"] = Pixmap()
        self["image"].hide()

        self["hd"] = Pixmap()
        self["hd"].hide()

        self["169"] = Pixmap()
        self["169"].hide()

        self["dolby"] = Pixmap()
        self["dolby"].hide()

        self["dualch"] = Pixmap()
        self["dualch"].hide()

        self["sub"] = Pixmap()
        self["sub"].hide()

        self.keyLocked = True
        self.streamMenuList = MenuList([], enableWrapAround=True, content=eListboxPythonMultiContent)
        self.streamMenuList.l.setFont(0, gFont("Regular", self.contentSize))
        self.streamMenuList.l.setItemHeight(25)
        self["filmliste"] = self.streamMenuList

        self.onLayoutFinish.append(self.getTimerEventList)