def __init__(self, session): self.skin = PurePrestigelangsScreen.skin Screen.__init__(self, session) self.changed = False list = [] self.langs = [] self.menuList = [] self['menu'] = List(self.menuList) self['ButtonYellow'] = Pixmap() self['ButtonYellowtext'] = Label(_('Select all')) self['ButtonBlue'] = Pixmap() self['ButtonBluetext'] = Label(_('Remove languages')) self['ButtonGreen'] = Pixmap() self['ButtonGreentext'] = Label(_('Add language')) self['actions'] = ActionMap(['SetupActions', 'ColorActions'], {'blue': self.prompt, 'yellow': self.selectall, 'green': self.langdownload, 'ok': self.changeSelection, 'cancel': self.exitlan}, -2) self.removelist = [] if os.path.exists(plipath): pass elif fileExists(locallangpypath) and fileExists(langpypath): copyfile(locallangpypath, langpypath) self.languagaes() self.fillskins()
def reboot(self): self.currentSelected = self["config"].l.getCurrentSelection() self.slot = self.currentSelected[0][1] if self.currentSelected[0][1] != "Queued": print "[MultiBootSelector] reboot2 rebootslot = %s, " % self.slot print "[MultiBootSelector] reboot3 slotinfo = %s" % SystemInfo[ "canMultiBoot"] if self.slot < 12: copyfile( path.join( self.mountDir, SystemInfo["canMultiBoot"][self.slot]["startupfile"]), path.join(self.mountDir, "STARTUP")) else: self.slot -= 12 startupfile = path.join( self.mountDir, SystemInfo["canMultiBoot"][self.slot] ["startupfile"].replace("BOXMODE_1", "BOXMODE_12")) print "[MultiBootSelector] reboot5 startupfile = %s" % startupfile if "BOXMODE" in startupfile: copyfile(startupfile, path.join(self.mountDir, "STARTUP")) else: f = open(startupfile, "r").read().replace( "boxmode=1'", "boxmode=12'").replace( "%s" % SystemInfo["canMode12"][0], "%s" % SystemInfo["canMode12"][1]) open(path.join(self.mountDir, "STARTUP"), "w").write(f) self.session.open(TryQuitMainloop, QUIT_REBOOT) self.session.open(TryQuitMainloop, QUIT_REBOOT)
def installCertificates(session, callback = None, l2k = None): print "[WebInterface] Installing SSL Certificates to %s" %resolveFilename(SCOPE_CONFIG) srvcert = '%sserver.pem' %resolveFilename(SCOPE_CONFIG) cacert = '%scacert.pem' %resolveFilename(SCOPE_CONFIG) scope_webif = '%sExtensions/WebInterface/' %resolveFilename(SCOPE_PLUGINS) source = '%setc/server.pem' %scope_webif target = srvcert ret = copyfile(source, target) if ret == 0: source = '%setc/cacert.pem' %scope_webif target = cacert ret = copyfile(source, target) if ret == 0 and callback != None: callback(session, l2k) if ret < 0: config.plugins.Webinterface.https.enabled.value = False config.plugins.Webinterface.https.enabled.save() # Start without https callback(session, l2k) #Inform the user session.open(MessageBox, "Couldn't install SSL-Certifactes for https access\nHttps access is now disabled!", MessageBox.TYPE_ERROR)
def reboot(self): self.currentSelected = self["config"].l.getCurrentSelection() self.slot = self.currentSelected[0][1] if self.currentSelected[0][1] != "Queued": slot = self.currentSelected[0][1][0] boxmode = self.currentSelected[0][1][1] print "[MultiBootSelector] reboot2 reboot slot = %s, " % slot print "[MultiBootSelector] reboot2 reboot boxmode = %s, " % boxmode print "[MultiBootSelector] reboot3 slotinfo = %s" % SystemInfo[ "canMultiBoot"] if SystemInfo["canMode12"]: if "BOXMODE" in SystemInfo["canMultiBoot"][slot][ 'startupfile']: startupfile = path.join( self.mountDir, "%s_%s" % (SystemInfo["canMultiBoot"][slot] ['startupfile'].rsplit('_', 1)[0], boxmode)) copyfile(startupfile, path.join(self.mountDir, "STARTUP")) else: f = open( path.join( self.mountDir, SystemInfo["canMultiBoot"][slot]['startupfile']), "r").read() if boxmode == 12: f = f.replace("boxmode=1'", "boxmode=12'").replace( "%s" % SystemInfo["canMode12"][0], "%s" % SystemInfo["canMode12"][1]) open(path.join(self.mountDir, "STARTUP"), "w").write(f) else: copyfile( path.join(self.mountDir, SystemInfo["canMultiBoot"][slot]["startupfile"]), path.join(self.mountDir, "STARTUP")) self.session.open(TryQuitMainloop, QUIT_REBOOT)
def installCertificates(session, callback=None, l2k=None): print "[WebInterface] Installing SSL Certificates to %s" % resolveFilename(SCOPE_CONFIG) srvcert = "%sserver.pem" % resolveFilename(SCOPE_CONFIG) cacert = "%scacert.pem" % resolveFilename(SCOPE_CONFIG) scope_webif = "%sExtensions/WebInterface/" % resolveFilename(SCOPE_PLUGINS) source = "%setc/server.pem" % scope_webif target = srvcert ret = copyfile(source, target) if ret == 0: source = "%setc/cacert.pem" % scope_webif target = cacert ret = copyfile(source, target) if ret == 0 and callback != None: callback(session, l2k) if ret < 0: config.plugins.Webinterface.https.enabled.value = False config.plugins.Webinterface.https.enabled.save() # Start without https callback(session, l2k) # Inform the user session.open( MessageBox, "Couldn't install SSL-Certifactes for https access\nHttps access is now disabled!", MessageBox.TYPE_ERROR, )
def reboot(self): self.currentSelected = self['config'].l.getCurrentSelection() self.slot = self.currentSelected[0][1] if self.currentSelected[0][1] != 'Queued': print '[MultiBootSelector] reboot2 rebootslot = %s, ' % self.slot print '[MultiBootSelector] reboot3 slotinfo = %s' % SystemInfo[ 'canMultiBoot'] if self.slot < 12: copyfile( path.join( self.mountDir, SystemInfo['canMultiBoot'][self.slot]['startupfile']), path.join(self.mountDir, 'STARTUP')) else: self.slot -= 12 startupfile = path.join( self.mountDir, SystemInfo['canMultiBoot'][self.slot] ['startupfile'].replace('BOXMODE_1', 'BOXMODE_12')) print '[MultiBootSelector] reboot5 startupfile = %s' % startupfile if 'BOXMODE' in startupfile: copyfile(startupfile, path.join(self.mountDir, 'STARTUP')) else: f = open(startupfile, 'r').read().replace( "boxmode=1'", "boxmode=12'").replace( '%s' % SystemInfo['canMode12'][0], '%s' % SystemInfo['canMode12'][1]) open(path.join(self.mountDir, 'STARTUP'), 'w').write(f) self.session.open(TryQuitMainloop, QUIT_REBOOT) self.session.open(TryQuitMainloop, QUIT_REBOOT)
def installFavourites(self, directory, name): self.reloadFavourites = True if self.blocking: copyfile(directory + name, resolveFilename(SCOPE_CONFIG)) self.installNext() elif self.console.execute('cp %s %s' % (directory + name, resolveFilename(SCOPE_CONFIG))): self.installNext()
def reboot(self): self.currentSelected = self["config"].l.getCurrentSelection() self.slot = self.currentSelected[0][1] if self.imagedict[self.slot]["imagename"] == _("Deleted image"): self.session.open(MessageBox, _("Cannot reboot to deleted image"), MessageBox.TYPE_ERROR, timeout=3) self.getImagelist() if self.currentSelected[0][1] != "Queued": print "[MultiBootSelector] reboot2 rebootslot = %s, " % self.slot print "[MultiBootSelector] reboot3 slotinfo = %s" % SystemInfo[ "canMultiBoot"] if self.slot < 12: copyfile( path.join( self.tmp_dir, SystemInfo["canMultiBoot"][self.slot]["startupfile"]), path.join(self.tmp_dir, "STARTUP")) else: self.slot -= 12 startupfile = path.join( self.tmp_dir, SystemInfo["canMultiBoot"][self.slot] ["startupfile"].replace("BOXMODE_1", "BOXMODE_12")) print "[MultiBootSelector] reboot5 startupfile = %s" % startupfile if "BOXMODE" in startupfile: copyfile(startupfile, path.join(self.tmp_dir, "STARTUP")) else: f = open(startupfile, "r").read().replace( "boxmode=1'", "boxmode=12'").replace( "%s" % SystemInfo["canMode12"][0], "%s" % SystemInfo["canMode12"][1]) open(path.join(self.tmp_dir, "STARTUP"), "w").write(f) self.cancel(QUIT_REBOOT)
def settings_restore(self): settings_xml = THISPLUG + "/plugins/" + self.plug + "/resources/settings.xml" settings_xmlbackup = THISPLUG + "/plugins/" + self.plug + "/resources/settings_backup.xml" try: copyfile(settings_xmlbackup, settings_xml) except: cmd = "cp -o " + settings_xmlbackup + " " + settings_xml os.system(cmd)
def restartenigma(self): epgpath = '/media/hdd/epg.dat' epgbakpath = '/media/hdd/epg.dat.bak' if path.exists(epgbakpath): remove(epgbakpath) if path.exists(epgpath): copyfile(epgpath, epgbakpath) self.session.open(TryQuitMainloop, 3)
def init(reason, **kwargs): if reason == 0: if "session" in kwargs: if not os_path.exists("/root/.snes9x/snes9x.conf"): print "[Snes]: config /root/.snes9x/snes9x.conf not found creating defaults..." if not os_path.exists("/root/.snes9x"): os_mkdir("/root/.snes9x") os_mkdir("/root/.snes9x/rom") copyfile(resolveFilename(SCOPE_PLUGINS, "Extensions/SDLSnes/snes9x.conf.default"), "/root/.snes9x/snes9x.conf")
def installFavourites(self, directory, name): self.reloadFavourites = True if self.blocking: copyfile(directory + name, resolveFilename(SCOPE_CONFIG)) self.installNext() else: if self.console.execute("cp %s %s" % ((directory + name), resolveFilename(SCOPE_CONFIG))): self.installNext()
def __init__(self, session, args = None): ScanSetup.__init__(self, session) # backup lamedb confdir = resolveFilename(SCOPE_CONFIG) copyfile(confdir + "/lamedb", confdir + "/lamedb.backup") self.scan_type.value = "multisat" self.createSetup() self.scanIndex = 0 self.selectSat(0) self.onFirstExecBegin.append(self.runScan)
def __init__(self, session, args=None): ScanSetup.__init__(self, session) # backup lamedb confdir = resolveFilename(SCOPE_CONFIG) copyfile(confdir + "/lamedb", confdir + "/lamedb.backup") self.scan_type.value = "multisat" self.createSetup() self.scanIndex = 0 self.selectSat(0) self.onFirstExecBegin.append(self.runScan)
def installFavourites(self, directory, name): print "installing favourites:", directory, " - ", name self.reloadFavourites = True if self.blocking: copyfile(directory + name, resolveFilename(SCOPE_CONFIG)) self.installNext() else: if self.console.execute("cp %s %s" % ((directory + name), resolveFilename(SCOPE_CONFIG))): print "execute failed" self.installNext()
def restartenigma(self, result): if result: epgpath = '/media/hdd/epg.dat' epgbakpath = '/media/hdd/epg.dat.bak' if path.exists(epgbakpath): remove(epgbakpath) if path.exists(epgpath): copyfile(epgpath, epgbakpath) self.session.open(TryQuitMainloop, 3) else: self.close(True)
def showPurePrestige(self): path = plugin_path + 'ts_useraddons.xml' userPath = '/etc/ts_useraddons.xml' try: if fileExists(userPath): path = userPath else: copyfile(path, userPath) except: pass self.session.open(PurePrestigebootlogo)
def accept(self): print('[PrestigesatEditor] copying temp satellite file to target') if os_path.exists(TMPFILE): try: copyfile(TMPFILE, SATFILE) except OSError as error: print('[PrestigesatEditor] error during copying of', TMPFILE) self.session.open(MessageBox, _('Unable to copy temp file.\n%s') % error, type=MessageBox.TYPE_ERROR) self.showAccept = False self['info'].setText('Satellite.xml saved') self.exit()
def PurePrestigeAutostart(reason, **kwargs): epgpath = '/media/hdd/epg.dat' epgbakpath = '/media/hdd/epg.dat.bak' if path.exists(epgbakpath): copyfile(epgbakpath, epgpath) remove(epgbakpath) if reason == 0: try: if config.plugins.PPrestige.items.value == 'Disabled': pass else: print('sessionstart') pScreenGrabber.gotSession(kwargs['session']) except: pass
def autostart(reason, **kwargs): if reason == 0 and "session" in kwargs: session = kwargs["session"] if getProc("shellinaboxd"): copyfile(tpl_dir + "tplTerminal.htm.shellinabox", tpl_dir + "tplTerminal.htm") else: copyfile(tpl_dir + "tplTerminal.htm.default", tpl_dir + "tplTerminal.htm") root = File(eEnv.resolve("${libdir}/enigma2/python/Plugins/Extensions/WebAdmin/web-data")) root.putChild("web", ScreenPage(session, util.sibpath(__file__, "web"), True) ) root.putChild("mobile", ScreenPage(session, util.sibpath(__file__, "mobile"), True) ) root.putChild('tmp', File('/tmp')) root.putChild("uploadtext", UploadTextResource()) root.putChild("uploadpkg", UploadPkgResource()) root.putChild("pkg", PKGResource()) root.putChild("script", Script()) addExternalChild( ("webadmin", root, "WebAdmin", 1, True, "_self") )
def SavePic(self): import datetime now = datetime.datetime.now() day = str(now.day) month = str(now.month) year = str(now.year) hour = str(now.hour) second = str(now.second) datestr = day + month + year + '-' + hour + second if fileExists(self.whatPic): srvName = ServiceReference( self.session.nav.getCurrentlyPlayingServiceReference( )).getServiceName() srvName = srvName.replace('\xc2\x86', '').replace('\xc2\x87', '') srvName = srvName.replace(' ', '_') if config.plugins.PPrestige.storedir.value == 'tmp': self.folder = '/tmp/' else: self.folder = '/media/hdd/' try: if pathExists(self.folder): if self.pictureformat.endswith('jpg'): filename = self.folder + self.srvName + '-' + datestr + '.jpg' else: filename = self.folder + self.srvName + '-' + datestr + '.png' command = 'cp ' + self.pictureformat + ' ' + filename mtext = 'saving picture to...\n' + filename copyfile(self.pictureformat, filename) self.session.open(MessageBox, text=_(filename), type=MessageBox.TYPE_INFO, timeout=3, close_on_any_key=True) else: self.session.open(MessageBox, text=_('Location not available!'), type=MessageBox.TYPE_ERROR, timeout=5, close_on_any_key=True) except: self.session.open(MessageBox, text=_('Failed saving file!'), type=MessageBox.TYPE_ERROR, timeout=5, close_on_any_key=True) self.dexit()
def scanFinished(self, value=None): print "finished" print "self.scanIndex:", self.scanIndex db = eDVBDB.getInstance() print "self.multiscanlist:", self.multiscanlist if len(self.multiscanlist) - 1 >= self.scanIndex and len(self.multiscanlist[self.scanIndex]) > 0: satint = self.multiscanlist[self.scanIndex][0] print "scanned sat:", satint db.saveServicelist("/tmp/lamedb." + str(satint)) file = open("/tmp/sat" + str(satint) + ".info", "w") xml = """<default> <prerequisites> <tag type="services" /> <bcastsystem type="DVB-S" /> <satellite type="%d" /> </prerequisites> <info> <author>%s</author> <name>%s</name> </info> <files type="directories"> <file type="services" name="lamedb.%d"> </file> </files> </default>""" % ( satint, "OpenSPA", nimmanager.getSatDescription(satint), satint, ) file.write(xml) file.close() self.scanIndex += 1 if self.scanIndex + 1 >= len(self.multiscanlist): print "no more sats to scan" confdir = resolveFilename(SCOPE_CONFIG) copyfile(confdir + "/lamedb.backup", confdir + "/lamedb") db.reloadServicelist() self.close() else: self.selectSat(self.scanIndex) self.keyGo()
def main(session, **kwargs): import os if os.path.exists('/tmp/TuneinRadio/') == False: os.mkdir('/tmp/TuneinRadio/') if os.path.exists('/etc/TuneinRadio/') == False: os.mkdir('/etc/TuneinRadio/') if os.path.exists('/tmp/TuneinRadio/pics/') == False: os.mkdir('/tmp/TuneinRadio/pics/') if os.path.exists('/etc/TuneinRadio/') == False: os.mkdir('/etc/TuneinRadio/') if os.path.exists(PLUGIN_PATH + '/lib/defaults/favorites2.xml') and os.path.exists( '/etc/TuneinRadio/favorites2.xml') == False: from Tools.Directories import copyfile copyfile(PLUGIN_PATH + '/lib/defaults/favorites2.xml', '/etc/TuneinRadio/favorites2.xml') from .bootlogo import bootlogo session.open(bootlogo)
def loadIcon(self): try: streamPic = self.playlist[self.playindex][2] except: streamPic = None if streamPic is None or streamPic == '': streamPic = plugin_path + '/skin/micons/TuneinRadio.png' copyfile(streamPic, '/tmp/cover.jpg') self.ShowCover(streamPic) else: try: localpic = streamPic copyfile(localpic, '/tmp/cover2.jpg') self.ShowCover(localpic) except: return return
def scanFinished(self, value=None): print("[DefaultServicesScanner] finished") print("[DefaultServicesScanner] self.scanIndex:", self.scanIndex) db = eDVBDB.getInstance() print("[DefaultServicesScanner] self.multiscanlist:", self.multiscanlist) if len(self.multiscanlist) - 1 >= self.scanIndex and len( self.multiscanlist[self.scanIndex]) > 0: satint = self.multiscanlist[self.scanIndex][0] print("[DefaultServicesScanner] scanned sat:", satint) db.saveServicelist("/tmp/lamedb." + str(satint)) file = open("/tmp/sat" + str(satint) + ".info", "w") xml = """<default> <prerequisites> <tag type="services" /> <bcastsystem type="DVB-S" /> <satellite type="%d" /> </prerequisites> <info> <author>%s</author> <name>%s</name> </info> <files type="directories"> <file type="services" name="lamedb.%d"> </file> </files> </default>""" % (satint, "OpenVision", nimmanager.getSatDescription(satint), satint) file.write(xml) file.close() self.scanIndex += 1 if self.scanIndex + 1 >= len(self.multiscanlist): print("[DefaultServicesScanner] no more sats to scan") confdir = resolveFilename(SCOPE_CONFIG) copyfile(confdir + "/lamedb.backup", confdir + "/lamedb") db.reloadServicelist() self.close() else: self.selectSat(self.scanIndex) self.keyGo()
def installFavourites(self, directory, name, is_root_bouquet = False): print "installing favourites:", directory, " - ", name self.reloadFavourites = True if self.blocking: copyfile(directory + name, resolveFilename(SCOPE_CONFIG)) if not is_root_bouquet: if self.mergeFavourites2Root(name): self.installNext() else: self.installNext() else: if self.console.execute("cp %s %s" % ((directory + name), resolveFilename(SCOPE_CONFIG))): print "execute failed" if not is_root_bouquet: self.mergeFavourites2Root(name) self.installNext() else: if not is_root_bouquet: self.mergeFavourites2Root(name)
def bootDeviceMounted(self, data, retVal, extraArgs): # Part of activateSlot(). if retVal: print( "[MultiBoot] bootDeviceMounted Error %d: Unable to mount boot device '%s'!" % (retVal, self.bootDevice)) self.callback(1) else: bootSlot = self.bootSlots[self.slotCode] startup = bootSlot["startupfile"][self.bootCode] target = STARTUP_ONCE if startup == STARTUP_RECOVERY else STARTUP_FILE copyfile(pathjoin(self.tempDir, startup), pathjoin(self.tempDir, target)) if exists(DUAL_BOOT_FILE): slot = self.slotCode if self.slotCode.isdecimal() else "0" with open(DUAL_BOOT_FILE, "wb") as fd: fd.write(pack("B", int(slot))) # print("[MultiBoot] DEBUG: Installing '%s' as '%s'." % (startup, target)) Console().ePopen([UMOUNT, UMOUNT, self.tempDir], self.bootDeviceUnmounted)
def reboot(self): self.currentSelected = self["config"].l.getCurrentSelection() self.slotx = self.slot = self.currentSelected[0][1][0] if self.imagedict[self.slotx]["imagename"] == _("Deleted image"): self.session.open(MessageBox, _("Cannot reboot to deleted image"), MessageBox.TYPE_ERROR, timeout=3) self.getImagelist() elif self.currentSelected[0][1] != "Queued": slot = self.currentSelected[0][1][0] boxmode = self.currentSelected[0][1][1] print "[MultiBootSelector] reboot2 reboot slot = %s, " % slot print "[MultiBootSelector] reboot2 reboot boxmode = %s, " % boxmode print "[MultiBootSelector] reboot3 slotinfo = %s" % SystemInfo[ "canMultiBoot"] if SystemInfo["canMode12"]: if "BOXMODE" in SystemInfo["canMultiBoot"][slot][ 'startupfile']: startupfile = path.join( self.tmp_dir, "%s_%s" % (SystemInfo["canMultiBoot"][slot] ['startupfile'].rsplit('_', 1)[0], boxmode)) copyfile(startupfile, path.join(self.tmp_dir, "STARTUP")) else: f = open( path.join( self.tmp_dir, SystemInfo["canMultiBoot"][slot]['startupfile']), "r").read() if boxmode == 12: f = f.replace("boxmode=1'", "boxmode=12'").replace( "%s" % SystemInfo["canMode12"][0], "%s" % SystemInfo["canMode12"][1]) open(path.join(self.tmp_dir, "STARTUP"), "w").write(f) else: copyfile( path.join(self.tmp_dir, SystemInfo["canMultiBoot"][slot]["startupfile"]), path.join(self.tmp_dir, "STARTUP")) self.cancel(QUIT_REBOOT)
def reboot(self): self.currentSelected = self["config"].l.getCurrentSelection() self.slot = self.currentSelected[0][1] if self.currentSelected[0][1] != "Queued": slot = self.currentSelected[0][1][0] boxmode = self.currentSelected[0][1][1] print("[MultiBootSelector] reboot2 reboot slot = %s, " % slot) print("[MultiBootSelector] reboot2 reboot boxmode = %s, " % boxmode) print("[MultiBootSelector] reboot3 slotinfo = %s" % BoxInfo.getItem("canMultiBoot")) if BoxInfo.getItem("canMode12"): if "BOXMODE" in BoxInfo.getItem( "canMultiBoot")[slot]['startupfile']: startupfile = pathjoin( self.mountDir, "%s_%s" % (BoxInfo.getItem("canMultiBoot")[slot] ['startupfile'].rsplit('_', 1)[0], boxmode)) copyfile(startupfile, pathjoin(self.mountDir, "STARTUP")) else: f = open( pathjoin( self.mountDir, BoxInfo.getItem("canMultiBoot")[slot] ['startupfile']), "r").read() if boxmode == 12: f = f.replace("boxmode=1'", "boxmode=12'").replace( "%s" % BoxInfo.getItem("canMode12")[0], "%s" % BoxInfo.getItem("canMode12")[1]) open(pathjoin(self.mountDir, "STARTUP"), "w").write(f) else: copyfile( pathjoin( self.mountDir, BoxInfo.getItem("canMultiBoot")[slot]["startupfile"]), pathjoin(self.mountDir, "STARTUP")) if BoxInfo.getItem("canDualBoot"): with open('/dev/block/by-name/flag', 'wb') as f: f.write(struct.pack("B", int(slot))) self.session.open(TryQuitMainloop, QUIT_REBOOT)
def installFavourites(self, directory, name, is_root_bouquet=False): print "installing favourites:", directory, " - ", name self.reloadFavourites = True if self.blocking: copyfile(directory + name, resolveFilename(SCOPE_CONFIG)) if not is_root_bouquet: if self.mergeFavourites2Root(name): self.installNext() else: self.installNext() else: if self.console.execute( "cp %s %s" % ((directory + name), resolveFilename(SCOPE_CONFIG))): print "execute failed" if not is_root_bouquet: self.mergeFavourites2Root(name) self.installNext() else: if not is_root_bouquet: self.mergeFavourites2Root(name)
def loadPic(self, sTitle=None): try: self.stimer.stop() self.stimer.callback.remove(self.slideshow) except: pass if sTitle is None or sTitle.strip() == '': try: streamPic = self.playlist[self.playIdx][2] except: streamPic = None if streamPic is None or streamPic == '': if os.path.exists(PLUGIN_PATH + '/skin/micons/TuneinRadio.png'): cover = PLUGIN_PATH + '/skin/micons/TuneinRadio.png' os.system('cp ' + cover + '/tmp/cover.jpg') copyfile(cover, '/tmp/cover.jpg') self.ShowCover(streamPic) else: downloadPage(streamPic, '/tmp/cover.jpg').addCallback( self.ShowCover).addErrback(self.showerror) else: sTitle = sTitle.replace('\n', ' ') sTitle = sTitle.replace('-', ' ') sTitle = sTitle[:50] sTitle = sTitle.replace(' ', '+') gimage_url = 'https://www.google.co.in/search?q=' + sTitle + '&source=lnms&tbm=isch' print 'gimage_urlxxx', gimage_url, sTitle self.gimage_url = gimage_url self.all_images = [] link, self.all_images = getfirst_image(gimage_url, self.imageindex) if link is None: return self.ShowCover2(link) self.startslideshow() return
def autostart(reason, **kwargs): if reason == 0 and "session" in kwargs: session = kwargs["session"] if getProc("shellinaboxd"): copyfile(tpl_dir + "tplTerminal.htm.shellinabox", tpl_dir + "tplTerminal.htm") else: copyfile(tpl_dir + "tplTerminal.htm.default", tpl_dir + "tplTerminal.htm") root = File( eEnv.resolve( "${libdir}/enigma2/python/Plugins/Extensions/WebAdmin/web-data" )) root.putChild("web", ScreenPage(session, util.sibpath(__file__, "web"), True)) root.putChild( "mobile", ScreenPage(session, util.sibpath(__file__, "mobile"), True)) root.putChild('tmp', File('/tmp')) root.putChild("uploadtext", UploadTextResource()) root.putChild("uploadpkg", UploadPkgResource()) root.putChild("pkg", PKGResource()) root.putChild("script", Script()) addExternalChild(("webadmin", root, "WebAdmin", 1, True, "_self"))
def __initRom(self): path = "/root/.snes9x/rom/" + os_path.basename(self.__rom) if not os_path.exists(path): copyfile(self.__rom, path) return os_path.basename(self.__rom)
def showerror2(self, error): print 'showeeroor2xxx', error cover = PLUGIN_PATH + '/skin/images/infopanel.png' copyfile(cover, '/tmp/cover.jpg') self.ShowCover(None) return
def showerror(self, error): cover = plugin_path + '/skin/micons/TuneinRadio.png' copyfile(cover, '/tmp/cover.jpg') self.ShowCover(None) return