def __init__(self, session): Screen.__init__(self, session) self.session = session self["description"] = Label("description") self['MenuListSetting'] = MenuListSetting([]) self.skinName = "Programmlisten_Updater" self.setup_title = _("Programmlisten-Updater from DXAndy") self.setTitle(self.setup_title) self["description"] = Label(_("Current installed") + ":\n" + "n/a") self["update"] = Label(_("disabled")) self["key_red"] = StaticText(_("Exit")) self["key_green"] = StaticText(_("Install")) self["key_yellow"] = StaticText(_("AutoUpdate")) self["ColorActions"] = ActionMap( [ 'OkCancelActions', 'MenuActions', 'ShortcutActions', "ColorActions", "InfobarEPGActions" ], { "red": self.keyCancel, "green": self.keyOk, "yellow": self.keyAutoUpdate, "cancel": self.keyCancel, "ok": self.keyOk, "menu": self.keyMenu, "InfoPressed": self.keyHistory, }) self.List = DownloadSetting(URL) self.SettingsMenu() self.onShown.append(self.Info) config.pud.showmessage.value = True
def startTimerSetting(self): def OnDsl(): try: urllib2.urlopen('http://www.google.de', None, 3) return (True and config.pud.showmessage.value) except: return False return if OnDsl(): print "Programmlisten-Updater: CHECK FOR UPDATE" sList = DownloadSetting(self.url) for date, name, link in sList: if name == config.pud.satname.value: lastdate = config.pud.lastdate.value if date > ConverDateBack(lastdate): self.date = date self.name = name self.link = link yesno_default = config.pud.update_question.value print "Programmlisten-Updater: NEW SETTINGS DXANDY" if config.pud.just_update.value: # Update without information self.startDownload(self.name, self.link, ConverDate(self.date)) else: # Auto update with confrimation self.session.openWithCallback(self.CBupdate, MessageBox, _('New Setting DXAndy ') + name + _(' of ') + ConverDate(date) + _(' available !!' + "\n\n" + "Do you want to install the new settingslist?"), MessageBox.TYPE_YESNO, default=yesno_default, timeout=60) else: print "Programmlisten-Updater: NO NEW UPDATE AVAILBLE" break self.TimerSetting()
def InstallSettings(name, link, date): def DownloadSetting(link): req = urllib2.Request(link) req.add_header('User-Agent', 'VAS') response = urllib2.urlopen(req) newlink = response.read() response.close() Setting = open(Directory + '/Settings/tmp/listE2.zip', 'w') Setting.write(newlink) Setting.close() if os.path.exists(Directory + '/Settings/tmp/listE2.zip'): os.system('mkdir ' + Directory + '/Settings/tmp/listE2_unzip') try: os.system('unzip ' + Directory + '/Settings/tmp/listE2.zip -d ' + Directory + '/Settings/tmp/listE2_unzip') except: print "ERROR unzip listE2.zip" if not os.path.exists(Directory + '/Settings/tmp/setting'): os.system('mkdir ' + Directory + '/Settings/tmp/setting') try: os.system('unzip ' + Directory + '/Settings/tmp/listE2_unzip/*.zip -d ' + Directory + '/Settings/tmp/setting') except: print "ERROR unzip %s.zip", name return False Status = True # remove old download if exists if os.path.exists(Directory + '/Settings/tmp'): os.system('rm -rf ' + Directory + '/Settings/tmp') # create a new empty tmp folder if not os.path.exists(Directory + '/Settings/tmp'): os.system('mkdir -p ' + Directory + '/Settings/tmp') # copy current settings if not os.path.exists(Directory + '/Settings/enigma2'): os.system('mkdir -p ' + Directory + '/Settings/enigma2') now = time.time() ttime = time.localtime(now) tt = str(ttime[0])[2:] + str('{0:02d}'.format(ttime[1])) + str('{0:02d}'.format(ttime[2])) + '_' + str('{0:02d}'.format(ttime[3])) + str('{0:02d}'.format(ttime[4])) + str('{0:02d}'.format(ttime[5])) os.system("tar -czvf " + Directory + "/Settings/enigma2/" + tt + "_enigma2settingsbackup.tar.gz" + " -C / /etc/enigma2/*.tv /etc/enigma2/*.radio /etc/enigma2/lamedb") if not DownloadSetting(link): # copy new settings os.system('rm -rf /etc/enigma2/lamedb') os.system('rm -rf /etc/enigma2/*.radio') os.system('rm -rf /etc/enigma2/*.tv') os.system('cp -rf ' + Directory + '/Settings/tmp/setting/*.tv /etc/enigma2/') os.system('cp -rf ' + Directory + '/Settings/tmp/setting/*.radio /etc/enigma2/') os.system('cp -rf ' + Directory + '/Settings/tmp/setting/lamedb /etc/enigma2/') # remove /tmp folder if os.path.exists(Directory + '/Settings/tmp'): os.system('rm -rf ' + Directory + '/Settings/tmp') else: Status = False return Status
def __init__(self, session): Screen.__init__(self, session) self.session = session self["description"] = Label("description") self['MenuListSetting'] = MenuListSetting([]) self.skinName = "koala_Isettings" self.setup_title = _("Listas Canales by jungle-team") self.setTitle(self.setup_title) self["description"] = Label(_("Lista Instalada") + ":" + "n/a") self["update"] = Label(_("disabled")) self["key_red"] = StaticText(_("Exit")) self["key_green"] = StaticText(_("Install")) self["key_blue"] = StaticText(_("Koala InfoPanel")) self["key_yellow"] = StaticText(_("AutoUpdate")) self["textoupdate"] = StaticText(_("AutoUpdate:")) self["home"] = StaticText(_("Koala ISettings - Menu Principal")) self["aciptv"] = StaticText(_("Check Iptv: %s") % chekiptv()) self["ColorActions"] = ActionMap( [ 'OkCancelActions', 'MenuActions', 'ShortcutActions', "ColorActions", "InfobarEPGActions" ], { "red": self.keyCancel, "green": self.keyOk, "yellow": self.keyAutoUpdate, "blue": self.keyinfopanel, "cancel": self.keyCancel, "ok": self.keyOk, "menu": self.keyMenu, "InfoPressed": self.keyHistory, }) self.List = DownloadSetting(URL) self.SettingsMenu() self.onShown.append(self.Info) config.pud.showmessage.value = True
def InstallSettings(name, link, date): def DownloadSetting(link): req = urllib2.Request(link) req.add_header('User-Agent', 'VAS') response = urllib2.urlopen(req) newlink = response.read() response.close() Setting = open(Directory + '/Settings/tmp/listE2.zip', 'w') Setting.write(newlink) Setting.close() if os.path.exists(Directory + '/Settings/tmp/listE2.zip'): os.system('mkdir ' + Directory + '/Settings/tmp/listE2_unzip') try: os.system('unzip ' + Directory + '/Settings/tmp/listE2.zip -d ' + Directory + '/Settings/tmp/listE2_unzip') except: print "ERROR unzip listE2.zip" if not os.path.exists(Directory + '/Settings/tmp/setting'): os.system('mkdir ' + Directory + '/Settings/tmp/setting') try: os.system('unzip ' + Directory + '/Settings/tmp/listE2_unzip/*.zip -d ' + Directory + '/Settings/tmp/setting') except: print "ERROR unzip %s.zip", name return False Status = True # remove old download if exists if os.path.exists(Directory + '/Settings/tmp'): os.system('rm -rf ' + Directory + '/Settings/tmp') # create a new empty tmp folder if not os.path.exists(Directory + '/Settings/tmp'): os.system('mkdir -p ' + Directory + '/Settings/tmp') # copy current settings if not os.path.exists(Directory + '/Settings/enigma2'): os.system('mkdir -p ' + Directory + '/Settings/enigma2') now = time.time() ttime = time.localtime(now) tt = str(ttime[0])[2:] + str('{0:02d}'.format(ttime[1])) + str( '{0:02d}'.format(ttime[2])) + '_' + str('{0:02d}'.format( ttime[3])) + str('{0:02d}'.format(ttime[4])) + str( '{0:02d}'.format(ttime[5])) os.system( "tar -czvf " + Directory + "/Settings/enigma2/" + tt + "_enigma2settingsbackup.tar.gz" + " -C / /etc/enigma2/*.tv /etc/enigma2/*.radio /etc/enigma2/lamedb") def getRemoveList(): RemoveList = [] inhaltfile = Directory + '/Settings/tmp/setting/inhalt.lst' if os.path.isfile(inhaltfile): with open(inhaltfile, 'r') as f: data = f.read().decode("utf-8-sig").encode("utf-8") RemoveList = data.splitlines() return RemoveList if not DownloadSetting(link): RemoveList = getRemoveList() if RemoveList: for file in RemoveList: nFile = '/etc/enigma2/' + file if os.path.isfile( nFile) and not nFile == '/etc/enigma2/lamedb': os.system('rm -rf %s' % nFile) os.system('rm -rf /etc/enigma2/*.del') os.system('rm -rf /etc/enigma2/lamedb') # copy new settings os.system('cp -rf ' + Directory + '/Settings/tmp/setting/*.tv /etc/enigma2/') os.system('cp -rf ' + Directory + '/Settings/tmp/setting/*.radio /etc/enigma2/') os.system('cp -rf ' + Directory + '/Settings/tmp/setting/lamedb /etc/enigma2/') # remove /tmp folder if os.path.exists(Directory + '/Settings/tmp'): os.system('rm -rf ' + Directory + '/Settings/tmp') else: Status = False return Status