def execute(self): writeLog("052 Blue Key Pressed") if config.plugins.StayUP.Epg.value: if not os.path.exists("/usr/bin/dbpd"): self.session.open(MessageBox,("Auto EPG really works only on a pure DB IMAGE"), MessageBox.TYPE_INFO) config.plugins.StayUP.Epg.value = False download(self)
def save(self): writeLog("054 Red Key Pressed") if config.plugins.StayUP.Epg.value: if not os.path.exists("/usr/bin/dbpd"): self.session.open(MessageBox,("Auto EPG really works only on a pure DB IMAGE"), MessageBox.TYPE_INFO) config.plugins.StayUP.Epg.value = False for x in self["config"].list: x[1].save() writeLog("060 Configuration Saved") self.close()
def ExecTask(self): writeLog("030 Execution Called") self.loop.stop() if config.plugins.StayUP.Enabled.value: writeLog("035 Looking for new files...") download(self) self.loop.start(480 * 60 * 1000, 1) writeLog("040 Next check in 8 hours...")
def __init__(self): writeLog("000 stayUP init BackgroundWorker mainloop") self.loop = eTimer() self.loop.callback.append(self.ExecTask) if config.plugins.StayUP.Enabled.value: writeLog("010 Background execution Enabled") else: writeLog("015 Background execution Disabled")
def download(self): writeLog("100 Subprocess called") self.location_download="http://www.wallsite.com/Dream/misc/" self.EpgFile="epg.dat.save" self.EpgSignature=self.EpgFile + ".SIGNATURE" self.PiconFile=config.plugins.StayUP.PiconType.value + ".ipk" self.PiconSignature=config.plugins.StayUP.PiconType.value + ".SIGNATURE" self.SettingsFile=config.plugins.StayUP.SettingsType.value + ".ipk" self.SettingsSignature=config.plugins.StayUP.SettingsType.value + ".SIGNATURE" self.AutoUpdateFile="enigma2-stayUP-r10.ipk" self.AutoUpdateSignature=self.AutoUpdateFile + ".MASTERSIGNATURE" if not config.plugins.StayUP.PiconType.value == "disabled_picon": writeLog("110 Picon Refresh Enabled") os.system ("touch /usr/log/" + self.PiconSignature) os.system ("wget -O /tmp/" + self.PiconSignature + " " + self.location_download + self.PiconSignature) self.fname_A = "/tmp/" + self.PiconSignature self.sig_A = md5(open(self.fname_A, "rb").read()).hexdigest() self.fname_B = "/usr/log/" + self.PiconSignature self.sig_B = md5(open(self.fname_B, "rb").read()).hexdigest() if not self.sig_A == self.sig_B: writeLog("120 Downloading Picon") os.system ("ipkg install " + self.location_download + self.PiconFile) os.system ("mv " + self.fname_A + " " + self.fname_B) else: writeLog("130 Picons are already up to date") if not config.plugins.StayUP.SettingsType.value == "disabled_settings": writeLog("150 Settings Refresh Enabled") os.system ("touch /usr/log/" + self.SettingsSignature) os.system ("wget -O /tmp/" + self.SettingsSignature + " " + self.location_download + self.SettingsSignature) self.fname_A = "/tmp/" + self.SettingsSignature self.sig_A = md5(open(self.fname_A, "rb").read()).hexdigest() self.fname_B = "/usr/log/" + self.SettingsSignature self.sig_B = md5(open(self.fname_B, "rb").read()).hexdigest() if not self.sig_A == self.sig_B: writeLog("160 Installing Settings") os.system ("ipkg install " + self.location_download + self.SettingsFile + " -force-overwrite") os.system ("mv " + self.fname_A + " " + self.fname_B) self.eDVBDB = eDVBDB.getInstance() self.eDVBDB.reloadServicelist() self.eDVBDB.reloadBouquets() else: writeLog("170 Settings are already up to date") if config.plugins.StayUP.Epg.value: writeLog("200 EPG Refresh Enabled") os.system ("touch /usr/log/" + self.EpgSignature) os.system ("wget -O /tmp/" + self.EpgSignature + " " + self.location_download + self.EpgSignature) self.fname_A = "/tmp/" + self.EpgSignature self.sig_A = md5(open(self.fname_A, "rb").read()).hexdigest() self.fname_B = "/usr/log/" + self.EpgSignature self.sig_B = md5(open(self.fname_B, "rb").read()).hexdigest() if not self.sig_A == self.sig_B: writeLog("210 Downloading Epg") self.Destination="/tmp/" if os.path.ismount("/media/usb"): self.Destination="/media/usb/" elif os.path.isfile("/media/usb/epg.dat"): writeLog("211 Trace Found") self.Destination="/media/usb/" elif os.path.isfile("/media/usb/epg.dat.save"): writeLog("212 Trace Found") self.Destination="/media/usb/" elif os.path.ismount("/media/cf"): self.Destination="/media/cf/" elif os.path.isfile("/media/cf/epg.dat"): writeLog("213 Trace Found") self.Destination="/media/cf/" elif os.path.isfile("/media/cf/epg.dat.save"): writeLog("214 Trace Found") self.Destination="/media/cf/" elif os.path.ismount("/media/hdd"): self.Destination="/media/hdd/" elif os.path.isfile("/media/hdd/epg.dat"): writeLog("215 Trace Found") self.Destination="/media/hdd" elif os.path.isfile("/media/hdd/epg.dat.save"): writeLog("216 Trace Found") self.Destination="/media/hdd" else: writeLog("225 No suitable path found for EPG Downloading") if not (self.Destination == "/tmp/"): os.system ("wget -O " + self.Destination + "epg.dat " + self.location_download + self.EpgFile) os.system ("mv " + self.fname_A + " " + self.fname_B) epg = eEPGCache.getInstance() epg.reloadEpg() epg.saveEpg() writeLog("220 Epg Download in " + self.Destination ) else: writeLog("225 No suitable path found for EPG Downloading") else: writeLog("230 Epg is already up to date") if config.plugins.StayUP.AutoUpdate.value: writeLog("250 AutoUpdate Enabled") os.system ("touch /usr/lib/enigma2/python/Plugins/Extensions/StayUP/" + self.AutoUpdateSignature) os.system ("wget -O /tmp/" + self.AutoUpdateSignature + " " + self.location_download + self.AutoUpdateSignature) # aggiungere controllo return code o su esistenza files self.fname_A = "/tmp/" + self.AutoUpdateSignature self.sig_A = md5(open(self.fname_A, "rb").read()).hexdigest() self.fname_B = "/usr/lib/enigma2/python/Plugins/Extensions/StayUP/" + self.AutoUpdateSignature self.sig_B = md5(open(self.fname_B, "rb").read()).hexdigest() if not self.sig_A == self.sig_B: writeLog("260 Installing new version, please restart Enigma2" ) os.system ("ipkg install " + self.location_download + self.AutoUpdateFile + " -force-overwrite") os.system ("mv " + self.fname_A + " " + self.fname_B) else: writeLog("270 stayUP is already up to date")
def helpscreen(self): writeLog("050 Help Key Pressed") os.system ("rm /usr/log/*.SIGNATURE") self.session.open(Console, "stayUP", ["cat /usr/lib/enigma2/python/Plugins/Extensions/StayUP/help.txt"])
def startTimer(self): if config.plugins.StayUP.Enabled.value: writeLog("020 Plugin Master Enabled") else: writeLog("025 Plugin Master Disabled") self.loop.start(1, 1)
def exit(self): for x in self["config"].list: x[1].cancel() writeLog("065 Configuration not Saved") self.close()
def logviewer(self): writeLog("053 Yellow Key Pressed") self.session.open(Console, "stayUP", ["cat /tmp/StayUpPlugin.log"])
def about(self): writeLog("051 Red Key Pressed") self.session.open(MessageBox, (_("StayUP")), MessageBox.TYPE_INFO)