def setInfo(self): selection = self["filelist"].getSelection() if selection is None: return elif selection[1] == True: # isDir self["key_green"].setText("") self["key_yellow"].setText(_("Delete Category")) self["Cover"].hide() else: self["key_yellow"].setText(_("Disable Host")) self["key_green"].setText(_("Assign to category")) HostPreview = '%s/icons/previews/%s.jpg' % (PluginPath,self.filelist.getFilename()[:-4]) print HostPreview if os_path.exists(HostPreview): self["Cover"].instance.setScale(1) self["Cover"].instance.setPixmap(LoadPixmap(HostPreview)) self["Cover"].show() else: self["Cover"].hide() return
def translate(self,txt): def substring_2_translate(text): to_translate = text.split('_(', 2) text = to_translate[1] to_translate = text.split(')', 2) text = to_translate[0] return text if txt.find('_(') == -1: txt = _(txt) else: index = 0 while txt.find('_(') != -1: tmptxt = substring_2_translate(txt) translated_tmptxt = _(tmptxt) txt = txt.replace('_(' + tmptxt + ')', translated_tmptxt) index += 1 if index == 10: break return txt
def newCategory(self): selection = self["filelist"].getSelection() def catCB(callback = None): if callback is not None: printDEBUG('mkdir -p %s/%s' %(self.filelist.getCurrentDirectory(),callback) ) os_system('mkdir -p %s/%s' %(self.filelist.getCurrentDirectory(),callback) ) self["filelist"].refresh() return from Screens.VirtualKeyBoard import VirtualKeyBoard self.session.openWithCallback(catCB, VirtualKeyBoard, title=_("Enter Category name"), text = _('new Category') ) self["filelist"].refresh()
def __init__(self, session, list): self.Hostslist = list self.openHost = '' self.LastFolderSelected= None self.rootPath = PluginPath+"/hosts/" self.skin = LoadSkin("j00zekHostTreeSelector") Screen.__init__(self, session) self["info"] = Label() self["myPath"] = Label('') self["key_red"] = StaticText(_("Exit")) self["Cover"] = Pixmap() self["key_green"] = StaticText("") self["key_yellow"] = StaticText(_("Delete Category")) self["key_blue"] = StaticText(_("New Category")) self["info"].setText(PluginName + ' mod j00zek v.' + IPTV_VERSION) #title self.filelist = FileList(self.rootPath, HostsList = self.Hostslist) self["filelist"] = self.filelist self["actions"] = ActionMap(["j00zekHostTreeSelector"], { "selectHost": self.selectHost, "ExitHostSelector": self.ExitHostSelector, "lineUp": self.lineUp, "lineDown": self.lineDown, "pageUp": self.pageUp, "pageDown": self.pageDown, "newCategory": self.newCategory, "addHostToCategory": self.addHostToCategory, "deleteCategory": self.deleteCategory, "showConfig": self.showConfig, "showLocalMedia": self.showLocalMedia, "showDownloadManager": self.showDownloadManager, },-2) self.setTitle(PluginName + ' mod j00zek v.' + IPTV_VERSION) self.onShown.append(self.__LayoutFinish)
def addHostToCategory(self): selection = self["filelist"].getSelection() if selection[1] == False: # host selected myHostName=selection[0] hostPath=self.filelist.getCurrentDirectory() def CB(ret): if ret: ManageHostsAndCategories(myHostName, ret[1]) from Screens.ChoiceBox import ChoiceBox from Plugins.Extensions.IPTVPlayer.j00zekScripts.j00zekToolSet import ManageHostsAndCategories, GetHostsCategories self.session.openWithCallback(CB, ChoiceBox, title=_("Assign to/Remove from Category"), list = GetHostsCategories() ) self["filelist"].refresh()
def changeDir(self, directory, select = None): self.list = [] # if we are just entering from the list of mount points: if self.current_directory is None: self.current_mountpoint = None self.current_directory = directory directories = [] files = [] if directory is None: files = [ ] directories = [ ] else: if fileExists(directory): try: files = listdir(directory) except: files = [] files.sort(key=lambda s: s.lower()) #files.sort() tmpfiles = files[:] for x in tmpfiles: if os_path.isdir(directory + x): directories.append(directory + x + "/") files.remove(x) if directory is not None and self.showDirectories: if (directory != self.rootDirectory) and not (self.inhibitMounts and self.getMountpoint(directory) in self.inhibitMounts): self.list.append(FileEntryComponent(name = _("Parent Category"), absolute = '/'.join(directory.split('/')[:-2]) + '/', isDir = True, goBack = True, DimFolderText = self.DimFolderText, DimFolderPIC = self.DimFolderPIC, DimFileText = self.DimFileText, DimFilePIC = self.DimFilePIC)) if self.showDirectories: for x in directories: if not (self.inhibitMounts and self.getMountpoint(x) in self.inhibitMounts) and not self.inParentDirs(x, self.inhibitDirs): name = x.split('/')[-2] self.list.append(FileEntryComponent(name = name, absolute = x, isDir = True, DimFolderText = self.DimFolderText, DimFolderPIC = self.DimFolderPIC, DimFileText = self.DimFileText, DimFilePIC = self.DimFilePIC)) if self.showFiles: for x in files: path = directory + x name = x if name.startswith('host') and (name.endswith('.pyo') or name.endswith('.py') or name.endswith('.pyc')): name = name[4:-4] for host in self.Hostslist: if name == host[1]: name = host[0] self.list.append(FileEntryComponent(name = name, absolute = x , isDir = False, DimFolderText = self.DimFolderText, DimFolderPIC = self.DimFolderPIC, DimFileText = self.DimFileText, DimFilePIC = self.DimFilePIC)) break self.l.setList(self.list) if select is not None: i = 0 self.moveToIndex(0) for x in self.list: p = x[0][0] if p == select: self.moveToIndex(i) i += 1
def AlternateOptionsList(list): #we build our own order :) list.append( getConfigListEntry(_("Auto check for plugin update"), config.plugins.iptvplayer.autoCheckForUpdate) ) list.append( getConfigListEntry(_("Update"), config.plugins.iptvplayer.fakeUpdate) ) # list.append( getConfigListEntry(_("--- General options ---"), config.plugins.iptvplayer.j00zekSeparator)) list.append( getConfigListEntry(_("Detected platform"), config.plugins.iptvplayer.plarform) ) list.append( getConfigListEntry(_("Services configuration"), config.plugins.iptvplayer.fakeHostsList) ) list.append( getConfigListEntry(_("Show IPTVPlayer in extension list"), config.plugins.iptvplayer.showinextensions)) list.append( getConfigListEntry(_("Show IPTVPlayer in main menu"), config.plugins.iptvplayer.showinMainMenu)) list.append( getConfigListEntry(_("Show update icon in service selection menu"), config.plugins.iptvplayer.AktualizacjaWmenu)) list.append( getConfigListEntry(_("Enable hosts tree selector"), config.plugins.iptvplayer.j00zekTreeHostsSelector)) if config.plugins.iptvplayer.j00zekTreeHostsSelector.value == True: list.append( getConfigListEntry(_("Use only hosts tree selector"), config.plugins.iptvplayer.j00zekTreeHostsSelectorOnly)) else: list.append( getConfigListEntry(_("Graphic services selector"), config.plugins.iptvplayer.ListaGraficzna)) if config.plugins.iptvplayer.ListaGraficzna.value == True: list.append( getConfigListEntry(_(" Service icon size"), config.plugins.iptvplayer.IconsSize)) list.append( getConfigListEntry(_(" Number of rows"), config.plugins.iptvplayer.numOfRow)) list.append( getConfigListEntry(_(" Number of columns"), config.plugins.iptvplayer.numOfCol)) # list.append( getConfigListEntry("", config.plugins.iptvplayer.j00zekSeparator)) list.append( getConfigListEntry(_("--- Paths to utilities ---"), config.plugins.iptvplayer.j00zekSeparator)) list.append( getConfigListEntry(_("wgetpath"), config.plugins.iptvplayer.wgetpath)) list.append( getConfigListEntry(_("rtmpdumppath"), config.plugins.iptvplayer.rtmpdumppath)) list.append( getConfigListEntry(_("f4mdumppath"), config.plugins.iptvplayer.f4mdumppath)) list.append( getConfigListEntry(_("uchardetpath"), config.plugins.iptvplayer.uchardetpath)) list.append( getConfigListEntry(_("exteplayer3path"), config.plugins.iptvplayer.exteplayer3path)) list.append( getConfigListEntry(_("gstplayerpath"), config.plugins.iptvplayer.gstplayerpath)) # list.append( getConfigListEntry("", config.plugins.iptvplayer.j00zekSeparator)) list.append( getConfigListEntry(_("--- Download options ---"), config.plugins.iptvplayer.j00zekSeparator)) list.append( getConfigListEntry(_("Start download manager per default"), config.plugins.iptvplayer.IPTVDMRunAtStart)) list.append( getConfigListEntry(_("Show download manager after adding new item"), config.plugins.iptvplayer.IPTVDMShowAfterAdd)) list.append( getConfigListEntry(_("Number of downloaded files simultaneously"), config.plugins.iptvplayer.IPTVDMMaxDownloadItem)) list.append( getConfigListEntry(_("Start IPTVPlayer in recorder mode"), config.plugins.iptvplayer.recorderMode)) # list.append( getConfigListEntry("", config.plugins.iptvplayer.j00zekSeparator)) list.append( getConfigListEntry(_("--- Debug ---"), config.plugins.iptvplayer.j00zekSeparator)) list.append( getConfigListEntry(_("Debug logs"), config.plugins.iptvplayer.debugprint)) list.append( getConfigListEntry(_("Disable host protection (error == GS)"), config.plugins.iptvplayer.devHelper)) # list.append( getConfigListEntry("", config.plugins.iptvplayer.j00zekSeparator)) list.append( getConfigListEntry(_("--- Other IPTVPlayer Config options ---"), config.plugins.iptvplayer.j00zekSeparator))
def changeDir(self, directory, select = None): self.list = [] # if we are just entering from the list of mount points: if self.current_directory is None: self.current_mountpoint = None self.current_directory = directory directories = [] files = [] if directory is None: files = [ ] directories = [ ] else: if fileExists(directory): try: files = listdir(directory) except: files = [] files.sort(key=lambda s: s.lower()) #files.sort() tmpfiles = files[:] for x in tmpfiles: if os_path.isdir(directory + x): directories.append(directory + x + "/") files.remove(x) if directory is not None and self.showDirectories: if (directory != self.rootDirectory) and not (self.inhibitMounts and self.getMountpoint(directory) in self.inhibitMounts): self.list.append(FileEntryComponent(name = _("Parent Category"), absolute = '/'.join(directory.split('/')[:-2]) + '/', isDir = True, goBack = True, DimFolderText = self.DimFolderText, DimFolderPIC = self.DimFolderPIC, DimFileText = self.DimFileText, DimFilePIC = self.DimFilePIC)) if self.showDirectories: for x in directories: if not (self.inhibitMounts and self.getMountpoint(x) in self.inhibitMounts) and not self.inParentDirs(x, self.inhibitDirs): name = x.split('/')[-2] self.list.append(FileEntryComponent(name = name, absolute = x, isDir = True, DimFolderText = self.DimFolderText, DimFolderPIC = self.DimFolderPIC, DimFileText = self.DimFileText, DimFilePIC = self.DimFilePIC)) if self.showFiles: for x in files: path = directory + x name = x if name.startswith('host') and (name.endswith('.pyo') or name.endswith('.pyc')): name = name[4:-4] for host in self.Hostslist: if name == host[1]: name = host[0] self.list.append(FileEntryComponent(name = name, absolute = x , isDir = False, DimFolderText = self.DimFolderText, DimFolderPIC = self.DimFolderPIC, DimFileText = self.DimFileText, DimFilePIC = self.DimFilePIC)) break self.l.setList(self.list) if select is not None: i = 0 self.moveToIndex(0) for x in self.list: p = x[0][0] if p == select: self.moveToIndex(i) i += 1
def AlternateOptionsList(list): #we build our own order :) #list.append( getConfigListEntry(_("Auto check for plugin update"), config.plugins.iptvplayer.autoCheckForUpdate) ) #list.append( getConfigListEntry(_("Update"), config.plugins.iptvplayer.fakeUpdate) ) # list.append( getConfigListEntry(_("--- General options ---"), config.plugins.iptvplayer.j00zekSeparator)) list.append( getConfigListEntry(_("Detected platform"), config.plugins.iptvplayer.plarform) ) list.append( getConfigListEntry(_("Services configuration"), config.plugins.iptvplayer.fakeHostsList) ) list.append( getConfigListEntry(_("Show IPTVPlayer in extension list"), config.plugins.iptvplayer.showinextensions)) list.append( getConfigListEntry(_("Show IPTVPlayer in main menu"), config.plugins.iptvplayer.showinMainMenu)) #list.append( getConfigListEntry(_("Show update icon in service selection menu"), config.plugins.iptvplayer.AktualizacjaWmenu)) list.append( getConfigListEntry(_("Enable hosts tree selector"), config.plugins.iptvplayer.j00zekTreeHostsSelector)) if config.plugins.iptvplayer.j00zekTreeHostsSelector.value == True: list.append( getConfigListEntry(_("Use only hosts tree selector"), config.plugins.iptvplayer.j00zekTreeHostsSelectorOnly)) else: list.append( getConfigListEntry(_("Graphic services selector"), config.plugins.iptvplayer.ListaGraficzna)) if config.plugins.iptvplayer.ListaGraficzna.value == True: list.append( getConfigListEntry(_(" Service icon size"), config.plugins.iptvplayer.IconsSize)) list.append( getConfigListEntry(_(" Number of rows"), config.plugins.iptvplayer.numOfRow)) list.append( getConfigListEntry(_(" Number of columns"), config.plugins.iptvplayer.numOfCol)) # list.append( getConfigListEntry("", config.plugins.iptvplayer.j00zekSeparator)) list.append( getConfigListEntry(_("--- Paths to utilities ---"), config.plugins.iptvplayer.j00zekSeparator)) list.append( getConfigListEntry(_("wgetpath"), config.plugins.iptvplayer.wgetpath)) list.append( getConfigListEntry(_("rtmpdumppath"), config.plugins.iptvplayer.rtmpdumppath)) list.append( getConfigListEntry(_("f4mdumppath"), config.plugins.iptvplayer.f4mdumppath)) list.append( getConfigListEntry(_("uchardetpath"), config.plugins.iptvplayer.uchardetpath)) list.append( getConfigListEntry(_("exteplayer3path"), config.plugins.iptvplayer.exteplayer3path)) list.append( getConfigListEntry(_("gstplayerpath"), config.plugins.iptvplayer.gstplayerpath)) # list.append( getConfigListEntry("", config.plugins.iptvplayer.j00zekSeparator)) list.append( getConfigListEntry(_("--- Download options ---"), config.plugins.iptvplayer.j00zekSeparator)) list.append( getConfigListEntry(_("Start download manager per default"), config.plugins.iptvplayer.IPTVDMRunAtStart)) list.append( getConfigListEntry(_("Show download manager after adding new item"), config.plugins.iptvplayer.IPTVDMShowAfterAdd)) list.append( getConfigListEntry(_("Number of downloaded files simultaneously"), config.plugins.iptvplayer.IPTVDMMaxDownloadItem)) list.append( getConfigListEntry(_("Start IPTVPlayer in recorder mode"), config.plugins.iptvplayer.recorderMode)) # list.append( getConfigListEntry("", config.plugins.iptvplayer.j00zekSeparator)) list.append( getConfigListEntry(_("--- Debug ---"), config.plugins.iptvplayer.j00zekSeparator)) list.append( getConfigListEntry(_("Debug logs"), config.plugins.iptvplayer.debugprint)) list.append( getConfigListEntry(_("Disable host protection (error == GS)"), config.plugins.iptvplayer.devHelper)) # list.append( getConfigListEntry("", config.plugins.iptvplayer.j00zekSeparator)) list.append( getConfigListEntry(_("--- Other IPTVPlayer Config options ---"), config.plugins.iptvplayer.j00zekSeparator))