def getPiconPath(): #FIXME: check path again after a few hours to detect new paths global PICONPATH if PICONPATH is not None: return PICONPATH # Alternative locations need to come first, as the default location always exists and needs to be the last resort # Sort alternative locations in order of likelyness that they are non-rotational media: # CF/MMC are always memory cards # USB can be memory stick or magnetic hdd or SSD, but stick is most likely # HDD can be magnetic hdd, SSD or even memory stick (if no hdd present) or a NAS pathlist = [ "/media/cf/", "/media/mmc/", "/media/usb/", "/media/hdd/", "/usr/share/enigma2/", "/" ] for p in pathlist: if pathExists(p+ "owipicon/"): PICONPATH = p + "owipicon/" return PICONPATH elif pathExists(p+ "picon/"): PICONPATH = p + "picon/" return PICONPATH return None
def __init__(self): self.cmd = eConsoleAppContainer() self.cache = None self.callbackList = [] self.type = 0 self.maxSize = "0 byte" versionlist = getEnigmaVersionString().split("-") self.oldapi = False try: if len(versionlist) >= 3: self.version = int(versionlist[0] + versionlist[1] + versionlist[2]) if self.version < 20100716: self.oldapi = True except Exception: pass config = CrossEPG_Config() if config.isQBOXHD(): self.oldapi = True if pathExists("/usr/crossepg"): self.home_directory = "/usr/crossepg" elif pathExists("/var/crossepg"): self.home_directory = "/var/crossepg" else: print "[CrossEPG_Config] ERROR!! CrossEPG binaries non found"
def CreateCamList(self): self.list = [] try: test = self.actcam except: self.actcam = "none" if self.actcam != "none" and pathExists(resolveFilename(SCOPE_PLUGINS, "Extensions/AlternativeSoftCamManager/images/actcam.png")): softpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "Extensions/AlternativeSoftCamManager/images/actcam.png")) try: self.list.append((self.actcam, softpng, self.checkcam(self.actcam))) except: print "[ASM] error loading self.actcam" if pathExists(resolveFilename(SCOPE_PLUGINS, "Extensions/AlternativeSoftCamManager/images/defcam.png")): softpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "Extensions/AlternativeSoftCamManager/images/defcam.png")) if len(self.softcamlist.splitlines()) > 0: for line in self.softcamlist.splitlines(): try: if config.plugins.AltSoftcam.OsCamonly.value == True and line.lower().find("oscam") < 0: continue if line != self.actcam: self.list.append((line, softpng, self.checkcam(line))) except: print "[ASM] error loading %s" % line pass self["list"].setList(self.list)
def __init__(self, session, args = 0): Screen.__init__(self, session) self.menu = args list = [] if pathExists('/usr/emu_scripts/'): softcams = listdir('/usr/emu_scripts/') for softcam in softcams: if softcam.lower().startswith('cccam'): list.append((_('CCcam Info'), '1')) if pathExists('/usr/emu_scripts/'): softcams = listdir('/usr/emu_scripts/') for softcam in softcams: if softcam.lower().startswith('oscam'): list.append((_('OScam Info'), '2')) if pathExists('/usr/emu_scripts/'): softcams = listdir('/usr/emu_scripts/') for softcam in softcams: if softcam.lower().startswith('wicardd'): list.append((_('Wicardd Info'), '3')) list.append((_('User Scripts Info'), '4')) self['menu'] = MenuList(list) self['actions'] = ActionMap(['WizardActions', 'DirectionActions'], {'ok': self.go, 'back': self.close}, -1)
def createMovieFolder(): movie = resolveFilename(SCOPE_HDD) if not pathExists(movie): makedirs(movie) timeshift = resolveFilename(SCOPE_TIMESHIFT) if not pathExists(timeshift): makedirs(timeshift)
def __init__(self): if pathExists("/usr/crossepg"): self.home_directory = "/usr/crossepg" elif pathExists("/var/crossepg"): self.home_directory = "/var/crossepg" else: print "[CrossEPG_Config] ERROR!! CrossEPG binaries non found"
def __init__(self, session, args = 0): Screen.__init__(self, session) self.menu = args list = [] if pathExists('/usr/emu_scripts/'): softcams = listdir('/usr/emu_scripts/') for softcam in softcams: if softcam.lower().startswith('cccam') : list.append((_("CCcam Info"), "1")) if pathExists('/usr/emu_scripts/'): softcams = listdir('/usr/emu_scripts/') for softcam in softcams: if softcam.lower().startswith('oscam') : list.append((_("OScam Info"), "2")) if pathExists('/usr/emu_scripts/'): softcams = listdir('/usr/emu_scripts/') for softcam in softcams: if softcam.lower().startswith('wicardd') : list.append((_("Wicardd Info"), "3")) list.append((_("User Scripts Info"), "4")) self["menu"] = MenuList(list) self["actions"] = ActionMap(["WizardActions", "DirectionActions"],{"ok": self.go,"back": self.close,}, -1)
def __init__(self, session, MenuFolder = "" , MenuFile = '_MenuItems'): self.myList = [] self.list = [] self.myPath = MenuFolder self.MenuFile = MenuFile self.SkryptOpcji = "" self.PIC = "" picHeight = 0 if pathExists("%s/_MenuGenerator.sh" % self.myPath) is True: os_system( "%s/_MenuGenerator.sh %s" % (self.myPath, self.myPath) ) MyTitle = "" if pathExists("%s/%s" % (self.myPath,self.MenuFile) ) is True: with open ("%s/%s" % (self.myPath,self.MenuFile), "r") as myMenufile: for MenuItem in myMenufile: MenuItem = MenuItem.rstrip('\n') if not MenuItem or MenuItem[0] == '#': #omijamy komentarze continue if MenuItem[0:5] == "MENU|": MyTitle = MenuItem.replace("MENU|","") elif MenuItem[0:4] == "PIC|": if pathExists( MenuItem.replace("PIC|","") ) is True: self.PIC = MenuItem.replace("PIC|","") picHeight = 236 elif MenuItem[0:5] == "ITEM|": #teraz nierzemy pod uwage tylko te linie co mają odpowiednią ilość | #print MenuItem skladniki = MenuItem.replace("ITEM|","").split('|') if len(skladniki) != 3: continue (NazwaOpcji, TypOpcji, self.SkryptOpcji) = skladniki if NazwaOpcji != "": NazwaOpcji = _(NazwaOpcji) self.myList.append( (NazwaOpcji, TypOpcji, self.SkryptOpcji) ) self.list.append( NazwaOpcji ) myMenufile.close() ListWidth = 480 ListHeight = (len(self.list) + 1) * 22 if ListHeight + 30 + picHeight > 600: ListHeight = 600 - 30 - picHeight skin = """<screen name="myMenu" position="center,center" size="%d,%d" title="%s" >\n""" % (ListWidth, ListHeight + 30 + picHeight, _(MyTitle) ) skin += """<widget name="list" position="0,0" size="%d,%d" scrollbarMode="showOnDemand" />\n""" % (ListWidth, ListHeight + 30) skin += """<widget name="cover" zPosition="4" position="0,%d" size="420,236" transparent="1" alphatest="blend" />""" % (ListHeight + 30) skin += """</screen>""" self["cover"] = Cover2() self.skin = skin self.session = session Screen.__init__(self, session) self["list"] = MenuList(self.list) self["actions"] = ActionMap(["OkCancelActions"], {"ok": self.run, "cancel": self.close}, -1) self.onLayoutFinish.append(self.onStart) self.visible = True
def getIcon(key): filename = resolveFilename(SCOPE_CURRENT_SKIN, "menu/mc_%s.svg" %key) if not pathExists(filename): filename = resolveFilename(SCOPE_CURRENT_SKIN, "menu/mc_%s.png" %key) if pathExists(filename): return filename else: return resolveFilename(SCOPE_PLUGINS, "Extensions/MediaCenter/icons/%s.png" %key)
def addLanguage(self, name, lang, country, encoding): if pathExists(resolveFilename(SCOPE_LANGUAGE, "%s/LC_MESSAGES/enigma2.mo") % str(lang)) is True or \ pathExists(resolveFilename(SCOPE_GOSLANGUAGE, "%s/LC_MESSAGES/enigma2.mo") % str(lang)) is True: try: self.lang[str(lang + "_" + country)] = ((name, lang, country, encoding)) self.langlist.append(str(lang + "_" + country)) print "Language " + str(name) + " added" except: print "Language " + str(name) + " not found"
def __init__(self): if pathExists('/proc/stb/ir/rc/type') and pathExists('/proc/stb/info/boxtype') and getBrandOEM() not in ('gigablue', 'odin', 'ini', 'entwopia', 'tripledot'): self.isSupported = True fd = open('/proc/stb/info/boxtype', 'r') self.boxType = fd.read() fd.close() if config.plugins.remotecontroltype.rctype.value != 0: self.writeRcType(config.plugins.remotecontroltype.rctype.value) else: self.isSupported = False
def getPiconPath(): if pathExists("/media/usb/picon/"): return "/media/usb/picon/" elif pathExists("/media/cf/picon/"): return "/media/cf/picon/" elif pathExists("/usr/share/enigma2/picon/"): return "/usr/share/enigma2/picon/" elif pathExists("/picon/"): return "/picon/" else: return ""
def getPiconPath(): if pathExists('/media/usb/picon/'): return '/media/usb/picon/' elif pathExists('/media/cf/picon/'): return '/media/cf/picon/' elif pathExists('/usr/share/enigma2/picon/'): return '/usr/share/enigma2/picon/' elif pathExists('/picon/'): return '/picon/' else: return ''
def __init__(self): if pathExists('/proc/stb/ir/rc/type') and pathExists('/proc/stb/info/boxtype') and not boxtype.startswith('gb'): self.isSupported = True fd = open('/proc/stb/info/boxtype', 'r') self.boxType = fd.read() fd.close() if config.plugins.remotecontroltype.rctype.getValue() != 0: self.writeRcType(config.plugins.remotecontroltype.rctype.getValue()) else: self.isSupported = False
def createMovieFolder(self): if not pathExists(resolveFilename(SCOPE_HDD)): try: makedirs(resolveFilename(SCOPE_HDD)) except OSError: return -1 if not pathExists(resolveFilename(SCOPE_TIMESHIFT)): try: makedirs(resolveFilename(SCOPE_TIMESHIFT)) except OSError: return -1 return 0
def __init__(self): if pathExists(eEnv.resolve('${sysconfdir}/stb/ir/rc/type')) and pathExists(eEnv.resolve('${sysconfdir}/stb/info/boxtype')): self.isSupported = True fd = open(eEnv.resolve('${sysconfdir}/stb/info/boxtype'), 'r') self.boxType = fd.read() fd.close() if config.plugins.remotecontroltype.rctype.value != 0: self.writeRcType(config.plugins.remotecontroltype.rctype.value) else: self.isSupported = False
def __init__(self): if pathExists("/proc/stb/ir/rc/type") and pathExists("/proc/stb/info/boxtype"): self.isSupported = True fd = open("/proc/stb/info/boxtype", "r") self.boxType = fd.read() fd.close() if config.plugins.remotecontroltype.rctype.value != 0: self.writeRcType(config.plugins.remotecontroltype.rctype.value) else: self.isSupported = False
def __init__(self): self.boxType = "" if pathExists('/proc/stb/ir/rc/type') and pathExists('/proc/stb/info/boxtype') and getBrandOEM() != 'gigablue': self.isSupported = True fd = open('/proc/stb/info/boxtype', 'r') self.boxType = fd.read().strip() fd.close() if config.plugins.remotecontroltype.rctype.value != 0: self.writeRcType(config.plugins.remotecontroltype.rctype.value) else: self.isSupported = False
def SelectorCallback(self, ret): # jako ret dostajemy nazwe wybranego itemu w 0 if ret: if ret[0] == "GOSsettings": from GOSsettings import GOSsetupMenu self.session.openWithCallback(self.prepareListForSelector(), GOSsetupMenu) elif ret[0] == "GOSkeymap": from GOSkeymap import GOSkeymapMenu self.session.openWithCallback(self.prepareListForSelector(), GOSkeymapMenu) elif ret[0] == "GOSuserscripts": from GOSuserscripts import UserScripts self.session.openWithCallback(self.prepareListForSelector(), UserScripts) elif ret[0][0:4] == "Menu": if pathExists("%s/%s/_MenuGenerator.sh" % (self.myPath, ret[0]) ) is True: self.runMenu(ret[0] , "%s/%s" % (self.myPath, ret[0]) ) else: self.session.openWithCallback(self.prepareListForSelector, MessageBox,_("Menu not available","plugin-GOSmanager"), type = MessageBox.TYPE_INFO) elif ret[0] == "GOShddmanager": from GOShddmanager import GOShddmanager self.session.openWithCallback(self.prepareListForSelector(), GOShddmanager) elif ret[0] == "GOSopkg": from GOSopkg import GOSopkg self.session.openWithCallback(self.prepareListForSelector(), GOSopkg) elif ret[0] == "GOSMenuChannels": from GOSMenuChannels import GOSMenuChannels self.session.openWithCallback(self.prepareListForSelector(), GOSMenuChannels) elif ret[0].lower() == "openplisettings": from OpenpliSettings import openPLIsetup self.session.openWithCallback(self.prepareListForSelector(), openPLIsetup) elif ret[0] == "pluginIPTVPlayer": if pathExists(self.myExtensions + "/IPTVPlayer") is True: from Plugins.Extensions.IPTVPlayer.plugin import IPTVPlayerWidget self.session.openWithCallback(self.CloseMe, IPTVPlayerWidget) else: self.session.openWithCallback(self.prepareListForSelector, MessageBox,_("Install IPTVPlayer plugin through OPKG first","plugin-GOSmanager"), type = MessageBox.TYPE_INFO) elif ret[0] == "pluginUserSkin": if pathExists(self.myExtensions + "/UserSkin") is True: from Plugins.Extensions.UserSkin.plugin import UserSkin_Menu self.session.openWithCallback(self.CloseMe, UserSkin_Menu) else: self.session.openWithCallback(self.prepareListForSelector, MessageBox,_("Install UserSkin plugin through OPKG first","plugin-GOSmanager"), type = MessageBox.TYPE_INFO) elif ret[0].lower().find("pluginbrowser") > -1: from Screens.PluginBrowser import PluginBrowser self.session.openWithCallback(self.prepareListForSelector(), PluginBrowser) #elif ret[0].lower().find("extensions") > -1: else: self.session.openWithCallback(self.prepareListForSelector, MessageBox,_("Plugin not available yet","plugin-GOSmanager"), type = MessageBox.TYPE_INFO) else: self.close() return
def findPicon(serviceName): global lastPiconPath if lastPiconPath: pngname = lastPiconPath + serviceName + ".png" if pathExists(pngname): return pngname if not piconInTmp: for piconPath in searchPaths: pngname = piconPath + serviceName + ".png" if pngname: if pathExists(pngname): lastPiconPath = piconPath return pngname return ""
def findPicon(serviceName): global lastPiconPath if lastPiconPath is not None: pngname = lastPiconPath + serviceName + '.png' if pathExists(pngname): return pngname for path in searchPaths: if pathExists(path): pngname = path + serviceName + '.png' if pathExists(pngname): lastPiconPath = path return pngname return ''
def findLcdPicon(serviceName): global lastLcdPiconPath if lastLcdPiconPath is not None: pngname = lastLcdPiconPath + serviceName + ".png" if pathExists(pngname): return pngname global searchPaths for path in searchPaths: if pathExists(path): pngname = path + serviceName + ".png" if pathExists(pngname): lastLcdPiconPath = path return pngname return ""
def __init__(self, session): Screen.__init__(self, session) self["actions"] = ActionMap(["OkCancelActions", "ColorActions", "DirectionActions"], { "cancel": self.KeyExit, "red": self.KeyExit, "green": self.KeyGreen, "yellow": self.KeyYellow, "blue": self.KeyBlue, "ok": self.KeyOk }, -1) self["key_red"] = StaticText(_("Close")) self["key_green"] = StaticText(_("Thumbnails")) self["key_yellow"] = StaticText("") self["key_blue"] = StaticText(_("Setup")) self["label"] = StaticText("") self["thn"] = Pixmap() currDir = config.pic.lastDir.value if not pathExists(currDir): currDir = "/" self.filelist = FileList(currDir, matchingPattern = "(?i)^.*\.(jpeg|jpg|jpe|png|bmp|gif)") self["filelist"] = self.filelist self["filelist"].onSelectionChanged.append(self.selectionChanged) self.ThumbTimer = eTimer() self.ThumbTimer.callback.append(self.showThumb) self.picload = ePicLoad() self.picload.PictureData.get().append(self.showPic) self.onLayoutFinish.append(self.setConf)
def __init__(self): Renderer.__init__(self) self.PicLoad = ePicLoad() self.PicLoad.PictureData.get().append(self.updatePicon) self.piconsize = (0,0) self.pngname = "" self.lastPath = None if getBoxType() in bw_lcd or config.lcd.picon_pack.value: pngname = findLcdPicon("lcd_picon_default") else: pngname = findLcdPicon("picon_default") self.defaultpngname = None if not pngname: if getBoxType() in bw_lcd or config.lcd.picon_pack.value: tmp = resolveFilename(SCOPE_ACTIVE_SKIN, "lcd_picon_default.png") else: tmp = resolveFilename(SCOPE_ACTIVE_SKIN, "picon_default.png") if pathExists(tmp): pngname = tmp else: if getBoxType() in bw_lcd or config.lcd.picon_pack.value: pngname = resolveFilename(SCOPE_ACTIVE_SKIN, "lcd_picon_default.png") else: pngname = resolveFilename(SCOPE_ACTIVE_SKIN, "picon_default.png") if os.path.getsize(pngname): self.defaultpngname = pngname
def __init__(self): if ( pathExists("/proc/stb/ir/rc/type") and pathExists("/proc/stb/info/boxtype") and getBrandOEM() not in ("gigablue", "odin", "ini", "entwopia") ): self.isSupported = True fd = open("/proc/stb/info/boxtype", "r") self.boxType = fd.read() fd.close() if config.plugins.remotecontroltype.rctype.getValue() != 0: self.writeRcType(config.plugins.remotecontroltype.rctype.getValue()) else: self.isSupported = False
def __init__(self): Renderer.__init__(self) self.PicLoad = ePicLoad() self.PicLoad.PictureData.get().append(self.updatePicon) self.piconsize = (0,0) self.pngname = "" self.lastPath = None if getBoxType() == 'vuultimo' or getBoxType() == 'quadbox2400' or getMachineProcModel().startswith("ini-90") or getMachineProcModel().startswith("ini-80"): pngname = findLcdPicon("lcd_picon_default") else: pngname = findLcdPicon("picon_default") self.defaultpngname = None if not pngname: if getBoxType() == 'vuultimo' or getBoxType() == 'quadbox2400' or getMachineProcModel().startswith("ini-90") or getMachineProcModel().startswith("ini-80"): tmp = resolveFilename(SCOPE_ACTIVE_SKIN, "lcd_picon_default.png") else: tmp = resolveFilename(SCOPE_ACTIVE_SKIN, "picon_default.png") if pathExists(tmp): pngname = tmp else: if getBoxType() == 'vuultimo' or getBoxType() == 'quadbox2400' or getMachineProcModel().startswith("ini-90") or getMachineProcModel().startswith("ini-80"): pngname = resolveFilename(SCOPE_ACTIVE_SKIN, "lcd_picon_default.png") else: pngname = resolveFilename(SCOPE_ACTIVE_SKIN, "picon_default.png") if os.path.getsize(pngname): self.defaultpngname = pngname
def showMenu(self): menu = [] if len(self.cdAudioTrackFiles): menu.insert(0, (_("Play Audio-CD..."), "audiocd")) if self.currList == "filelist": #menu.append((_("add selection after current playing"), "addAfterCurrent")) if self.filelist.canDescent(): menu.append((_("add directory to playlist"), "copydir")) else: menu.append((_("add files to playlist"), "copyfiles")) menu.append((_("switch to playlist"), "playlist")) else: menu.append((_("switch to filelist"), "filelist")) menu.append((_("clear playlist"), "clear")) menu.append((_("Delete entry"), "deleteentry")) if config.usage.setup_level.index >= 1: # intermediate+ menu.append((_("shuffle playlist"), "shuffle")) if pathExists("/usr/lib/enigma2/python/Plugins/Extensions/PicturePlayer/"): menu.append((_("PicturePlayer"), "PicturePlayer")); if config.usage.setup_level.index >= 1: # intermediate+ menu.append((_("delete file"), "deletefile")) menu.append((_("hide player"), "hide")); menu.append((_("load playlist"), "loadplaylist")); if config.usage.setup_level.index >= 1: # intermediate+ menu.append((_("save playlist"), "saveplaylist")); menu.append((_("delete saved playlist"), "deleteplaylist")); menu.append((_("Edit settings"), "settings")) menu.append((_("add/remove bookmarks (locationbox)"), "locationbox")) if self.currList == "filelist": menu.append((_("---------------------- bookmarks -------------------"), "line")) for x in self.bookmarks.value: menu.append((x, x)) self.session.openWithCallback(self.menuCallback, ChoiceBox, title="", list=menu)
def addPath(self, value): if pathExists(value): global searchPaths if not value.endswith('/'): value += '/' if value not in searchPaths: searchPaths.append(value)
def __init__(self): Renderer.__init__(self) self.PicLoad = ePicLoad() self.PicLoad.PictureData.get().append(self.updatePicon) self.piconsize = (0,0) self.pngname = "" self.lastPath = None if getBoxType() in ('vuultimo', 'et10000', 'mutant2400', 'xpeedlx3', 'quadbox2400', 'sezammarvel', 'atemionemesis', 'mbultra', 'beyonwizt4', 'dm7080'): pngname = findLcdPicon("lcd_picon_default") else: pngname = findLcdPicon("picon_default") self.defaultpngname = None if not pngname: if getBoxType() in ('vuultimo', 'et10000', 'mutant2400', 'xpeedlx3', 'quadbox2400', 'sezammarvel', 'atemionemesis', 'mbultra', 'beyonwizt4', 'dm7080'): tmp = resolveFilename(SCOPE_ACTIVE_SKIN, "lcd_picon_default.png") else: tmp = resolveFilename(SCOPE_ACTIVE_SKIN, "picon_default.png") if pathExists(tmp): pngname = tmp else: if getBoxType() in ('vuultimo', 'et10000', 'mutant2400', 'xpeedlx3', 'quadbox2400', 'sezammarvel', 'atemionemesis', 'mbultra', 'beyonwizt4', 'dm7080'): pngname = resolveFilename(SCOPE_ACTIVE_SKIN, "lcd_picon_default.png") else: pngname = resolveFilename(SCOPE_ACTIVE_SKIN, "picon_default.png") if os.path.getsize(pngname): self.defaultpngname = pngname
def gO(self): paths = ["/media/hdd","/media/usb","/media/uSDextra","/media/downloads","/media/music","/media/personal","/media/photo","/media/video"] for path in paths: if not pathExists(path): createDir(path) # hack ! self.activityTimer.start(1)
def __init__(self, session): Screen.__init__(self, session) HelpableScreen.__init__(self) self["key_red"] = Button(_("Favorites")) self["key_yellow"] = Button("") self["key_blue"] = Button(_("Settings")) self["currentfolder"] = Label("") self["currentfavname"] = Label("") self.showiframe = Showiframe() self.mvion = False self.curfavfolder = -1 os.system("touch /tmp/bmcmovie") self["actions"] = HelpableActionMap(self, "MC_VideoPlayerActions", { "ok": (self.KeyOk, "Play selected file"), "cancel": (self.Exit, "Exit Video Player"), "left": (self.leftUp, "List Top"), "right": (self.rightDown, "List Bottom"), "up": (self.up, "List up"), "down": (self.down, "List down"), "menu": (self.KeyMenu, "File / Folder Options"), "info": (self.showFileInfo, "Show File Info"), "nextBouquet": (self.NextFavFolder, "Next Favorite Folder"), "prevBouquet": (self.PrevFavFolder, "Previous Favorite Folder"), # "red": (self.FavoriteFolders, "Favorite Folders"), "blue": (self.KeySettings, "Settings"), }, -2) currDir = config.plugins.mc_vp.lastDir.value if not pathExists(currDir): currDir = "/" self["currentfolder"].setText(str(currDir)) sort = config.plugins.mc_vp_sortmode.enabled.value self.filelist = [] self["filelist"] = [] inhibitDirs = ["/bin", "/boot", "/dev", "/dev.static", "/etc", "/lib" , "/proc", "/ram", "/root" , "/sbin", "/sys", "/tmp", "/usr", "/var"] self.filelist = FileList(currDir, useServiceRef = True, showDirectories = True, showFiles = True, matchingPattern = "(?i)^.*\.(ts|vob|mpg|mpeg|avi|mkv|dat|iso|img|mp4|wmv|flv|divx|mov|ogm|m2ts)", additionalExtensions = None, sort = sort) self["filelist"] = self.filelist self["filelist"].show()
def changed(self, what): if self.instance: pngname = "" if what[0] == 1 or what[0] == 3: pngname = getPiconName(self.source.text) if pngname: tempname = pngname.replace(lastPiconPath, "") if not pathExists(pngname): # no picon for service found pngname = self.defaultpngname if self.pngname != pngname: try: if pngname != self.defaultpngname: im = Image.open(pngname).convert('RGBA').resize( (self.piconsize), Image.ANTIALIAS).save( "/tmp/temppicons/" + str(tempname), "PNG") self.instance.setScale(1) self.instance.setPixmapFromFile( "/tmp/temppicons/" + str(tempname)) self.instance.show() elif pngname == self.defaultpngname: im = Image.open(pngname).convert('RGBA').resize( (self.piconsize), Image.ANTIALIAS).save( "/tmp/temppicons/" + "picon_default.png", "PNG") self.instance.setScale(1) self.instance.setPixmapFromFile( "/tmp/temppicons/picon_default.png") self.instance.show() else: self.instance.hide() except Exception as e: print(e) print("[Picon] Bad picon file?: %s" % pngname) return self.pngname = pngname # delete any existing pngs if os.path.exists('/tmp/temppicons'): for filename in glob.glob('/tmp/temppicons/*.png'): os.remove(filename)
def __init__(self, session): Screen.__init__(self, session) self["actions"] = ActionMap( [ "OkCancelActions", "ColorActions", "DirectionActions", "MenuActions" ], { "cancel": self.KeyExit, "red": self.KeyExit, "green": self.KeyGreen, "yellow": self.KeyYellow, "menu": self.KeyMenu, "ok": self.KeyOk }, -1) self["key_red"] = StaticText(_("Close")) self["key_green"] = StaticText(_("Thumbnails")) self["key_yellow"] = StaticText("") self["key_menu"] = StaticText(_("MENU")) self["label"] = StaticText("") self["thn"] = Pixmap() currDir = config.pic.lastDir.value if not pathExists(currDir): currDir = "/" self.filelist = FileList( currDir, matchingPattern="(?i)^.*\.(jpeg|jpg|jpe|png|bmp|gif|svg)") self["filelist"] = self.filelist self["filelist"].onSelectionChanged.append(self.selectionChanged) self.ThumbTimer = eTimer() self.ThumbTimer.callback.append(self.showThumb) self.picload = ePicLoad() self.picload.PictureData.get().append(self.showPic) self.onLayoutFinish.append(self.setConf)
def Stage1Complete(self, result, retval, extra_args=None): result = result.replace('\n ', ' ').split('\n') self.mountinfo = "" for line in result: self.parts = line.split() if line and self.parts[0] and (self.parts[0].startswith('192') or self.parts[0].startswith('//192')): line = line.split() ipaddress = line[0] mounttotal = line[1] mountfree = line[3] if self.mountinfo: self.mountinfo += "\n" self.mountinfo += "%s (%sB, %sB %s)" % (ipaddress, mounttotal, mountfree, _("free")) if pathExists("/media/autofs"): for entry in sorted(listdir("/media/autofs")): mountEntry = path.join("/media/autofs", entry) self.mountinfo += _("\n %s is also enabled for autofs network mount" % (mountEntry)) if self.mountinfo: self["mounts"].setText(self.mountinfo) else: self["mounts"].setText(_('none')) self["actions"].setEnabled(True)
def __init__(self): Renderer.__init__(self) self.PicLoad = ePicLoad() self.PicLoad.PictureData.get().append(self.updatePicon) self.piconsize = (0, 0) self.pngname = '' self.lastPath = None pngname = findPicon('picon_default') self.defaultpngname = None if not pngname: tmp = resolveFilename(SCOPE_ACTIVE_SKIN, 'picon_default.png') if pathExists(tmp): pngname = tmp else: pngname = resolveFilename(SCOPE_SKIN_IMAGE, 'skin_default/picon_default.png') self.nopicon = resolveFilename(SCOPE_SKIN_IMAGE, 'skin_default/picon_default.png') if os.path.getsize(pngname): self.defaultpngname = pngname self.nopicon = pngname return
def changed(self, what): if self.instance: if what[0] in (self.CHANGED_DEFAULT, self.CHANGED_ALL, self.CHANGED_SPECIFIC): pngname = lcdPiconLocator.getPiconName(self.source.text) if not pathExists(pngname): # no picon for service found pngname = self.defaultpngname if self.pngname != pngname: if pngname: self.PicLoad.setPara((self.piconsize[0], self.piconsize[1], 0, 0, 1, 1, "#FF000000")) if self.PicLoad.startDecode(pngname): # if this has failed, then another decode is probably already in progress # throw away the old picload and try again immediately self.PicLoad = ePicLoad() self.PicLoad.PictureData.get().append(self.updatePicon) self.PicLoad.setPara((self.piconsize[0], self.piconsize[1], 0, 0, 1, 1, "#FF000000")) self.PicLoad.startDecode(pngname) else: self.instance.hide() self.pngname = pngname elif what[0] == self.CHANGED_CLEAR: self.pngname = None self.instance.hide()
def changed(self, what): if self.instance: pngname = None gifname = None try: if not what[0] is self.CHANGED_CLEAR: if self.source.text is not None and self.source.text != '': if self.GIFsupport == True: gifname = getPiconName(self.source.text, self.GifsPath) pngname = getPiconName(self.source.text, self.piconType) if DBG: j00zekDEBUG( '[j00zekPicons]:[changed] gifname=%s, pngname=%s' % (gifname, pngname)) if pngname is None and self.ShowDefault == True: pngname = findPicon('picon_default', self.piconType) if pngname is None and pathExists( resolveFilename(SCOPE_CURRENT_SKIN, 'picon_default.png')): pngname = resolveFilename(SCOPE_CURRENT_SKIN, 'picon_default.png') if pngname is None: self.instance.hide() elif self.pngname != pngname: if pngname: self.instance.setScale(1) self.instance.setPixmapFromFile(pngname) self.instance.show() else: self.instance.hide() self.pngname = pngname if DBG: j00zekDEBUG('[j00zekPicons]:[changed] piconType=' + self.piconType + ', pngname=' + str(pngname)) except Exception, e: j00zekDEBUG('[j00zekPicons]:[changed] Exception:' + str(e))
def prepareListForSelector(self, ret=0): self.myList = [] files = [] for file in os_listdir(self.SubTreesPath): if file.endswith(".png"): if file == "MenuOScam.png": if pathExists("%s/AlternativeSoftCamManager/plugin.pyo" % self.myExtensions) is False: files.append(file) else: files.append(file) files.sort() for file in files: print os_path.join(self.SubTreesPath, file) self.myList.append( (file[:-4], os_path.join(self.SubTreesPath, file), os_path.join(self.myItemsPath, file))) #print self.myList if len(self.myList) >= 1: if config.plugins.GOSmanager.InitStyle.value == 'icons': from selector import SelectorWidget #wybor kanalu po nazwie self.session.openWithCallback(self.SelectorCallback, SelectorWidget, list=self.myList, CurIdx=self.curIndex, Mytitle=_( "Select option", "plugin-GOSmanager")) else: from listselector import ListSelectorWidget #wybor kanalu po nazwie self.session.openWithCallback(self.SelectorCallback, ListSelectorWidget, list=self.myList, Mytitle=_( "Select option", "plugin-GOSmanager")) else: self.close() return
def __init__(self): Renderer.__init__(self) self.PicLoad = ePicLoad() self.PicLoad.PictureData.get().append(self.updatePicon) self.piconsize = (0, 0) self.pngname = "" self.lastPath = None if getBoxType() in ('vuultimo', 'et10000', 'mutant2400', 'xpeedlx3', 'quadbox2400', 'sezammarvel', 'atemionemesis', 'mbultra', 'beyonwizt4', 'dm7080') and not SystemInfo["grautec"]: pngname = findLcdPicon("lcd_picon_default") else: pngname = findLcdPicon("picon_default") self.defaultpngname = None if not pngname: if getBoxType() in ('vuultimo', 'et10000', 'mutant2400', 'xpeedlx3', 'quadbox2400', 'sezammarvel', 'atemionemesis', 'mbultra', 'beyonwizt4', 'dm7080') and not SystemInfo["grautec"]: tmp = resolveFilename(SCOPE_ACTIVE_SKIN, "lcd_picon_default.png") else: tmp = resolveFilename(SCOPE_ACTIVE_SKIN, "picon_default.png") if pathExists(tmp): pngname = tmp else: if getBoxType() in ('vuultimo', 'et10000', 'mutant2400', 'xpeedlx3', 'quadbox2400', 'sezammarvel', 'atemionemesis', 'mbultra', 'beyonwizt4', 'dm7080') and not SystemInfo["grautec"]: pngname = resolveFilename(SCOPE_ACTIVE_SKIN, "lcd_picon_default.png") else: pngname = resolveFilename(SCOPE_ACTIVE_SKIN, "picon_default.png") if os.path.getsize(pngname): self.defaultpngname = pngname
def __init__(self, session): Screen.__init__(self, session) HelpableScreen.__init__(self) self["key_green"] = Button("Slide Show") self["key_yellow"] = Button("Thumb View") self["currentfolder"] = Label("") self["currentfavname"] = Label("") self["actions"] = HelpableActionMap(self, "MC_PictureViewerActions", { "ok": (self.KeyOk, "Show Picture"), "cancel": (self.Exit, "Exit Picture Viewer"), "left": (self.leftUp, "List Top"), "right": (self.rightDown, "List Bottom"), "up": (self.up, "List up"), "down": (self.down, "List down"), "info": (self.StartExif, "Show File Info"), "green": (self.startslideshow, "Start Slideshow"), "yellow": (self.StartThumb, "Thumb View"), "blue": (self.Settings, "Settings"), }, -2) self.aspect = getAspect() currDir = config.plugins.mc_pp.lastDir.value if not pathExists(currDir): currDir = "/" self["currentfolder"].setText(str(currDir)) self.filelist = [] self["filelist"] = [] inhibitDirs = ["/bin", "/boot", "/dev", "/dev.static", "/etc", "/lib" , "/proc", "/ram", "/root" , "/sbin", "/sys", "/tmp", "/usr", "/var"] self.filelist = FileList(currDir, showDirectories = True, showFiles = True, showMountpoints = True, isTop = False, matchingPattern = "(?i)^.*\.(jpeg|jpg|jpe|png|bmp)", inhibitDirs = inhibitDirs) self["filelist"] = self.filelist self["filelist"].show() self["thumbnail"] = Pixmap() self.ThumbTimer = eTimer() self.ThumbTimer.callback.append(self.showThumb) self.ThumbTimer.start(500, True) self.picload = ePicLoad()
def updateList2(self): self.activityTimer.stop() self.list = [] list2 = [] f = open('/proc/partitions', 'r') for line in f.readlines(): parts = line.strip().split() if not parts: continue device = parts[3] if not re.search('sd[a-z][1-9]', device) and not re.search('mmcblk[0-9]p[1-9]', device): continue if SystemInfo["HasHiSi"] and pathExists("/dev/sda4") and re.search('sd[a][1-4]', device): continue if SystemInfo["HasMMC"] and "root=/dev/mmcblk0p1" in open('/proc/cmdline', 'r').read() and re.search('mmcblk0p1', device): # h9 using SDcard(mmcblk0p1) for root continue if device in list2: continue self.buildMy_rec(device) list2.append(device) f.close() self['list'].list = self.list self['lab1'].hide()
def remove_ipk(self): local_status = ipk_dir = '' pkg_name = self["menu"].getCurrent()[0] if self.status: local_status = '-force-remove' self.staus = False if 'plugin' in pkg_name or 'skin' in pkg_name: if fileExists('%s%s.list' % (self.path[:-6] + 'info/', pkg_name)): for line in open('%s%s.list' % (self.path[:-6] + 'info/', pkg_name)): if 'plugin.py' in line or 'plugin.pyo' in line: ipk_dir = line[:-11] elif 'skin.xml' in line: ipk_dir = line[:-10] self.session.open( Console, title=_("%s" % ipk_dir), cmdlist=["opkg remove %s %s" % (local_status, pkg_name)], closeOnSuccess=False) if pathExists(ipk_dir): self.iConsole.ePopen("rm -rf %s" % ipk_dir, self.finish) else: self.nList()
def __init__(self, session): Screen.__init__(self, session) Screen.setTitle(self, _('Mount Manager')) self['key_red'] = Label('Initialization') self['key_green'] = Label(_('Setup Mounts')) self['key_yellow'] = Label(_('Unmount')) self['key_blue'] = Label(_('Mount')) self['lab1'] = Label() self.onChangedEntry = [] self.list = [] self['list'] = List(self.list) self['list'].onSelectionChanged.append(self.selectionChanged) self['actions'] = ActionMap(['WizardActions', 'ColorActions', 'MenuActions'], {'back': self.close, 'green': self.SetupMounts, 'red': self.Format, 'yellow': self.Unmount, 'blue': self.Mount}) self.activityTimer = eTimer() self.activityTimer.timeout.get().append(self.updateList2) if not pathExists('/universe'): createDir('/universe') self.updateList() self.onShown.append(self.setWindowTitle)
def activateLanguage(self, index): try: lang = self.lang[index] print "Activating language " + lang[0] if pathExists( resolveFilename(SCOPE_GOSLANGUAGE, "%s/LC_MESSAGES/enigma2.mo") % str(lang[1])): self.catalog = gettext.translation('enigma2', resolveFilename( SCOPE_GOSLANGUAGE, ""), languages=[index]) else: self.catalog = gettext.translation('enigma2', resolveFilename( SCOPE_LANGUAGE, ""), languages=[index]) self.catalog.install(names=("ngettext", "pgettext")) self.activeLanguage = index for x in self.callbacks: x() except: print "Selected language does not exist!" # NOTE: we do not use LC_ALL, because LC_ALL will not set any of the categories, when one of the categories fails. # We'd rather try to set all available categories, and ignore the others for category in [ locale.LC_CTYPE, locale.LC_COLLATE, locale.LC_TIME, locale.LC_MONETARY, locale.LC_MESSAGES, locale.LC_NUMERIC ]: try: locale.setlocale(category, (self.getLanguage(), 'UTF-8')) except: pass # HACK: sometimes python 2.7 reverts to the LC_TIME environment value, so make sure it has the correct value os.environ["LC_TIME"] = self.getLanguage() + '.UTF-8' os.environ[ "GST_SUBTITLE_ENCODING"] = self.getGStreamerSubtitleEncoding()
def updateList2(self): self.activityTimer.stop() self.list = [] list2 = [] # self.Console.ePopen("sfdisk -l /dev/sd? | grep swap | awk '{print $(NF-9)}' >/tmp/devices.tmp") # sleep(0.5) # swapdevices = '' # if path.exists('/tmp/devices.tmp'): # f = open('/tmp/devices.tmp', 'r') # swapdevices = f.read() # f.close() # remove('/tmp/devices.tmp') # swapdevices = swapdevices.replace('\n', '') # swapdevices = swapdevices.split('/') z = open('/proc/cmdline', 'r').read() f = open('/proc/partitions', 'r') for line in f.readlines(): parts = line.strip().split() if not parts: continue device = parts[3] if not re.search('sd[a-z][1-9]', device) and not re.search('mmcblk[0-9]p[1-9]', device): continue if SystemInfo["HasSDmmc"] and pathExists("/dev/sda4") and re.search('sd[a][1-4]', device): continue if SystemInfo["HasMMC"] and "root=/dev/mmcblk0p1" in z and re.search('mmcblk0p1', device): continue if device in list2: continue # if device in swapdevices: # continue self.buildMy_rec(device) list2.append(device) f.close() self['config'].list = self.list self['config'].l.setList(self.list) self['Linconn'].hide()
def createsetup(self): skinHistory = None skinUpdate = None skinAddOns = None skinComponents = None if pathExists("%s%s" % (SkinPath, 'skin.config')): with open("%s%s" % (SkinPath, 'skin.config'), 'r') as cf: cfg = cf.read() if cfg.find("history=") > 0: skinHistory = True if cfg.find("skinurl=") > 0: skinUpdate = True if cfg.find("addons=") > 0: skinAddOns = True if cfg.find("components=") > 0: skinComponents = True l = [(self.buildListEntry(_("Skin personalization"), "config.png", 'config'))] #if skinUpdate: # l.append(self.buildListEntry(_("Update main skin"), "skin.png",'getskin')), #l.append(self.buildListEntry(_("Update plugin"), "download.png",'getplugin')), #if skinAddOns: # l.append(self.buildListEntry(_("Download addons"), "addon.png",'getaddons')) #(self.buildListEntry(_("Delete addons"), "remove.png",'delete_addons')), #if skinComponents: # l.append(self.buildListEntry(_("Download additional Components/plugins"), "plugin.png",'getcomponents')) #if skinHistory: # l.append(self.buildListEntry(_("History of changes"), "history.png",'history')), #l.append(self.buildListEntry(_("Import foreign skin"), "import.png",'importskin')), l.append(self.buildListEntry(_("About"), "about.png", 'about')), self["list"].list = l
def nList(self): self.workdir = self.mount_point() for i in range(len(self.workdir)): if pathExists(self.workdir[i]): ipklist = os.listdir(self.workdir[i]) for line in ipklist: if line.endswith('tar.gz') or line.endswith( 'bh.tgz') or line.endswith('nab.tgz'): try: self.list.append( (line.strip("\n"), "%s, %s Kb, %s" % (self.workdir[i], (os.path.getsize(self.workdir[i] + line.strip("\n")) / 1024), time.ctime( os.path.getctime(self.workdir[i] + line.strip("\n")))), self.tarminipng, self.status, self.workdir[i] + line.strip("\n"))) except: pass elif line.endswith('.ipk'): try: self.list.append( (line.strip("\n"), "%s, %s Kb, %s" % (self.workdir[i], (os.path.getsize(self.workdir[i] + line.strip("\n")) / 1024), time.ctime( os.path.getctime(self.workdir[i] + line.strip("\n")))), self.ipkminipng, self.status, self.workdir[i] + line.strip("\n"))) except: pass self.list.sort() self["menu"].setList(self.list)
def __init__(self, session, dvd_filelist=[]): Screen.__init__(self, session) # for the skin: first try FileBrowser_DVDPlayer, then FileBrowser, this allows individual skinning self.skinName = ["FileBrowser_DVDPlayer", "FileBrowser"] self.dvd_filelist = dvd_filelist if len(dvd_filelist): self["filelist"] = MenuList(self.dvd_filelist) else: global lastpath if lastpath is not None: currDir = lastpath + "/" else: currDir = "/media/dvd/" if not pathExists(currDir): currDir = "/media/" if lastpath == "": # 'None' is magic to start at the list of mountpoints currDir = None inhibitDirs = [ "/bin", "/boot", "/dev", "/etc", "/home", "/lib", "/proc", "/sbin", "/share", "/sys", "/tmp", "/usr", "/var" ] self.filelist = FileList(currDir, matchingPattern="(?i)^.*\.(iso|img)", useServiceRef=True) self["filelist"] = self.filelist self["FilelistActions"] = ActionMap(["SetupActions"], { "save": self.ok, "ok": self.ok, "cancel": self.exit }) self["key_red"] = StaticText(_("Cancel")) self["key_green"] = StaticText(_("OK")) self.onLayoutFinish.append(self.layoutFinished)
def ContainterFallback(self, data=None, retval=None, extra_args=None): self.container.killAll() slot = self.currentSelected[0][1] print "[MultiBoot Restart] reboot3 slot:", slot if pathExists("/tmp/startupmount/STARTUP"): if slot < 12: copyfile( "/tmp/startupmount/STARTUP_%s" % self.currentSelected[0][1], "/tmp/startupmount/STARTUP") else: slot -= 12 model = getMachineBuild() startupFileContents = "boot emmcflash0.kernel%s 'brcm_cma=%s root=/dev/mmcblk0p%s rw rootwait %s_4.boxmode=12'\n" % ( slot, SystemInfo["canMode12"][1], slot * 2 + SystemInfo["canMultiBoot"][0], model) open('/tmp/startupmount/STARTUP', 'w').write(startupFileContents) self.session.open(TryQuitMainloop, 2) else: self.session.open( MessageBox, _("Multiboot ERROR! - no STARTUP in boot partition."), MessageBox.TYPE_INFO, timeout=20)
def reboot(self): self.currentSelected = self["config"].l.getCurrentSelection() if self.currentSelected[0][1] != "Queued": self.container = Console() if pathExists('/tmp/startupmount'): self.ContainterFallback() else: mkdir('/tmp/startupmount') if SystemInfo["HasRootSubdir"]: if fileExists("/dev/block/by-name/bootoptions"): print "[MultiBoot Restart] bootoptions" self.container.ePopen( 'mount /dev/block/by-name/bootoptions /tmp/startupmount', self.ContainterFallback) elif fileExists("/dev/block/by-name/boot"): print "[MultiBoot Restart] by-name/boot" self.container.ePopen( 'mount /dev/block/by-name/boot /tmp/startupmount', self.ContainterFallback) else: print "[MultiBoot Restart] mtdboot" self.container.ePopen( 'mount /dev/%s /tmp/startupmount' % self.mtdboot, self.ContainterFallback)
def __init__(self, session): self.session = session Screen.__init__(self, session) self.started = 0 # Ustawienia listy self.myList = [] self.onShow.append(self.onStart) self.curIndex = 0 self.myExtensions = resolveFilename(SCOPE_PLUGINS, 'Extensions') self.myPath = self.myExtensions + '/GOSmanager' self.myItemsPath = self.myPath + '/icons/Menu' try: self.myLang = language.getLanguage().split('_')[0] except: self.myLang = "en" print "GOS %s/locale/%s/MainMenu" % (self.myPath, self.myLang) if pathExists( "%s/locale/%s/MainMenu/GOSopkg.png" % (self.myPath, self.myLang) ) is True: #opkg jest najwazniejsze wiec po nim sprawdzamy self.SubTreesPath = "%s/locale/%s/MainMenu" % (self.myPath, self.myLang) else: self.SubTreesPath = "%s/locale/en/MainMenu" % self.myPath
def __init__(self, session, dvd_filelist=[]): Screen.__init__(self, session) self.dvd_filelist = dvd_filelist if len(dvd_filelist): self["filelist"] = MenuList(self.dvd_filelist) else: global lastpath if lastpath is not None: currDir = lastpath + "/" else: currDir = "/media/dvd/" if not pathExists(currDir): currDir = "/" self.filelist = FileList(currDir, matchingPattern="(?i)^.*\.(iso)", useServiceRef=True) self["filelist"] = self.filelist self["FilelistActions"] = ActionMap(["OkCancelActions"], { "ok": self.ok, "cancel": self.exit })
def __init__(self): Renderer.__init__(self) self.PicLoad = ePicLoad() self.PicLoad.PictureData.get().append(self.updatePicon) self.piconsize = (0, 0) self.pngname = "" self.lastPath = None if getDisplayType() in ("bwlcd255", "bwlcd140") or config.lcd.picon_pack.value: pngname = findLcdPicon("lcd_picon_default") else: pngname = findLcdPicon("picon_default") self.defaultpngname = None if not pngname: if getDisplayType() in ("bwlcd255", "bwlcd140") or config.lcd.picon_pack.value: tmp = resolveFilename(SCOPE_CURRENT_SKIN, "lcd_picon_default.png") else: tmp = resolveFilename(SCOPE_CURRENT_SKIN, "picon_default.png") if pathExists(tmp): pngname = tmp if os.path.getsize(pngname): self.defaultpngname = pngname
def findPicon(serviceName): global lastPiconPath if lastPiconPath is not None: pngname = lastPiconPath + serviceName + ".png" if pathExists(pngname): return pngname global searchPaths pngname = "" for path in searchPaths: if pathExists(path) and not path.startswith('/media/net'): pngname = path + serviceName + ".png" if pathExists(pngname): lastPiconPath = path break elif pathExists(path): pngname = path + serviceName + ".png" if pathExists(pngname): lastPiconPath = path break if pathExists(pngname): return pngname return ""
SystemInfo["VFD_scroll_repeats"] = fileCheck("/proc/stb/lcd/scroll_repeats") SystemInfo["VFD_scroll_delay"] = fileCheck("/proc/stb/lcd/scroll_delay") SystemInfo["VFD_initial_scroll_delay"] = fileCheck("/proc/stb/lcd/initial_scroll_delay") SystemInfo["VFD_final_scroll_delay"] = fileCheck("/proc/stb/lcd/final_scroll_delay") SystemInfo["LcdLiveTV"] = fileCheck("/proc/stb/fb/sd_detach") or fileCheck("/proc/stb/lcd/live_enable") SystemInfo["LcdLiveTVMode"] = fileCheck("/proc/stb/lcd/mode") SystemInfo["LcdLiveDecoder"] = fileCheck("/proc/stb/lcd/live_decoder") SystemInfo["FastChannelChange"] = False SystemInfo["3DMode"] = fileCheck("/proc/stb/fb/primary/3d") SystemInfo["3DZNorm"] = fileCheck("/proc/stb/fb/primary/zoffset") SystemInfo["IPV6"] = fileCheck("/proc/sys/net/ipv6/conf/all/disable_ipv6") SystemInfo["Blindscan_t2_available"] = fileCheck("/proc/stb/info/vumodel") SystemInfo["Bootvideo"] = fileCheck("/usr/bin/bootvideo") SystemInfo["hasOSDAnimation"] = fileCheck("/proc/stb/fb/animation_mode") SystemInfo["CIHelper"] = fileExists("/usr/bin/cihelper") SystemInfo["RcTypeChangable"] = pathExists('/proc/stb/ir/rc/type') SystemInfo["HasFullHDSkinSupport"] = getBoxType() not in ('gb800solo', 'gb800se', 'gb800ue') SystemInfo["HasForceLNBOn"] = fileCheck("/proc/stb/frontend/fbc/force_lnbon") SystemInfo["HasForceToneburst"] = fileCheck("/proc/stb/frontend/fbc/force_toneburst") SystemInfo["HasBypassEdidChecking"] = fileCheck("/proc/stb/hdmi/bypass_edid_checking") SystemInfo["HasColorspace"] = fileCheck("/proc/stb/video/hdmi_colorspace") SystemInfo["HasColorspaceSimple"] = SystemInfo["HasColorspace"] and getBoxType() in ('vusolo4k') SystemInfo["HasMultichannelPCM"] = fileCheck("/proc/stb/audio/multichannel_pcm") SystemInfo["HasMMC"] = fileExists("/proc/cmdline") and "root=/dev/mmcblk" in open("/proc/cmdline", "r").read() SystemInfo["HasSwap"] = pathExists("/dev/mmcblk0p10") SystemInfo["HasMultiBoot"] = fileCheck("/boot/STARTUP_1") and getMachineBuild() not in ('gb7252') SystemInfo["HasMultiBootGB"] = SystemInfo["HasSwap"] and fileCheck("/boot/STARTUP_1") and getMachineBuild() in ('gb7252') SystemInfo["HasTranscoding"] = pathExists("/proc/stb/encoder/0") or fileCheck("/dev/bcm_enc0") SystemInfo["HasH265Encoder"] = fileHas("/proc/stb/encoder/0/vcodec_choices", "h265") SystemInfo["CanNotDoSimultaneousTranscodeAndPIP"] = getBoxType() in ('vusolo4k') or getMachineBuild() in ('gb7252') SystemInfo["HasColordepth"] = fileCheck("/proc/stb/video/hdmi_colordepth")
class EasyMedia(Screen): sz_w = getDesktop(0).size().width() if sz_w > 1100: skin = """ <screen flags="wfNoBorder" position="0,0" size="450,720" title="Easy Media"> <ePixmap pixmap="~/bg.png" position="0,0" size="450,576"/> <ePixmap pixmap="~/bg.png" position="0,576" size="450,145"/> <widget name="list" position="60,30" size="350,660" scrollbarMode="showNever" transparent="1" zPosition="2"/> </screen>""" elif sz_w > 1000: skin = """ <screen flags="wfNoBorder" position="-20,0" size="450,576" title="Easy Media"> <ePixmap pixmap="~/bg.png" position="0,0" size="450,576"/> <widget name="list" position="70,48" size="320,480" scrollbarMode="showNever" transparent="1" zPosition="2"/> </screen>""" else: skin = """ <screen position="center,center" size="320,440" title="Easy Media"> <widget name="list" position="10,10" size="300,420" scrollbarMode="showOnDemand" /> </screen>""" if pathExists(resolveFilename(SCOPE_PLUGINS, 'Extensions/EasyMedia/icons/')): EMiconspath = resolveFilename(SCOPE_PLUGINS, 'Extensions/EasyMedia/icons/') else: EMiconspath = resolveFilename(SCOPE_PLUGINS, 'Extensions/EasyMedia/') def __init__(self, session): Screen.__init__(self, session) self.skin_path = resolveFilename(SCOPE_PLUGINS, "Extensions/EasyMedia") self.session = session self.list = [] self.__keys = [] MPaskList = [] self["key_pvr"] = StaticText(" ") self["key_yellow"] = StaticText(" ") self["key_green"] = StaticText(" ") self["key_red"] = StaticText(" ") self["key_blue"] = StaticText(" ") if True: self.__keys.append("movies") MPaskList.append((_("Movies"), "PLAYMOVIES")) if config.plugins.easyMedia.bookmarks.value != "no": self.__keys.append("bookmarks") MPaskList.append((_("Bookmarks"), "BOOKMARKS")) if config.plugins.easyMedia.timers.value != "no": self.__keys.append("timers") MPaskList.append((_("Timer"), "TIMERS")) if config.plugins.easyMedia.videodb.value != "no": self.__keys.append("videodb") MPaskList.append((_("VideoDB"), "VIDEODB")) if config.plugins.easyMedia.pictures.value != "no": self.__keys.append("pictures") MPaskList.append((_("Pictures"), "PICTURES")) if config.plugins.easyMedia.music.value != "no": self.__keys.append("music") MPaskList.append((_("Music"), "MUSIC")) if config.plugins.easyMedia.radio.value != "no": self.__keys.append("radio") if config.usage.e1like_radio_mode.value: MPaskList.append((_("Tv/Radio"), "RADIO")) else: MPaskList.append((_("Radio"), "RADIO")) if config.plugins.easyMedia.dvd.value != "no": self.__keys.append("dvd") MPaskList.append((_("DVD Player"), "DVD")) if config.plugins.easyMedia.weather.value != "no": self.__keys.append("weather") MPaskList.append((_("Weather"), "WEATHER")) if config.plugins.easyMedia.files.value != "no": self.__keys.append("files") MPaskList.append((_("Files"), "FILES")) if config.plugins.easyMedia.iradio.value != "no": self.__keys.append("internetradio") MPaskList.append((_("InternetRadio"), "INTERNETRADIO")) if config.plugins.easyMedia.idream.value != "no": self.__keys.append("idream") MPaskList.append((_("iDream"), "IDREAM")) if config.plugins.easyMedia.mytube.value != "no": self.__keys.append("mytube") MPaskList.append((_("MyTube Player"), "MYTUBE")) if config.plugins.easyMedia.vlc.value != "no": self.__keys.append("vlc") MPaskList.append((_("VLC Player"), "VLC")) if config.plugins.easyMedia.zdfmedia.value != "no": self.__keys.append("zdf") MPaskList.append((_("ZDFmediathek"), "ZDF")) if config.plugins.easyMedia.myvideo.value != "no": self.__keys.append("myvideo") MPaskList.append((_("MyVideo"), "MYVIDEO")) plist = os_listdir( resolveFilename(SCOPE_PLUGINS, "Extensions/EasyMedia")) plist = [x[:-5] for x in plist if x.endswith('.plug')] plist.sort() for onePlug in plist: try: inpf = open((resolveFilename( SCOPE_PLUGINS, "Extensions/EasyMedia/" + onePlug + ".plug")), 'rb') binPlug = pickle.load(inpf) inpf.close() self.__keys.append(binPlug.name) MPaskList.append((binPlug.name, ("++++" + binPlug.name))) except: pass pos = 0 for x in MPaskList: strpos = str(self.__keys[pos]) self.list.append(MPanelEntryComponent(key=strpos, text=x, cell=pos)) if pos == 0: self["key_pvr"].setText(MPaskList[0][0]) elif pos == 1: self["key_red"].setText(MPaskList[1][0]) elif pos == 2: self["key_green"].setText(MPaskList[2][0]) elif pos == 3: self["key_yellow"].setText(MPaskList[3][0]) elif pos == 4: self["key_blue"].setText(MPaskList[4][0]) pos += 1 self["list"] = MPanelList(list=self.list, selection=0) self["list"].onSelectionChanged.append(self.updateOLED) self["actions"] = ActionMap( ["WizardActions", "MenuActions", "InfobarActions", "ColorActions"], { "ok": self.go, "back": self.cancel, "menu": self.emContextMenu, "showMovies": lambda: self.go2(MPaskList, 0), "green": lambda: self.go2(MPaskList, 2), "red": lambda: self.go2(MPaskList, 1), "blue": lambda: self.go2(MPaskList, 4), "yellow": lambda: self.go2(MPaskList, 3) }, -1) def cancel(self): self.close(None) def go(self): cursel = self["list"].l.getCurrentSelection() if cursel: self.goEntry(cursel[0]) else: self.cancel() def go2(self, was, wohin): if wohin == 0: self.close(was[wohin]) elif wohin == 1: if len(was) > 1: self.close(was[wohin]) elif wohin == 2: if len(was) > 2: self.close(was[wohin]) elif wohin == 3: if len(was) > 3: self.close(was[wohin]) elif wohin == 4: if len(was) > 4: self.close(was[wohin]) def goEntry(self, entry): if len(entry) > 2 and isinstance(entry[1], str) and entry[1] == "CALLFUNC": arg = self["list"].l.getCurrentSelection()[0] entry[2](arg) else: self.close(entry) def emContextMenu(self): self.session.open(ConfigEasyMedia) def createSummary(self): return EasyMediaSummary def updateOLED(self): text = str(self["list"].l.getCurrentSelection()[0][0]) self.summaries.setText(text, 1)
import os, re, unicodedata from enigma import ePixmap from Components.Harddisk import harddiskmanager from Renderer import Renderer from ServiceReference import ServiceReference from Tools.Alternatives import GetWithAlternative from Tools.Directories import pathExists, SCOPE_SKIN_IMAGE, \ SCOPE_CURRENT_SKIN, resolveFilename searchPaths = [] if pathExists('/tmp/picon/'): piconInTmp = True lastPiconPath = '/tmp/picon/' print "[Picon] use path:", lastPiconPath else: piconInTmp = False lastPiconPath = None def initPiconPaths(): global searchPaths searchPaths = [] for mp in ('/tmp/', '/media/hdd/', '/usr/share/enigma2/', '/'): onMountpointAdded(mp) for part in harddiskmanager.getMountedPartitions(): onMountpointAdded(part.mountpoint) def onMountpointAdded(mountpoint): global searchPaths
def getSelectedList(self): selectedFilesExist = [] for x in self.selectedFiles: if pathExists(x): selectedFilesExist.append(x) return selectedFilesExist
SystemInfo["VFD_initial_scroll_delay"] = fileCheck( "/proc/stb/lcd/initial_scroll_delay") SystemInfo["VFD_final_scroll_delay"] = fileCheck( "/proc/stb/lcd/final_scroll_delay") SystemInfo["LcdLiveTV"] = fileCheck("/proc/stb/fb/sd_detach") or fileCheck( "/proc/stb/lcd/live_enable") SystemInfo["LcdLiveTVMode"] = fileCheck("/proc/stb/lcd/mode") SystemInfo["LcdLiveDecoder"] = fileCheck("/proc/stb/lcd/live_decoder") SystemInfo["FastChannelChange"] = False SystemInfo["3DMode"] = fileCheck("/proc/stb/fb/primary/3d") SystemInfo["3DZNorm"] = fileCheck("/proc/stb/fb/primary/zoffset") SystemInfo["IPV6"] = fileCheck("/proc/sys/net/ipv6/conf/all/disable_ipv6") SystemInfo["Blindscan_t2_available"] = fileCheck("/proc/stb/info/vumodel") SystemInfo["Bootvideo"] = fileCheck("/usr/bin/bootvideo") SystemInfo["hasOSDAnimation"] = fileCheck("/proc/stb/fb/animation_mode") SystemInfo["RcTypeChangable"] = pathExists('/proc/stb/ir/rc/type') SystemInfo["HasFullHDSkinSupport"] = getBoxType() not in ('gb800solo', 'gb800se', 'gb800ue') SystemInfo["HasBypassEdidChecking"] = fileCheck( "/proc/stb/hdmi/bypass_edid_checking") SystemInfo["HasColorspace"] = fileCheck("/proc/stb/video/hdmi_colorspace") SystemInfo["HasColorspaceSimple"] = SystemInfo["HasColorspace"] and getBoxType( ) in ('vusolo4k', ) SystemInfo["HasMultichannelPCM"] = fileCheck( "/proc/stb/audio/multichannel_pcm") SystemInfo["HasTranscoding"] = pathExists("/proc/stb/encoder/0") or fileCheck( "/dev/bcm_enc0") SystemInfo["HasH265Encoder"] = fileHas("/proc/stb/encoder/0/vcodec_choices", "h265") SystemInfo["CanNotDoSimultaneousTranscodeAndPIP"] = getBoxType() in ( 'vusolo4k') or getMachineBuild() in ('gb7252', )
def __init__(self, session, packagefile, silent=False): if not pathExists("/tmp/package"): mkdir("/tmp/package") os_system("tar xpzf %s -C /tmp/package" % packagefile) self.packagefile = packagefile DefaultWizard.__init__(self, session, silent)