def keyOK(self): if not self.ServerOn: return if self.currentlist == 'A': self.currentlist = 'B' self["B"].selectionEnabled(1) self["A"].selectionEnabled(0) return self.name = self["B"].getCurrent()[0][3] self.jType = '1' if self.name.lower().find('dtt') != -1: self.jType = '0' self.AutoTimer, NameSat, self.Data, Type, self.Personal, self.DowDate = Load() try: nData = int(self.Data) except: nData = 0 try: njData = int(self["B"].getCurrent()[0][1]) except: njData = 999999 if NameSat != self.name or Type != self.jType : self.session.openWithCallback(self.OnDownload, MessageBox, _('The new configurations are saved\nSetting: %s\nDate: %s\nThe choice is different from the previous\nDo you want to proceed with the manual upgrade?')%(self.name, self["B"].getCurrent()[0][4]), MessageBox.TYPE_YESNO, timeout = 20) else: if njData > nData : self.session.openWithCallback(self.OnDownload, MessageBox, _('The new configurations are saved\nSetting: %s\nDate: %s \n The new setting has a more recent date\nDo you want to proceed with the manual upgrade?')%(self.name, self["B"].getCurrent()[0][4]), MessageBox.TYPE_YESNO, timeout = 20) else: self.session.openWithCallback(self.OnDownloadForce, MessageBox, _('Setting already updated, you want to upgrade anyway?'), MessageBox.TYPE_YESNO, timeout = 20)
def keyOK(self): if not self.ServerOn: return if self.currentlist == 'A': self.currentlist = 'B' self['B'].selectionEnabled(1) self['A'].selectionEnabled(0) return self.name = self['B'].getCurrent()[0][3] self.jType = '1' if self.name.lower().find('dtt') != -1: self.jType = '0' self.AutoTimer, NameSat, self.Data, Type, self.Personal, self.DowDate = Load() try: nData = int(self.Data) except: nData = 0 try: njData = int(self['B'].getCurrent()[0][1]) except: njData = 999999 if NameSat != self.name or Type != self.jType: self.session.openWithCallback(self.OnDownload, MessageBox, _('The new configurations are saved\nSetting: %s\nDate: %s\nThe choice is different from the previous\nDo you want to proceed with the manual upgrade?') % (self.name, self['B'].getCurrent()[0][4]), MessageBox.TYPE_YESNO, timeout=20) elif njData > nData: self.session.openWithCallback(self.OnDownload, MessageBox, _('The new configurations are saved\nSetting: %s\nDate: %s \n The new setting has a more recent date\nDo you want to proceed with the manual upgrade?') % (self.name, self['B'].getCurrent()[0][4]), MessageBox.TYPE_YESNO, timeout=20) else: self.session.openWithCallback(self.OnDownloadForce, MessageBox, _('Setting already updated, you want to upgrade anyway?'), MessageBox.TYPE_YESNO, timeout=20)
def Select(self): AutoTimer, NameSat, Data, Type, Personal, DowDate = Load() if str(Personal).strip() == '0': self['Key_Personal'].setText(_("Favourites: Yes")) Personal = '1' self.session.open(MenuSelect) else: self['Key_Personal'].setText(_("Favourites: No")) Personal = '0' WriteSave(NameSat, AutoTimer, Type, Data, Personal, DowDate)
def Select(self): AutoTimer, NameSat, Data, Type, Personal, DowDate = Load() if str(Personal).strip() == '0': self['Key_Personal'].setText(_('Favourites: Yes')) Personal = '1' self.session.open(MenuSelect) else: self['Key_Personal'].setText(_('Favourites: No')) Personal = '0' WriteSave(NameSat, AutoTimer, Type, Data, Personal, DowDate)
def BackgroundAutoUpdate(self): if StartProcess(self.link, self.Type, self.Personal): now = time.time() jt = time.localtime(now) year = str(jt[0]) year = year[2:] DowDate = (str(jt[2]).zfill(2)+'/'+str(jt[1]).zfill(2)+'/'+year+' @ '+str(jt[3]).zfill(2)+':'+str(jt[4]).zfill(2)+':'+str(jt[5]).zfill(2)) WriteSave(self.name, self.AutoTimer, self.Type, self.date, self.Personal, DowDate) eDVBDB.getInstance().reloadServicelist() eDVBDB.getInstance().reloadBouquets() #self.MyMessage.close() self.session.open(MessageBox, (_("New Setting Vhannibal ")+self.name+_(" of ")+ConverDate_noyear(self.date)+_(" updated")), MessageBox.TYPE_INFO, timeout=5) else: self.session.open(MessageBox, _("Sorry!\nError Download Setting"), MessageBox.TYPE_ERROR, timeout=5)
def Auto(self): if self.StopAutoWrite : return self.StopAutoWrite = True iTimerClass.StopTimer() AutoTimer, self.NameSat, self.Data, self.Type, self.Personal, self.DowDate = Load() if int(AutoTimer) == 0: self['autotimer'].setText(_("AutoUpdate: Yes")) self.jAutoTimer = 1 iTimerClass.TimerSetting() else: self['autotimer'].setText(_("AutoUpdate: No")) self.jAutoTimer = 0 self.OnWriteAuto.start(1000, True)
def Auto(self): if self.StopAutoWrite: return self.StopAutoWrite = True iTimerClass.StopTimer() self.AutoTimer, self.NameSat, self.Data, self.Type, self.Personal, self.DowDate = Load() if int(self.AutoTimer) == 0: self['autotimer'].setText(_('AutoUpdate: Yes')) self.AutoTimer = '1' iTimerClass.TimerSetting() else: self['autotimer'].setText(_('AutoUpdate: No')) self.AutoTimer = '0' self.OnWriteAuto.start(500, True)
def Lcn(self): if self.LcnOn: lcn = LCN() lcn.read() if len(lcn.lcnlist) > 0: lcn.writeBouquet() lcn.reloadBouquets() self.session.open(MessageBox, _("Sorting Lcn Completed"), MessageBox.TYPE_INFO, timeout=5)
def Lcn(self): if self.LcnOn: lcn = LCN() lcn.read() if len(lcn.lcnlist) > 0: lcn.writeBouquet() lcn.reloadBouquets() self.session.open(MessageBox, _('Sorting Lcn Completed'), MessageBox.TYPE_INFO, timeout=5)
def DownloadPluginFcn(self, conf): #if yes it will proceed to upgrade if conf: if DownloadPlugin('http://www.vhannibal.net/'+self.VersPlugin[0][0]): self.session.open(MessageBox, _('New version %s downloaded successfully\nEnigma will now be restarted...')%self.VersPlugin[0][1], MessageBox.TYPE_INFO) self.Reload.start(2000, True) os.system('rm -fr /tmp/Plugin.zip') else: #if no the plugin will close itself self.exitplug()
def Info(self): AutoTimer, NameSat, Data, Type, Personal, DowDate = Load() if int(AutoTimer) == 0: TypeTimer = 'No' else: TypeTimer = 'Yes' if int(Personal) == 0: jPersonal = 'No' else: jPersonal = 'Yes' if str(DowDate) == '0': newDowDate = (_('Last Update: Unregistered')) else: newDowDate = (_('Last Update: ')+DowDate) self['Key_Personal'].setText(_("Favourites: ")+jPersonal) self['autotimer'].setText(_("AutoUpdate: ")+TypeTimer) self['namesat'].setText(NameSat) self['dataDow'].setText(newDowDate)
def MenuB(self): self.jB = [] if not self.DubleClick: self.ServerOn = False self.jB.append(self.hauptListEntryMenuB('', '', '', '', '')) self.jB.append(self.hauptListEntryMenuB(_('Coder: m43c0 & ftp21'), '', '', '', '')) self.jB.append(self.hauptListEntryMenuB(_('Skinner: mmark'), '', '', '', '')) self.jB.append(self.hauptListEntryMenuB(_('Vhannibal Official Plugin'), '', '', '', '')) self.jB.append(self.hauptListEntryMenuB(_('www.vhannibal.net'), '', '', '', '')) self["B"].setList(self.jB) return for date, name, link in self.List: if name.lower().find(self["A"].getCurrent()[0][1]) != -1: self.jB.append(self.hauptListEntryMenuB(str(name.title()), str(date), str(link), str(name), ConverDate_noyear(str(date)))) if not self.jB: self.jB.append(self.hauptListEntryMenuB(_('Server down for maintenance'), '', '', '', '')) self["B"].setList(self.jB) self.ServerOn = False self.MenuA() return self["B"].setList(self.jB)
def Info(self): AutoTimer, NameSat, Data, Type, Personal, DowDate = Load() if int(AutoTimer) == 0: TypeTimer = 'No' else: TypeTimer = 'Yes' if int(Personal) == 0: jPersonal = 'No' else: jPersonal = 'Yes' if str(Data) == '0': newdate = '' else: newdate = ' - ' + ConverDate(Data) if str(DowDate) == '0': newDowDate = _('Last Update: Unregistered') else: newDowDate = _('Last Update: ') + DowDate self['Key_Personal'].setText(_('Favourites: ') + jPersonal) self['autotimer'].setText(_('AutoUpdate: ') + TypeTimer) self['namesat'].setText(NameSat + newdate) self['dataDow'].setText(newDowDate)
def MenuB(self): self.jB = [] if not self.DubleClick: self.ServerOn = False self.jB.append(self.hauptListEntryMenuB('', '', '', '', '')) self.jB.append(self.hauptListEntryMenuB(_('Coder: m43c0 & ftp21'), '', '', '', '')) self.jB.append(self.hauptListEntryMenuB(_('Skinner: mmark'), '', '', '', '')) self.jB.append(self.hauptListEntryMenuB(_('Vhannibal Official Plugin'), '', '', '', '')) self.jB.append(self.hauptListEntryMenuB(_('www.vhannibal.net'), '', '', '', '')) self['B'].setList(self.jB) return for date, name, link in self.List: if name.lower().find(self['A'].getCurrent()[0][1]) != -1: self.jB.append(self.hauptListEntryMenuB(str(name.title()), str(date), str(link), str(name), ConverDate(str(date)))) if not self.jB: self.jB.append(self.hauptListEntryMenuB(_('Server down for maintenance'), '', '', '', '')) self['B'].setList(self.jB) self.ServerOn = False self.MenuA() return self['B'].setList(self.jB)
def __init__(self, session): self.session = session from Skin.Main import * self.skin = skin self.skin_path = resolveFilename(SCOPE_PLUGINS, "Extensions/NGsetting") Screen.__init__(self, session) self["actions"] = ActionMap(["OkCancelActions", "ShortcutActions", "WizardActions", "ColorActions", "SetupActions", "NumberActions", "MenuActions", "HelpActions", "EPGSelectActions"], { "ok" : self.keyOK, "up" : self.keyUp, "down" : self.keyDown, "blue" : self.Auto, "green" : self.Lcn, "yellow" : self.Select, "cancel": self.exitplug, "left" : self.keyRightLeft, "right" : self.keyRightLeft, "red" : self.exitplug }, -1) self['autotimer'] = Label("") self['namesat'] = Label("" ) self['text'] = Label("" ) self['dataDow'] = Label("" ) self['Green'] = Pixmap() self['Blue'] = Pixmap() self['Yellow'] = Pixmap() self['Green'].hide() self['Yellow'].show() self['Blue'].show() self["Key_Lcn"] = Label('') self.LcnOn = False if os.path.exists(resolveFilename(SCOPE_PLUGINS, 'Extensions/NGsetting/Moduli/NGsetting/Date')) and os.path.exists('/etc/enigma2/lcndb'): self['Key_Lcn'].setText(_("Lcn")) self.LcnOn = True self['Green'].show() self["Key_Red"] = Label(_("Exit")) self["Key_Green"] = Label(_("Setting Installed:")) self["Key_Personal"] = Label("") AutoTimer, NameSat, Data, Type, Personal, DowDate = Load() self['A'] = MenuListiSettingE2A([]) self['B'] = MenuListiSettingE2([]) self["B"].selectionEnabled(1) self["A"].selectionEnabled(1) self.currentlist = 'B' self.ServerOn = True self.DubleClick = True self.MenuA() self.List = DownloadSetting() self.MenuB() self.iTimer = eTimer() self.iTimer.callback.append(self.keyRightLeft) self.iTimer.start(1000, True) self.iTimer1 = eTimer() self.iTimer1.callback.append(self.StartSetting) self.Message = eTimer() self.Message.callback.append(self.MessagePlugin) self.OnWriteAuto = eTimer() self.OnWriteAuto.callback.append(self.WriteAuto) self.StopAutoWrite = False self.ExitPlugin = eTimer() self.ExitPlugin.callback.append(self.PluginClose) self.Reload = eTimer() self.Reload.callback.append(self.ReloadGui) self.onShown.append(self.ReturnSelect) self.onShown.append(self.Info) self.VersPlugin = Plugin() if self.VersPlugin: if self.VersPlugin[0][1] != Version: self.Message.start(2000, True)
def ReturnSelect(self): AutoTimer, NameSat, Data, Type, Personal, DowDate = Load() if not os.path.exists(resolveFilename(SCOPE_PLUGINS, 'Extensions/NGsetting/Moduli/NGsetting/Select')) or os.path.getsize(resolveFilename(SCOPE_PLUGINS, 'Extensions/NGsetting/Moduli/NGsetting/Select')) < 20: self['Key_Personal'].setText(_("Favourites: No")) WriteSave(NameSat, AutoTimer, Type, Data, '0', DowDate)
def MessagePlugin(self): self.session.openWithCallback(self.DownloadPlugin, MessageBox, _('New version %s \nWant to install?') % self.VersPlugin[0][1], MessageBox.TYPE_YESNO, timeout=20)
def ReturnSelect(self): AutoTimer, NameSat, Data, Type, Personal, DowDate = Load() if not os.path.exists('/usr/lib/enigma2/python/Plugins/Extensions/NGsetting/Moduli/NGsetting/Select') or os.path.getsize('/usr/lib/enigma2/python/Plugins/Extensions/NGsetting/Moduli/NGsetting/Select') < 20: self['Key_Personal'].setText(_('Favourites: No')) WriteSave(NameSat, AutoTimer, Type, Data, '0', DowDate)
def DownloadPlugin(self, conf): if conf: if DownloadPlugin('http://www.vhannibal.net/' + self.VersPlugin[0][0]): self.session.open(MessageBox, _('New version %s downloaded successfully\nRestart enigma2.. ...') % self.VersPlugin[0][1], MessageBox.TYPE_INFO) self.Reload.start(2000, True) os.system('rm -fr /tmp/Plugin.zip')
def DownloadPluginFcn(self): if DownloadPlugin('http://www.vhannibal.net/'+self.VersPlugin[0][0]): self.session.open(MessageBox, _('New version %s downloaded successfully\nEnigma will now be restarted...')%self.VersPlugin[0][1], MessageBox.TYPE_INFO) self.Reload.start(2000, True) os.system('rm -fr /tmp/Plugin.zip')
def startTimerSetting(self,Auto=False): self.AutoTimer, NameSat, Data, self.Type, self.Personal, DowDate = Load() def OnDsl(): try: urllib2.urlopen('http://www.google.com', None, 3) return True except: return False if OnDsl(): for self.date, self.name, self.link in DownloadSetting(): if self.name == NameSat: if self.date > Data or Auto: #checks if vas version is the latest self.VersPlugin = Plugin() if self.VersPlugin: if self.VersPlugin[0][1] != Version: #if outdated, ask to upgrade self.session.openWithCallback(self.CheckUpgradeAnswer, MessageBox, _('To update your settings, you have to install Vhannibal AutoSetting %s\nThe update is mandatory, do you want to proceed?\nEnigma will restart')%self.VersPlugin[0][1], MessageBox.TYPE_YESNO) else: self.BackgroundAutoUpdate() break self.TimerSetting()
def __init__(self, session): self.session = session skin = '%s/Skin/Main.xml' % os.path.dirname(sys.modules[__name__].__file__) f = open(skin, 'r') self.skin = f.read() f.close() Screen.__init__(self, session) self['actions'] = ActionMap(['OkCancelActions', 'ShortcutActions', 'WizardActions', 'ColorActions', 'SetupActions', 'NumberActions', 'MenuActions', 'HelpActions', 'EPGSelectActions'], {'ok': self.keyOK, 'up': self.keyUp, 'down': self.keyDown, 'blue': self.Auto, 'green': self.Lcn, 'yellow': self.Select, 'cancel': self.exitplug, 'left': self.keyRightLeft, 'right': self.keyRightLeft, 'red': self.exitplug}, -1) self['autotimer'] = Label('') self['namesat'] = Label('') self['text'] = Label('') self['dataDow'] = Label('') self['Green'] = Pixmap() self['Blue'] = Pixmap() self['Yellow'] = Pixmap() self['Green'].hide() self['Yellow'].show() self['Blue'].show() self['Key_Lcn'] = Label('') self.LcnOn = False if os.path.exists('/usr/lib/enigma2/python/Plugins/Extensions/NGsetting/Moduli/NGsetting/Date') and os.path.exists('/etc/enigma2/lcndb'): self['Key_Lcn'].setText(_('Lcn')) self.LcnOn = True self['Green'].show() self['Key_Red'] = Label(_('Exit')) self['Key_Green'] = Label(_('Setting Installed:')) self['Key_Personal'] = Label('') AutoTimer, NameSat, Data, Type, Personal, DowDate = Load() self['A'] = MenuListiSettingE2A([]) self['B'] = MenuListiSettingE2([]) self['B'].selectionEnabled(1) self['A'].selectionEnabled(1) self.currentlist = 'B' self.ServerOn = True self.DubleClick = True self.MenuA() self.List = DownloadSetting() self.MenuB() self.iTimer = eTimer() self.iTimer.callback.append(self.keyRightLeft) self.iTimer.start(1000, True) self.iTimer1 = eTimer() self.iTimer1.callback.append(self.StartSetting) self.Message = eTimer() self.Message.callback.append(self.MessagePlugin) self.OnWriteAuto = eTimer() self.OnWriteAuto.callback.append(self.WriteAuto) self.StopAutoWrite = False self.ExitPlugin = eTimer() self.ExitPlugin.callback.append(self.PluginClose) self.Reload = eTimer() self.Reload.callback.append(self.ReloadGui) self.onShown.append(self.ReturnSelect) self.onShown.append(self.Info) self.VersPlugin = Plugin() if self.VersPlugin: if self.VersPlugin[0][1] != Version: self.Message.start(2000, True)
def MessagePlugin(self): self.session.openWithCallback(self.DownloadPluginFcn, MessageBox, _('Vhannibal AutoSetting %s is available\nThe update is mandatory, do you want to proceed?\nEnigma will restart')%self.VersPlugin[0][1], MessageBox.TYPE_YESNO)