From c8f947345e751dc48a24735a462b23876b35550a Mon Sep 17 00:00:00 2001 From: Belfagor2005 <72314956+Belfagor2005@users.noreply.github.com> Date: Sat, 27 Dec 2025 00:49:15 +0100 Subject: [PATCH 1/2] fix summary Il codice usava la funzione cmp() di Python 2 che non esiste in Python 3 Fix: Sostituito con functools.cmp_to_key() oppure con funzioni key per sort() '<' not supported between instances of 'str' and 'float' Problema: La funzione byDateFunc() restituiva a volte float (timestamp) e a volte string (fallback su nome) Fix: Usato una tupla (priority, value) per garantire ordinamento coerente: (0, timestamp) per elementi con data valida (1, nome) per elementi senza data --- dreamexplorer/src/__init__.py | 4 +- dreamexplorer/src/dreamexplorer.png | Bin 3841 -> 15297 bytes dreamexplorer/src/myFileList.py | 118 +- dreamexplorer/src/plugin.py | 2440 ++++++++++++++------------- 4 files changed, 1293 insertions(+), 1269 deletions(-) diff --git a/dreamexplorer/src/__init__.py b/dreamexplorer/src/__init__.py index c0e412662..20e36b96c 100644 --- a/dreamexplorer/src/__init__.py +++ b/dreamexplorer/src/__init__.py @@ -1,6 +1,4 @@ -from Components.Language import language -from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_LANGUAGE -import os +from Tools.Directories import resolveFilename, SCOPE_PLUGINS import gettext diff --git a/dreamexplorer/src/dreamexplorer.png b/dreamexplorer/src/dreamexplorer.png index 51313457b2a1ca03c3aaed72d96c1f1ecdcaa824..81d596cb722de59e68b08f10174f598da3d13251 100644 GIT binary patch literal 15297 zcmY*=Wmp`+(k=vodvFNu?z*^paCcb2)!<^3Wth|l(ns$yf4UF(^pl?(%0Tn(28D6 z6deWNEd*`B(c0ad!rRfo$xX;xgz7&H3qh~{-Dal}1%RwJ1n==T=&M7D;$j-sV&c($FeS+1^$I0E?o7KsU`o9fGTf13;>|EUKoSi8C zHE3?(?BOm#<>6sxC1hi6!)sw>#mj18&TYlY$!TTIYHr2N$!f*TZN<;aDZpjJX+ibh z?%nNd{%`+IZvRySR3YsDeqrZi1%sPvL5nSzZ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)o5MKz*L?LKeOaEdB6(8(u zvi=95>C0pO2DS891sZWUJqEsC0wiSl90Y}H-?@AmB{Bzr$R%I+W%_cs-}m$z6}6~U z#aspUR~|P&&iZ~$xiy}%ur=Ly)`JAwJL^yXFG!)!hvS1{4Qwf4{|Ngzca}zmeopuK zU<(OJYOL;n{M$b_+PwL%zZhB3cJ}N>wEg|{x7hy$Fct#GzTx8K00000NkvXXu0mjf Dn8YUo diff --git a/dreamexplorer/src/myFileList.py b/dreamexplorer/src/myFileList.py index da3506735..883802f62 100644 --- a/dreamexplorer/src/myFileList.py +++ b/dreamexplorer/src/myFileList.py @@ -21,50 +21,63 @@ # for localized messages from . import _ -from re import compile as re_compile -from os import path as os_path, listdir, stat as os_stat + +from os import listdir +from os import path as os_path +from os import stat as os_stat from Components.MenuList import MenuList from Components.Harddisk import harddiskmanager from Components.config import config -from enigma import RT_HALIGN_LEFT, eListboxPythonMultiContent, eServiceReference, eServiceCenter, gFont, iServiceInformation, RT_VALIGN_CENTER, BT_SCALE, BT_KEEP_ASPECT_RATIO +from Components.MultiContent import MultiContentEntryPixmapAlphaTest +from enigma import ( + BT_KEEP_ASPECT_RATIO, + BT_SCALE, + RT_HALIGN_LEFT, + RT_VALIGN_CENTER, + eListboxPythonMultiContent, + eServiceCenter, + eServiceReference, + gFont, + iServiceInformation, +) from Tools.LoadPixmap import LoadPixmap import skin -from Components.MultiContent import MultiContentEntryPixmapAlphaTest + EXTENSIONS = { - "mp2": "music", - "mp3": "music", - "wav": "music", - "ogg": "music", - "flac": "music", - "m4a": "music", - "jpg": "picture", - "jpeg": "picture", - "jpe": "picture", - "png": "picture", - "bmp": "picture", - "mvi": "picture", - "ts": "movie", - "m2ts": "movie", - "avi": "movie", - "divx": "movie", - "wmv": "movie", - "mpg": "movie", - "mpeg": "movie", - "mkv": "movie", - "mp4": "movie", - "mov": "movie", - "vob": "movie", - "ifo": "movie", - "iso": "movie", - "flv": "movie", - "3gp": "movie", - "mod": "movie", - "ipk": "package", - "gz": "package", - "bz2": "package", - "sh": "script" - } + "mp2": "music", + "mp3": "music", + "wav": "music", + "ogg": "music", + "flac": "music", + "m4a": "music", + "jpg": "picture", + "jpeg": "picture", + "jpe": "picture", + "png": "picture", + "bmp": "picture", + "mvi": "picture", + "ts": "movie", + "m2ts": "movie", + "avi": "movie", + "divx": "movie", + "wmv": "movie", + "mpg": "movie", + "mpeg": "movie", + "mkv": "movie", + "mp4": "movie", + "mov": "movie", + "vob": "movie", + "ifo": "movie", + "iso": "movie", + "flv": "movie", + "3gp": "movie", + "mod": "movie", + "ipk": "package", + "gz": "package", + "bz2": "package", + "sh": "script" +} def FileEntryComponent(name, absolute=None, isDir=False): @@ -74,8 +87,7 @@ def FileEntryComponent(name, absolute=None, isDir=False): if isDir: png = LoadPixmap("/usr/lib/enigma2/python/Plugins/Extensions/DreamExplorer/res/dir.png") else: - extension = name.split('.') - extension = extension[-1].lower() + extension = name.split('.')[-1].lower() if extension in EXTENSIONS: if name == "VIDEO_TS.IFO": png = LoadPixmap("/usr/lib/enigma2/python/Plugins/Extensions/DreamExplorer/res/dvd.png") @@ -142,11 +154,11 @@ def getSelection(self): return self.l.getCurrentSelection()[0] def getCurrentEvent(self): - l = self.l.getCurrentSelection() - if not l or l[0][1] == True: + current_item = self.l.getCurrentSelection() + if not current_item or current_item[0][1] is True: return None else: - return self.serviceHandler.info(l[0][0]).getEvent(l[0][0]) + return self.serviceHandler.info(current_item[0][0]).getEvent(current_item[0][0]) def getFileList(self): return self.list @@ -337,23 +349,31 @@ def getTSLength(self, path): return tslen def byNameFunc(self, a): - return a[0][0] + try: + return str(a[0][0] or "").lower() + except: + return "" def sortName(self): self.list.sort(key=self.byNameFunc) - #self.l.invalidate() self.l.setList(self.list) self.moveToIndex(0) def byDateFunc(self, a): try: - stat1 = os_stat(self.current_directory + a[0][0]) + if a[0][0] and self.current_directory: + path = str(a[0][0]) + if not path.startswith('/'): + path = self.current_directory + path + if os_path.exists(path): + return (0, float(os_stat(path).st_ctime)) except: - return 0 - return stat1.st_ctime + pass + + # Fallback: use name + return (1, self.byNameFunc(a)) def sortDate(self): - self.list.sort(key=self.byDateFunc) - #self.l.invalidate() + self.list.sort(key=self.byDateFunc, reverse=True) self.l.setList(self.list) self.moveToIndex(0) diff --git a/dreamexplorer/src/plugin.py b/dreamexplorer/src/plugin.py index bc43ebe16..a0d21b045 100644 --- a/dreamexplorer/src/plugin.py +++ b/dreamexplorer/src/plugin.py @@ -17,64 +17,78 @@ ####################################################################### # for localized messages -from . import _ from Plugins.Plugin import PluginDescriptor from Screens.Screen import Screen -from Screens.InfoBar import MoviePlayer as MP_parent from Screens.InfoBar import InfoBar +from Screens.InfoBar import MoviePlayer as MP_parent from Screens.Console import Console from Screens.ChoiceBox import ChoiceBox from Screens.MessageBox import MessageBox from Screens.EventView import EventViewSimple +from Screens.InputBox import InputBox from Components.ActionMap import ActionMap +from Components.AVSwitch import AVSwitch from Components.FileList import FileList -from Components.MenuList import MenuList from Components.Label import Label -from Components.ScrollLabel import ScrollLabel +from Components.MenuList import MenuList from Components.Pixmap import Pixmap -from Components.AVSwitch import AVSwitch +# from Components.ScrollLabel import ScrollLabel from Components.config import config, ConfigSubsection, ConfigText +from Components.Sources.StaticText import StaticText from Tools.Directories import fileExists, pathExists from Tools.HardwareInfo import HardwareInfo from ServiceReference import ServiceReference + +from . import _ from .myFileList import FileList as myFileList -#from vInputBox import vInputBox -from Screens.InputBox import InputBox -from Components.Sources.StaticText import StaticText +# from vInputBox import vInputBox + +from enigma import ( + # eConsoleAppContainer, + eServiceReference, + ePicLoad, + getDesktop, + eServiceCenter +) + +# --- OS operations --- +from os import ( + system as os_system, + stat as os_stat, + walk as os_walk, + popen as os_popen, + rename as os_rename, + mkdir as os_mkdir, + path as os_path, + listdir as os_listdir +) + +# --- Time operations --- +from time import ( + strftime as time_strftime, + localtime as time_localtime +) PicPlayerAviable = False -if fileExists("/usr/lib/enigma2/python/Plugins/Extensions/PicturePlayer/plugin.pyc"): - try: - from Plugins.Extensions.PicturePlayer.plugin import Pic_Thumb, picshow - PicPlayerAviable = True - except: - pass - DVDPlayerAviable = False -if fileExists("/usr/lib/enigma2/python/Plugins/Extensions/DVDPlayer/plugin.pyc"): - try: - from Plugins.Extensions.DVDPlayer.plugin import DVDPlayer - DVDPlayerAviable = True - except: - pass -else: - try: - from Screens.DVD import DVDPlayer - DVDPlayerAviable = True - except: - pass - MMPavaiable = False -if fileExists("/usr/lib/enigma2/python/Plugins/Extensions/MerlinMusicPlayer/plugin.pyc"): - try: - from Plugins.Extensions.MerlinMusicPlayer.plugin import MerlinMusicPlayerScreen, Item - MMPavaiable = True - except: - pass -from enigma import eConsoleAppContainer, eServiceReference, ePicLoad, getDesktop, eServiceCenter -import os -from time import strftime, localtime + +if fileExists("/usr/lib/enigma2/python/Plugins/Extensions/PicturePlayer/plugin.pyo") or fileExists("/usr/lib/enigma2/python/Plugins/Extensions/PicturePlayer/plugin.pyc"): + from Plugins.Extensions.PicturePlayer.plugin import Pic_Thumb # , picshow + PicPlayerAviable = True +else: + PicPlayerAviable = False +if fileExists("/usr/lib/enigma2/python/Plugins/Extensions/DVDPlayer/plugin.pyo") or fileExists("/usr/lib/enigma2/python/Plugins/Extensions/DVDPlayer/plugin.pyc"): + from Plugins.Extensions.DVDPlayer.plugin import DVDPlayer + DVDPlayerAviable = True +else: + DVDPlayerAviable = False +if fileExists("/usr/lib/enigma2/python/Plugins/Extensions/MerlinMusicPlayer/plugin.pyo") or fileExists("/usr/lib/enigma2/python/Plugins/Extensions/MerlinMusicPlayer/plugin.pyc"): + from Plugins.Extensions.MerlinMusicPlayer.plugin import MerlinMusicPlayerScreen, Item + MMPavaiable = True +else: + MMPavaiable = False config.plugins.DreamExplorer = ConfigSubsection() config.plugins.DreamExplorer.startDir = ConfigText(default="/") @@ -85,1231 +99,1223 @@ HDSkn = False sz_w = getDesktop(0).size().width() if sz_w > 800: - HDSkn = True + HDSkn = True else: - HDSkn = False + HDSkn = False def Plugins(**kwargs): - list = [PluginDescriptor(name="Dream-Explorer", description=_("Explore your box"), where=[PluginDescriptor.WHERE_PLUGINMENU], icon="dreamexplorer.png", fnc=main)] - list.append(PluginDescriptor(name=_("Dream-Explorer"), where=PluginDescriptor.WHERE_EXTENSIONSMENU, fnc=main)) - #list.append(PluginDescriptor(where = [PluginDescriptor.WHERE_SESSIONSTART],fnc = autostart)) - return list + list = [PluginDescriptor(name="Dream-Explorer", description=_("Explore your box"), where=[PluginDescriptor.WHERE_PLUGINMENU], icon="dreamexplorer.png", fnc=main)] + list.append(PluginDescriptor(name=_("Dream-Explorer"), where=PluginDescriptor.WHERE_EXTENSIONSMENU, fnc=main)) + # list.append(PluginDescriptor(where = [PluginDescriptor.WHERE_SESSIONSTART],fnc = autostart)) + return list def main(session, **kwargs): - session.open(DreamExplorerII) + session.open(DreamExplorerII) def autostart(reason, **kwargs): - if reason == 0: - if "session" in kwargs: - global explSession - explSession = kwargs["session"] - InfoBar.showMovies = showExpl + if reason == 0: + if "session" in kwargs: + global explSession + explSession = kwargs["session"] + InfoBar.showMovies = showExpl def showExpl(dummy_self=None): - global explSession - explSession.open(DreamExplorerII) - -######## DREAM-EXPLORER START ####################### + explSession.open(DreamExplorerII) +# ####### DREAM-EXPLORER START ####################### class DreamExplorerII(Screen): - global HDSkn - if HDSkn: - if (getDesktop(0).size().width()) > 1030: - skin = """ - - - - - - - - - - - - - - - """ - else: - skin = """ - - - - - - - - - - - - - - - - """ - else: - skin = """ - - - - - - - - - - - - - - """ - - def __init__(self, session, args=None): - self.skin = DreamExplorerII.skin - Screen.__init__(self, session) - self.setTitle(_("Dream-Explorer")) - self.sesion = session - self.altservice = self.session.nav.getCurrentlyPlayingServiceOrGroup() - self.MyBox = HardwareInfo().get_device_name() - self.commando = ["ls"] - self.selectedDir = "/tmp/" - self.booklines = [] - self.MediaPattern = "^.*\.(ts|m2ts|mp3|wav|ogg|jpg|jpeg|jpe|png|bmp|mpg|mpeg|mkv|mp4|mov|divx|wmv|avi|mp2|m4a|flac|ifo|vob|iso|sh|flv|3gp|mod)" - if pathExists(config.plugins.DreamExplorer.startDir.value): - StartMeOn = config.plugins.DreamExplorer.startDir.value - else: - StartMeOn = None - if (config.plugins.DreamExplorer.MediaFilter.value == "off"): - self.MediaFilter = False - self["filelist"] = myFileList(StartMeOn, showDirectories=True, showFiles=True, matchingPattern=None, useServiceRef=False) - else: - self.MediaFilter = True - self["filelist"] = myFileList(StartMeOn, showDirectories=True, showFiles=True, matchingPattern=self.MediaPattern, useServiceRef=False) - self["TEMPfl"] = FileList("/", matchingPattern="(?i)^.*\.(jpeg|jpg|jpe|png|bmp)") - - self["key_red"] = StaticText(_("Delete")) - self["key_green"] = StaticText(_("Rename")) - self["key_yellow"] = StaticText(_("Move/Copy")) - self["key_blue"] = StaticText(_("Bookmarks")) - - self["actions"] = ActionMap(["WizardActions", "DirectionActions", "ColorActions", "MenuActions", "EPGSelectActions", "InfobarActions"], - { - "ok": self.ok, - "back": self.explExit, - "green": self.ExecRename, - "red": self.ExecDelete, - "blue": self.goToBookmark, - "yellow": self.go2CPmaniger, - "menu": self.explContextMenu, - "info": self.Info, - "left": self.left, - "right": self.right, - "up": self.up, - "down": self.down, - "nextBouquet": self.sortName, - "prevBouquet": self.sortDate, - "showMovies": self.CloseAndPlay - }, -1) - self.onLayoutFinish.append(self.byLayoutEnd) - - def ok(self): - global DVDPlayerAviable - if self["filelist"].canDescent(): - self["filelist"].descent() - self.updateLocationInfo() - else: - filename = self["filelist"].getCurrentDirectory() + self["filelist"].getFilename() - testFileName = self["filelist"].getFilename() - testFileName = testFileName.lower() - if filename is not None: - if testFileName.endswith(".ts"): - fileRef = eServiceReference("1:0:0:0:0:0:0:0:0:0:" + filename) - self.session.open(MoviePlayer, fileRef) - elif (testFileName.endswith(".mpg")) or (testFileName.endswith(".mpeg")) or (testFileName.endswith(".mkv")) or (testFileName.endswith(".m2ts")) or (testFileName.endswith(".vob")) or (testFileName.endswith(".mod")): - if testFileName.endswith(".m2ts"): - fileRef = eServiceReference("3:0:0:0:0:0:0:0:0:0:" + filename) - else: - fileRef = eServiceReference("4097:0:0:0:0:0:0:0:0:0:" + filename) - self.session.open(MoviePlayer, fileRef) - elif (testFileName.endswith(".avi")) or (testFileName.endswith(".mp4")) or (testFileName.endswith(".divx")) or (testFileName.endswith(".wmv")) or (testFileName.endswith(".mov")) or (testFileName.endswith(".flv")) or (testFileName.endswith(".3gp")): - if not (self.MyBox == "dm7025"): - fileRef = eServiceReference("4097:0:0:0:0:0:0:0:0:0:" + filename) - self.session.open(MoviePlayer, fileRef) - elif (testFileName.endswith(".mp3")) or (testFileName.endswith(".wav")) or (testFileName.endswith(".ogg")) or (testFileName.endswith(".m4a")) or (testFileName.endswith(".mp2")) or (testFileName.endswith(".flac")): - if (self.MyBox == "dm7025") and ((testFileName.endswith(".m4a")) or (testFileName.endswith(".mp2")) or (testFileName.endswith(".flac"))): - return - if MMPavaiable: - SongList, SongIndex = self.searchMusic() - try: - self.session.open(MerlinMusicPlayerScreen, SongList, SongIndex, False, self.altservice, None) - except: - self.session.open(MessageBox, _("Incompatible MerlinMusicPlayer version!"), MessageBox.TYPE_INFO) - else: - fileRef = eServiceReference("4097:0:0:0:0:0:0:0:0:0:" + filename) - m_dir = self["filelist"].getCurrentDirectory() - self.session.open(MusicExplorer, fileRef, m_dir, testFileName) - elif (testFileName.endswith(".jpg")) or (testFileName.endswith(".jpeg")) or (testFileName.endswith(".jpe")) or (testFileName.endswith(".png")) or (testFileName.endswith(".bmp")): - if self["filelist"].getSelectionIndex() != 0: - Pdir = self["filelist"].getCurrentDirectory() - self.session.open(PictureExplorerII, filename, Pdir) - elif (testFileName.endswith(".mvi")): - self.session.nav.stopService() - self.session.open(MviExplorer, filename) - elif (testFileName == "video_ts.ifo"): - if DVDPlayerAviable: - if (self["filelist"].getCurrentDirectory()).lower().endswith("video_ts/"): - self.session.open(DVDPlayer, dvd_filelist=[self["filelist"].getCurrentDirectory()]) - elif testFileName.endswith(".iso"): - if DVDPlayerAviable: - self.session.open(DVDPlayer, dvd_filelist=[filename]) - elif testFileName.endswith(".bootlogo.tar.gz"): - self.commando = ["mount -rw /boot -o remount", "sleep 3", "tar -xzvf " + filename + " -C /", "mount -ro /boot -o remount"] - askList = [(_("Cancel"), "NO"), (_("Install new bootlogo..."), "YES2ALL")] - dei = self.session.openWithCallback(self.SysExecution, ChoiceBox, title=_("Bootlogo-package:\\n") + filename, list=askList) - dei.setTitle(_("Dream-Explorer : Install...")) - elif testFileName.endswith(".tar.gz"): - self.commando = ["tar -xzvf " + filename + " -C /"] - askList = [(_("Cancel"), "NO"), (_("Install this package"), "YES")] - dei = self.session.openWithCallback(self.SysExecution, ChoiceBox, title=_("GZ-package:\\n") + filename, list=askList) - dei.setTitle(_("Dream-Explorer : Install...")) - elif testFileName.endswith(".tar.bz2"): - self.commando = ["tar -xjvf " + filename + " -C /"] - askList = [(_("Cancel"), "NO"), (_("Install this package"), "YES")] - dei = self.session.openWithCallback(self.SysExecution, ChoiceBox, title=_("BZ2-package:\\n") + filename, list=askList) - dei.setTitle(_("Dream-Explorer : Install...")) - elif testFileName.endswith(".ipk"): - if fileExists("/usr/bin/opkg"): - self.commando = ["opkg install " + filename] - else: - self.commando = ["ipkg install " + filename] - askList = [(_("Cancel"), "NO"), (_("Install this package"), "YES")] - dei = self.session.openWithCallback(self.SysExecution, ChoiceBox, title=_("OPKG-package:\\n") + filename, list=askList) - dei.setTitle(_("Dream-Explorer : Install...")) - elif testFileName.endswith(".pyc") or testFileName.endswith(".pyo"): - self.commando = ["/usr/lib/enigma2/python/Plugins/Extensions/DreamExplorer/pyc2xml " + filename] - askList = [(_("Cancel"), "NO"), (_("Disassemble to bytecode..."), "YES")] - dei = self.session.openWithCallback(self.SysExecution, ChoiceBox, title=_("Pyc-Script:\\n") + filename, list=askList) - dei.setTitle(_("Dream-Explorer : Disassemble...")) - elif testFileName.endswith(".sh") or (self["filelist"].getCurrentDirectory()).lower().endswith("init.d/"): - self.commando = [filename] - askList = [(_("Cancel"), "NO"), (_("View this shell-script"), "VIEW"), (_("Start execution"), "YES")] - self.session.openWithCallback(self.SysExecution, ChoiceBox, title=_("Do you want to execute?\\n") + filename, list=askList) - else: - try: - xfile = os.stat(filename) - except: - xfile = None - #old (xfile.st_size < 61440) - if xfile is not None and (xfile.st_size < 250000): - self.session.open(vEditor, filename) - - def byLayoutEnd(self): - self.updateLocationInfo() - if fileExists("/etc/myBookmarks"): - try: - booklist = open("/etc/myBookmarks", "r") - except: - dei = self.session.open(MessageBox, _("Error by reading bookmarks !!!"), MessageBox.TYPE_ERROR) - dei.setTitle(_("Dream-Explorer")) - if booklist is not None: - for oneline in booklist: - self.booklines.append(oneline) - booklist.close() - - def updateLocationInfo(self): - try: - if self.MediaFilter: - self.setTitle(_("[Media files] ") + self["filelist"].getCurrentDirectory()) - else: - self.setTitle(_("[All files] ") + self["filelist"].getCurrentDirectory()) - except: - self.setTitle(_("Dream-Explorer")) - - def explContextMenu(self): - self.playfile = '' - if self.MediaFilter: - mftext = _("Disable") - else: - mftext = _("Enable") - if self["filelist"].canDescent(): - if self["filelist"].getSelectionIndex() != 0: - self.selectedDir = self["filelist"].getSelection()[0] - if self.selectedDir + "\n" in self.booklines: - BMtext = _("Remove directory from Bookmarks") - BMstring = "DELLINK" - else: - BMtext = _("Add directory to Bookmarks") - BMstring = "ADDLINK" - contextDirList = [(_("Cancel"), "NO"), - (mftext + _(" Media-filter"), "FILTER"), - (_("Sort by name (bouquet+)"), "SORTNAME"), - (_("Sort by date (bouquet-)"), "SORTDATE"), - (_(BMtext), BMstring), - (_("Create new file"), "NEWFILE"), - (_("Create new directory"), "NEWDIR"), - (_("Set start directory"), "SETSTARTDIR"), - (_("About"), "HELP")] - last_dir = self["filelist"].getFilename() - folder = last_dir + 'STREAM/' - if last_dir.endswith("/BDMV/") and os.path.isdir(folder): - sizelist = [] - try: - for name in os.listdir(folder): - if name.endswith(".m2ts"): - try: - st = os.stat(folder + name) - size = st.st_size - if size > 0: - sizelist.append((folder + name, size)) - except: - pass - if sizelist: - sizelist.sort(key=lambda x: x[1]) - except: - pass - Len = len(sizelist) - if Len > 0: - index = Len - 1 - self.playfile = sizelist[index][0] - contextDirList.insert(1, (_("Auto play blu-ray file"), "BLURAY")) - dei = self.session.openWithCallback(self.SysExecution, ChoiceBox, title=_("Options:\n"), list=contextDirList) - dei.setTitle(_("Dream-Explorer")) - else: - contextFileList = [(_("Cancel"), "NO"), - (mftext + _(" Media-filter"), "FILTER"), - (_("Sort by name (bouquet+)"), "SORTNAME"), - (_("Sort by date (bouquet-)"), "SORTDATE"), - (_("Pack my bootlogo"), "PACKLOGOS"), - (_("About"), "HELP")] - dei = self.session.openWithCallback(self.SysExecution, ChoiceBox, title=_("Options:\n"), list=contextFileList) - dei.setTitle(_("Dream-Explorer")) - else: - contextFileList = [(_("Cancel"), "NO"), - (mftext + _(" Media-filter"), "FILTER"), - (_("Sort by name (bouquet+)"), "SORTNAME"), - (_("Sort by date (bouquet-)"), "SORTDATE"), - (_("Preview all pictures"), "PLAYDIRPICTURE"), - (_("Create new file"), "NEWFILE"), - (_("Create new directory"), "NEWDIR"), - (_("Create softlink..."), "SOFTLINK"), - (_("Set archive mode (644)"), "CHMOD644"), - (_("Set executable mode (755)"), "CHMOD755"), - (_("About"), "HELP")] - dei = self.session.openWithCallback(self.SysExecution, ChoiceBox, title=_("Options:\n"), list=contextFileList) - dei.setTitle(_("Dream-Explorer")) - - def SysExecution(self, answer): - global PicPlayerAviable - answer = answer and answer[1] - if answer == "YES": - self.session.open(Console, cmdlist=[self.commando[0]]) - elif answer == "YES2ALL": - self.session.open(Console, cmdlist=self.commando) - elif answer == "PACKLOGOS": - self.session.open(Console, cmdlist=["cd /tmp/", "tar -czf /tmp/dreambox.bootlogo.tar.gz /usr/share/bootlogo.mvi /usr/share/bootlogo_wait.mvi /usr/share/backdrop.mvi /boot/bootlogo.jpg"]) - elif answer == "VIEW": - try: - yfile = os.stat(self.commando[0]) - except: - yfile = None - #old yfile.st_size < 61440) - if yfile is not None and (yfile.st_size < 250000): - self.session.open(vEditor, self.commando[0]) - elif answer == "PLAYDIRPICTURE": - if PicPlayerAviable: - self["TEMPfl"].changeDir(self["filelist"].getCurrentDirectory()) - self.session.open(Pic_Thumb, self["TEMPfl"].getFileList(), 0, self["filelist"].getCurrentDirectory()) - else: - dei = self.session.open(MessageBox, _("Picture-Player not available!"), MessageBox.TYPE_ERROR) - dei.setTitle(_("Dream-Explorer")) - elif answer == "ADDLINK": - try: - newbooklist = open("/etc/myBookmarks", "w") - except: - dei = self.session.open(MessageBox, _("Error by writing bookmarks !!!"), MessageBox.TYPE_ERROR) - dei.setTitle(_("Dream-Explorer")) - if newbooklist is not None: - self.booklines.append(self.selectedDir + "\n") - for one_line in self.booklines: - newbooklist.write(one_line) - newbooklist.close() - elif answer == "DELLINK": - temp_book = [] - for bidx in range(len(self.booklines) - 1): - if not (self.selectedDir in self.booklines[bidx]): - temp_book.append(self.booklines[bidx]) - self.booklines = [] - self.booklines = temp_book - try: - newbooklist = open("/etc/myBookmarks", "w") - except: - dei = self.session.open(MessageBox, _("Error by writing bookmarks !!!"), MessageBox.TYPE_ERROR) - dei.setTitle(_("Dream-Explorer")) - if newbooklist is not None: - for one_line in self.booklines: - newbooklist.write(one_line) - newbooklist.close() - elif answer == "FILTER": - if self.MediaFilter: - self.MediaFilter = False - config.plugins.DreamExplorer.MediaFilter.value = "off" - config.plugins.DreamExplorer.MediaFilter.save() - self["filelist"].matchingPattern = None - self["filelist"].refresh() - self.updateLocationInfo() - else: - self.MediaFilter = True - config.plugins.DreamExplorer.MediaFilter.value = "on" - config.plugins.DreamExplorer.MediaFilter.save() - self["filelist"].matchingPattern = self.MediaPattern - self["filelist"].refresh() - self.updateLocationInfo() - elif answer == "NEWFILE": - self.session.openWithCallback(self.callbackNewFile, vInputBox, title=_(self["filelist"].getCurrentDirectory()), windowTitle=_("Create new file in..."), text="name") - elif answer == "NEWDIR": - self.session.openWithCallback(self.callbackNewDir, vInputBox, title=_(self["filelist"].getCurrentDirectory()), windowTitle=_("Create new directory in..."), text="name") - elif answer == "SETSTARTDIR": - newStartDir = self["filelist"].getSelection()[0] - dei = self.session.openWithCallback(self.callbackSetStartDir, MessageBox, _("Do you want to set\n" + newStartDir + "\nas start directory?"), MessageBox.TYPE_YESNO) - dei.setTitle(_("Dream-Explorer...")) - elif answer == "SORTNAME": - list = self.sortName() - elif answer == "SORTDATE": - list = self.sortDate() - elif answer == "HELP": - hilfe = _("Dreambox-Explorer\ncoded 2010 by Vali\n\nSupport & Help on\nwww.dreambox-tools.info") - dei = self.session.open(MessageBox, _(hilfe), MessageBox.TYPE_INFO) - dei.setTitle(_("Info...")) - elif answer == "SOFTLINK": - if not (self.MediaFilter): - self.session.openWithCallback(self.callbackCPmaniger, SoftLinkScreen, self["filelist"].getCurrentDirectory()) - elif answer == "CHMOD644": - os.system("chmod 644 " + self["filelist"].getCurrentDirectory() + self["filelist"].getFilename()) - elif answer == "CHMOD755": - os.system("chmod 755 " + self["filelist"].getCurrentDirectory() + self["filelist"].getFilename()) - elif answer == "BLURAY": - if self.playfile: - fileRef = eServiceReference("3:0:0:0:0:0:0:0:0:0:" + self.playfile) - self.session.open(MoviePlayer, fileRef) - - def up(self): - self["filelist"].up() - self.updateLocationInfo() - - def down(self): - self["filelist"].down() - self.updateLocationInfo() - - def left(self): - self["filelist"].pageUp() - self.updateLocationInfo() - - def right(self): - self["filelist"].pageDown() - self.updateLocationInfo() - - def Humanizer(self, size): - if (size < 1024): - humansize = str(size) + " B" - elif (size < 1048576): - humansize = str(size / 1024) + " KB" - else: - humansize = str(size / 1048576) + " MB" - return humansize - - def Info(self): - if self["filelist"].canDescent(): - if self["filelist"].getSelectionIndex() != 0: - curSelDir = self["filelist"].getSelection()[0] - try: - dir_stats = os.stat(curSelDir) - dir_infos = _("size ") + str(self.Humanizer(dir_stats.st_size)) + " " - dir_infos = dir_infos + _("last-mod ") + strftime("%d.%m.%Y %H:%M:%S", localtime(dir_stats.st_mtime)) + " " - dir_infos = dir_infos + _("mode ") + str(dir_stats.st_mode) - except: - dir_infos = _("read error") - self.setTitle(_(dir_infos)) - else: - dei = self.session.open(MessageBox, _("Box: ") + self.MyBox + "\n\n" + ScanSysem_str(), MessageBox.TYPE_INFO) - dei.setTitle(_("Dream-Explorer")) - else: - curSelFile = self["filelist"].getCurrentDirectory() + self["filelist"].getFilename() - try: - file_stats = os.stat(curSelFile) - file_infos = _("size ") + str(self.Humanizer(file_stats.st_size)) + " " - file_infos = file_infos + _("last-mod ") + strftime("%d.%m.%Y %H:%M:%S", localtime(file_stats.st_mtime)) + " " - file_infos = file_infos + _("mode ") + str(file_stats.st_mode) - except: - file_infos = _("read error") - self.setTitle(_(file_infos)) - if curSelFile.endswith(".ts"): - serviceref = eServiceReference("1:0:0:0:0:0:0:0:0:0:" + curSelFile) - serviceHandler = eServiceCenter.getInstance() - info = serviceHandler.info(serviceref) - evt = info.getEvent(serviceref) - if evt: - self.session.open(EventViewSimple, evt, ServiceReference(serviceref)) - - def setBookmark(self, answer): - answer = answer and answer[1] - try: - if answer[0] == "/": - self["filelist"].changeDir(answer[:-1]) - self.updateLocationInfo() - except: - pass - - def goToBookmark(self): - bml = [(_("Cancel"), "BACK")] - for onemark in self.booklines: - bml.append((_(onemark), onemark)) - dei = self.session.openWithCallback(self.setBookmark, ChoiceBox, title=_("My Bookmarks"), list=bml) - dei.setTitle(_("Dream-Explorer")) - - def ExecDelete(self): - if self.MediaFilter: - dei = self.session.open(MessageBox, _('Turn off the media-filter first.'), MessageBox.TYPE_INFO) - dei.setTitle(_("Dream-Explorer...")) - return - if not (self["filelist"].canDescent()): - DELfilename = self["filelist"].getCurrentDirectory() + self["filelist"].getFilename() - dei = self.session.openWithCallback(self.callbackExecDelete, MessageBox, _("Do you realy want to DELETE:\n") + DELfilename, MessageBox.TYPE_YESNO) - dei.setTitle(_("Dream-Explorer - DELETE file...")) - elif (self["filelist"].getSelectionIndex() != 0) and (self["filelist"].canDescent()): - DELDIR = self["filelist"].getSelection()[0] - dei = self.session.openWithCallback(self.callbackDelDir, MessageBox, _("Do you realy want to DELETE:\n") + DELDIR + _('\n\nYou do it at your own risk!'), MessageBox.TYPE_YESNO) - dei.setTitle(_("Dream-Explorer - DELETE DIRECTORY...")) - - def callbackExecDelete(self, answer): - if answer is True: - DELfilename = self["filelist"].getCurrentDirectory() + self["filelist"].getFilename() - order = 'rm -f \"' + DELfilename + '\"' - try: - os.system(order) - self["filelist"].refresh() - except: - dei = self.session.open(MessageBox, _("%s \nFAILED!") % order, MessageBox.TYPE_ERROR) - dei.setTitle(_("Dream-Explorer")) - self["filelist"].refresh() - - def callbackDelDir(self, answer): - if answer is True: - DELDIR = self["filelist"].getSelection()[0] - order = 'rm -r \"' + DELDIR + '\"' - try: - os.system(order) - self["filelist"].refresh() - except: - dei = self.session.open(MessageBox, _("%s \nFAILED!") % order, MessageBox.TYPE_ERROR) - dei.setTitle(_("Dream-Explorer")) - self["filelist"].refresh() - - def ExecRename(self): - if self.MediaFilter: - dei = self.session.open(MessageBox, _('Turn off the media-filter first.'), MessageBox.TYPE_INFO) - dei.setTitle(_("Dream-Explorer...")) - return - if not (self["filelist"].canDescent()): - RENfilename = self["filelist"].getFilename() - self.session.openWithCallback(self.callbackExecRename, vInputBox, title=_("old: ") + RENfilename, windowTitle=_("Rename file..."), text=RENfilename) - elif (self["filelist"].getSelectionIndex() != 0) and (self["filelist"].canDescent()): - RENDIR = self["filelist"].getSelection()[0] - self.session.openWithCallback(self.callbackRenDir, vInputBox, title=_("old: ") + RENDIR, windowTitle=_("Rename directory..."), text=RENDIR) - - def callbackExecRename(self, answer): - if answer is not None: - source = self["filelist"].getCurrentDirectory() + self["filelist"].getFilename() - dest = self["filelist"].getCurrentDirectory() + answer - try: - os.rename(source, dest) - self["filelist"].refresh() - except: - dei = self.session.open(MessageBox, _("Rename: %s \nFAILED!") % answer, MessageBox.TYPE_ERROR) - dei.setTitle(_("Dream-Explorer")) - self["filelist"].refresh() - - def callbackRenDir(self, answer): - if answer is not None: - source = self["filelist"].getSelection()[0] - dest = answer - try: - os.rename(source, dest) - self["filelist"].refresh() - except: - dei = self.session.open(MessageBox, _("Rename: %s \nFAILED!") % answer, MessageBox.TYPE_ERROR) - dei.setTitle(_("Dream-Explorer")) - self["filelist"].refresh() - - def callbackNewFile(self, answer): - if answer is None: - return - dest = self["filelist"].getCurrentDirectory() - if (" " in answer) or (" " in dest) or (answer == ""): - dei = self.session.open(MessageBox, _("File name error !"), MessageBox.TYPE_ERROR) - dei.setTitle(_("Dream-Explorer")) - return - else: - order = 'touch ' + dest + answer - try: - if not fileExists(dest + answer): - os.system(order) - self["filelist"].refresh() - except: - dei = self.session.open(MessageBox, _("%s \nFAILED!") % order, MessageBox.TYPE_ERROR) - dei.setTitle(_("Dream-Explorer")) - self["filelist"].refresh() - - def callbackNewDir(self, answer): - if answer is None: - return - dest = self["filelist"].getCurrentDirectory() - if (" " in answer) or (" " in dest) or (answer == ""): - dei = self.session.open(MessageBox, _("Directory name error !"), MessageBox.TYPE_ERROR) - dei.setTitle(_("Dream-Explorer")) - return - else: - order = dest + answer - try: - if not pathExists(dest + answer): - os.mkdir(order) - self["filelist"].refresh() - except: - dei = self.session.open(MessageBox, _("%s \nFAILED!") % order, MessageBox.TYPE_ERROR) - dei.setTitle(_("Dream-Explorer")) - self["filelist"].refresh() - - def go2CPmaniger(self): - if self.MediaFilter: - dei = self.session.open(MessageBox, _('Turn off the media-filter first.'), MessageBox.TYPE_INFO) - dei.setTitle(_("Dream-Explorer...")) - return - if not (self["filelist"].canDescent()): - source = self["filelist"].getCurrentDirectory() + self["filelist"].getFilename() - self.session.openWithCallback(self.callbackCPmaniger, CPmaniger, source) - elif (self["filelist"].getSelectionIndex() != 0) and (self["filelist"].canDescent()): #NEW - source = self["filelist"].getSelection()[0] - self.session.openWithCallback(self.callbackCPmaniger, CPmaniger, source) - - def callbackCPmaniger(self, answer): - self["filelist"].refresh() - - def callbackSetStartDir(self, answerSD): - if answerSD is True: - config.plugins.DreamExplorer.startDir.value = self["filelist"].getSelection()[0] - config.plugins.DreamExplorer.startDir.save() - - def sortName(self): - list = self["filelist"].sortName() - try: - if self.MediaFilter: - self.setTitle(_("[sort by Name] ") + self["filelist"].getCurrentDirectory()) - else: - self.setTitle(_("[sort by Name] ") + self["filelist"].getCurrentDirectory()) - except: - self.setTitle(_("Dream-Explorer")) - - def sortDate(self): - list = self["filelist"].sortDate() - try: - if self.MediaFilter: - self.setTitle(_("[sort by Date] ") + self["filelist"].getCurrentDirectory()) - else: - self.setTitle(_("[sort by Date] ") + self["filelist"].getCurrentDirectory()) - except: - self.setTitle(_("Dream-Explorer")) - - def searchMusic(self): - slist = [] - foundIndex = 0 - index = 0 - files = os.listdir(self["filelist"].getCurrentDirectory()) - files.sort() - for name in files: - testname = name.lower() - if testname.endswith(".mp3") or name.endswith(".m4a") or name.endswith(".ogg") or name.endswith(".flac"): - slist.append((Item(text=name, filename=os.path.join(self["filelist"].getCurrentDirectory(), name)),)) - if self["filelist"].getFilename() == name: - foundIndex = index - index = index + 1 - return slist, foundIndex - - def explExit(self): - self.session.nav.playService(self.altservice) - try: - if self.MediaFilter: - config.plugins.DreamExplorer.MediaFilter.value = "on" - else: - config.plugins.DreamExplorer.MediaFilter.value = "off" - config.plugins.DreamExplorer.MediaFilter.save() - except: - pass - self.close() - - def CloseAndPlay(self): - try: - if self.MediaFilter: - config.plugins.DreamExplorer.MediaFilter.value = "on" - else: - config.plugins.DreamExplorer.MediaFilter.value = "off" - config.plugins.DreamExplorer.MediaFilter.save() - except: - pass - self.close() - -######## DREAM-EXPLORER END ####################### - - + if HDSkn: + if (getDesktop(0).size().width()) > 1030: + skin = """ + + + + + + + + + + + + + + + """ + else: + skin = """ + + + + + + + + + + + + + + + + """ + else: + skin = """ + + + + + + + + + + + + + + """ + + def __init__(self, session, args=None): + self.skin = DreamExplorerII.skin + Screen.__init__(self, session) + self.setTitle(_("Dream-Explorer")) + self.sesion = session + self.altservice = self.session.nav.getCurrentlyPlayingServiceOrGroup() + self.MyBox = HardwareInfo().get_device_name() + self.commando = ["ls"] + self.selectedDir = "/tmp/" + self.booklines = [] + self.MediaPattern = r"^.*\.(ts|m2ts|mp3|wav|ogg|jpg|jpeg|jpe|png|bmp|mpg|mpeg|mkv|mp4|mov|divx|wmv|avi|mp2|m4a|flac|ifo|vob|iso|sh|flv|3gp|mod)" + if pathExists(config.plugins.DreamExplorer.startDir.value): + StartMeOn = config.plugins.DreamExplorer.startDir.value + else: + StartMeOn = None + if (config.plugins.DreamExplorer.MediaFilter.value == "off"): + self.MediaFilter = False + self["filelist"] = myFileList(StartMeOn, showDirectories=True, showFiles=True, matchingPattern=None, useServiceRef=False) + else: + self.MediaFilter = True + self["filelist"] = myFileList(StartMeOn, showDirectories=True, showFiles=True, matchingPattern=self.MediaPattern, useServiceRef=False) + self["TEMPfl"] = FileList("/", matchingPattern=r"(?i)^.*\.(jpeg|jpg|jpe|png|bmp)") + self["key_red"] = StaticText(_("Delete")) + self["key_green"] = StaticText(_("Rename")) + self["key_yellow"] = StaticText(_("Move/Copy")) + self["key_blue"] = StaticText(_("Bookmarks")) + self["actions"] = ActionMap(["WizardActions", "DirectionActions", "ColorActions", "MenuActions", "EPGSelectActions", "InfobarActions"], + { + "ok": self.ok, + "back": self.explExit, + "green": self.ExecRename, + "red": self.ExecDelete, + "blue": self.goToBookmark, + "yellow": self.go2CPmaniger, + "menu": self.explContextMenu, + "info": self.Info, + "left": self.left, + "right": self.right, + "up": self.up, + "down": self.down, + "nextBouquet": self.sortName, + "prevBouquet": self.sortDate, + "showMovies": self.CloseAndPlay + }, -1) + self.onLayoutFinish.append(self.byLayoutEnd) + + def ok(self): + if self["filelist"].canDescent(): + self["filelist"].descent() + self.updateLocationInfo() + else: + filename = self["filelist"].getCurrentDirectory() + self["filelist"].getFilename() + testFileName = self["filelist"].getFilename() + testFileName = testFileName.lower() + if filename is not None: + if testFileName.endswith(".ts"): + fileRef = eServiceReference("1:0:0:0:0:0:0:0:0:0:" + filename) + self.session.open(MoviePlayer, fileRef) + elif (testFileName.endswith(".mpg")) or (testFileName.endswith(".mpeg")) or (testFileName.endswith(".mkv")) or (testFileName.endswith(".m2ts")) or (testFileName.endswith(".vob")) or (testFileName.endswith(".mod")): + if testFileName.endswith(".m2ts"): + fileRef = eServiceReference("3:0:0:0:0:0:0:0:0:0:" + filename) + else: + fileRef = eServiceReference("4097:0:0:0:0:0:0:0:0:0:" + filename) + self.session.open(MoviePlayer, fileRef) + elif (testFileName.endswith(".avi")) or (testFileName.endswith(".mp4")) or (testFileName.endswith(".divx")) or (testFileName.endswith(".wmv")) or (testFileName.endswith(".mov")) or (testFileName.endswith(".flv")) or (testFileName.endswith(".3gp")): + if not (self.MyBox == "dm7025"): + fileRef = eServiceReference("4097:0:0:0:0:0:0:0:0:0:" + filename) + self.session.open(MoviePlayer, fileRef) + elif (testFileName.endswith(".mp3")) or (testFileName.endswith(".wav")) or (testFileName.endswith(".ogg")) or (testFileName.endswith(".m4a")) or (testFileName.endswith(".mp2")) or (testFileName.endswith(".flac")): + if (self.MyBox == "dm7025") and ((testFileName.endswith(".m4a")) or (testFileName.endswith(".mp2")) or (testFileName.endswith(".flac"))): + return + if MMPavaiable: + SongList, SongIndex = self.searchMusic() + try: + self.session.open(MerlinMusicPlayerScreen, SongList, SongIndex, False, self.altservice, None) + except: + self.session.open(MessageBox, _("Incompatible MerlinMusicPlayer version!"), MessageBox.TYPE_INFO) + else: + fileRef = eServiceReference("4097:0:0:0:0:0:0:0:0:0:" + filename) + m_dir = self["filelist"].getCurrentDirectory() + self.session.open(MusicExplorer, fileRef, m_dir, testFileName) + elif (testFileName.endswith(".jpg")) or (testFileName.endswith(".jpeg")) or (testFileName.endswith(".jpe")) or (testFileName.endswith(".png")) or (testFileName.endswith(".bmp")): + if self["filelist"].getSelectionIndex() != 0: + Pdir = self["filelist"].getCurrentDirectory() + self.session.open(PictureExplorerII, filename, Pdir) + elif (testFileName.endswith(".mvi")): + self.session.nav.stopService() + self.session.open(MviExplorer, filename) + elif (testFileName == "video_ts.ifo"): + if DVDPlayerAviable: + if (self["filelist"].getCurrentDirectory()).lower().endswith("video_ts/"): + self.session.open(DVDPlayer, dvd_filelist=[self["filelist"].getCurrentDirectory()]) + elif testFileName.endswith(".iso"): + if DVDPlayerAviable: + self.session.open(DVDPlayer, dvd_filelist=[filename]) + elif testFileName.endswith(".bootlogo.tar.gz"): + self.commando = ["mount -rw /boot -o remount", "sleep 3", "tar -xzvf " + filename + " -C /", "mount -ro /boot -o remount"] + askList = [(_("Cancel"), "NO"), (_("Install new bootlogo..."), "YES2ALL")] + dei = self.session.openWithCallback(self.SysExecution, ChoiceBox, title=_("Bootlogo-package:\\n") + filename, list=askList) + dei.setTitle(_("Dream-Explorer : Install...")) + elif testFileName.endswith(".tar.gz"): + self.commando = ["tar -xzvf " + filename + " -C /"] + askList = [(_("Cancel"), "NO"), (_("Install this package"), "YES")] + dei = self.session.openWithCallback(self.SysExecution, ChoiceBox, title=_("GZ-package:\\n") + filename, list=askList) + dei.setTitle(_("Dream-Explorer : Install...")) + elif testFileName.endswith(".tar.bz2"): + self.commando = ["tar -xjvf " + filename + " -C /"] + askList = [(_("Cancel"), "NO"), (_("Install this package"), "YES")] + dei = self.session.openWithCallback(self.SysExecution, ChoiceBox, title=_("BZ2-package:\\n") + filename, list=askList) + dei.setTitle(_("Dream-Explorer : Install...")) + elif testFileName.endswith(".ipk"): + if fileExists("/usr/bin/opkg"): + self.commando = ["opkg install " + filename] + else: + self.commando = ["ipkg install " + filename] + askList = [(_("Cancel"), "NO"), (_("Install this package"), "YES")] + dei = self.session.openWithCallback(self.SysExecution, ChoiceBox, title=_("OPKG-package:\\n") + filename, list=askList) + dei.setTitle(_("Dream-Explorer : Install...")) + elif testFileName.endswith(".pyc") or testFileName.endswith(".pyo"): + self.commando = ["/usr/lib/enigma2/python/Plugins/Extensions/DreamExplorer/pyc2xml " + filename] + askList = [(_("Cancel"), "NO"), (_("Disassemble to bytecode..."), "YES")] + dei = self.session.openWithCallback(self.SysExecution, ChoiceBox, title=_("Pyc-Script:\\n") + filename, list=askList) + dei.setTitle(_("Dream-Explorer : Disassemble...")) + elif testFileName.endswith(".sh") or (self["filelist"].getCurrentDirectory()).lower().endswith("init.d/"): + self.commando = [filename] + askList = [(_("Cancel"), "NO"), (_("View this shell-script"), "VIEW"), (_("Start execution"), "YES")] + self.session.openWithCallback(self.SysExecution, ChoiceBox, title=_("Do you want to execute?\\n") + filename, list=askList) + else: + try: + xfile = os_stat(filename) + except: + xfile = None + # old (xfile.st_size < 61440) + if xfile is not None and (xfile.st_size < 250000): + self.session.open(vEditor, filename) + + def byLayoutEnd(self): + self.updateLocationInfo() + if fileExists("/etc/myBookmarks"): + try: + booklist = open("/etc/myBookmarks", "r") + except: + dei = self.session.open(MessageBox, _("Error by reading bookmarks !!!"), MessageBox.TYPE_ERROR) + dei.setTitle(_("Dream-Explorer")) + if booklist is not None: + for oneline in booklist: + self.booklines.append(oneline) + booklist.close() + + def updateLocationInfo(self): + try: + if self.MediaFilter: + self.setTitle(_("[Media files] ") + self["filelist"].getCurrentDirectory()) + else: + self.setTitle(_("[All files] ") + self["filelist"].getCurrentDirectory()) + except: + self.setTitle(_("Dream-Explorer")) + + def explContextMenu(self): + self.playfile = '' + if self.MediaFilter: + mftext = _("Disable") + else: + mftext = _("Enable") + if self["filelist"].canDescent(): + if self["filelist"].getSelectionIndex() != 0: + self.selectedDir = self["filelist"].getSelection()[0] + if self.selectedDir + "\n" in self.booklines: + BMtext = _("Remove directory from Bookmarks") + BMstring = "DELLINK" + else: + BMtext = _("Add directory to Bookmarks") + BMstring = "ADDLINK" + contextDirList = [ + (_("Cancel"), "NO"), + (mftext + _(" Media-filter"), "FILTER"), + (_("Sort by name (bouquet+)"), "SORTNAME"), + (_("Sort by date (bouquet-)"), "SORTDATE"), + (_(BMtext), BMstring), + (_("Create new file"), "NEWFILE"), + (_("Create new directory"), "NEWDIR"), + (_("Set start directory"), "SETSTARTDIR"), + (_("About"), "HELP") + ] + last_dir = self["filelist"].getFilename() + folder = last_dir + 'STREAM/' + if last_dir.endswith("/BDMV/") and os_path.isdir(folder): + sizelist = [] + try: + for name in os_listdir(folder): + if name.endswith(".m2ts"): + try: + st = os_stat(folder + name) + size = st.st_size + if size > 0: + sizelist.append((folder + name, size)) + except: + pass + if sizelist: + sizelist.sort(key=lambda x: x[1]) + except: + pass + Len = len(sizelist) + if Len > 0: + index = Len - 1 + self.playfile = sizelist[index][0] + contextDirList.insert(1, (_("Auto play blu-ray file"), "BLURAY")) + dei = self.session.openWithCallback(self.SysExecution, ChoiceBox, title=_("Options:\n"), list=contextDirList) + dei.setTitle(_("Dream-Explorer")) + else: + contextFileList = [ + (_("Cancel"), "NO"), + (mftext + _(" Media-filter"), "FILTER"), + (_("Sort by name (bouquet+)"), "SORTNAME"), + (_("Sort by date (bouquet-)"), "SORTDATE"), + (_("Pack my bootlogo"), "PACKLOGOS"), + (_("About"), "HELP") + ] + dei = self.session.openWithCallback(self.SysExecution, ChoiceBox, title=_("Options:\n"), list=contextFileList) + dei.setTitle(_("Dream-Explorer")) + else: + contextFileList = [ + (_("Cancel"), "NO"), + (mftext + _(" Media-filter"), "FILTER"), + (_("Sort by name (bouquet+)"), "SORTNAME"), + (_("Sort by date (bouquet-)"), "SORTDATE"), + (_("Preview all pictures"), "PLAYDIRPICTURE"), + (_("Create new file"), "NEWFILE"), + (_("Create new directory"), "NEWDIR"), + (_("Create softlink..."), "SOFTLINK"), + (_("Set archive mode (644)"), "CHMOD644"), + (_("Set executable mode (755)"), "CHMOD755"), + (_("About"), "HELP") + ] + dei = self.session.openWithCallback(self.SysExecution, ChoiceBox, title=_("Options:\n"), list=contextFileList) + dei.setTitle(_("Dream-Explorer")) + + def SysExecution(self, answer): + answer = answer and answer[1] + if answer == "YES": + self.session.open(Console, cmdlist=[self.commando[0]]) + elif answer == "YES2ALL": + self.session.open(Console, cmdlist=self.commando) + elif answer == "PACKLOGOS": + self.session.open(Console, cmdlist=["cd /tmp/", "tar -czf /tmp/dreambox.bootlogo.tar.gz /usr/share/bootlogo.mvi /usr/share/bootlogo_wait.mvi /usr/share/backdrop.mvi /boot/bootlogo.jpg"]) + elif answer == "VIEW": + try: + yfile = os_stat(self.commando[0]) + except: + yfile = None + # old yfile.st_size < 61440) + if yfile is not None and (yfile.st_size < 250000): + self.session.open(vEditor, self.commando[0]) + elif answer == "PLAYDIRPICTURE": + if PicPlayerAviable: + self["TEMPfl"].changeDir(self["filelist"].getCurrentDirectory()) + self.session.open(Pic_Thumb, self["TEMPfl"].getFileList(), 0, self["filelist"].getCurrentDirectory()) + else: + dei = self.session.open(MessageBox, _("Picture-Player not available!"), MessageBox.TYPE_ERROR) + dei.setTitle(_("Dream-Explorer")) + elif answer == "ADDLINK": + try: + newbooklist = open("/etc/myBookmarks", "w") + except: + dei = self.session.open(MessageBox, _("Error by writing bookmarks !!!"), MessageBox.TYPE_ERROR) + dei.setTitle(_("Dream-Explorer")) + if newbooklist is not None: + self.booklines.append(self.selectedDir + "\n") + for one_line in self.booklines: + newbooklist.write(one_line) + newbooklist.close() + elif answer == "DELLINK": + temp_book = [] + for bidx in range(len(self.booklines) - 1): + if not (self.selectedDir in self.booklines[bidx]): + temp_book.append(self.booklines[bidx]) + self.booklines = [] + self.booklines = temp_book + try: + newbooklist = open("/etc/myBookmarks", "w") + except: + dei = self.session.open(MessageBox, _("Error by writing bookmarks !!!"), MessageBox.TYPE_ERROR) + dei.setTitle(_("Dream-Explorer")) + if newbooklist is not None: + for one_line in self.booklines: + newbooklist.write(one_line) + newbooklist.close() + elif answer == "FILTER": + if self.MediaFilter: + self.MediaFilter = False + config.plugins.DreamExplorer.MediaFilter.value = "off" + config.plugins.DreamExplorer.MediaFilter.save() + self["filelist"].matchingPattern = None + self["filelist"].refresh() + self.updateLocationInfo() + else: + self.MediaFilter = True + config.plugins.DreamExplorer.MediaFilter.value = "on" + config.plugins.DreamExplorer.MediaFilter.save() + self["filelist"].matchingPattern = self.MediaPattern + self["filelist"].refresh() + self.updateLocationInfo() + elif answer == "NEWFILE": + self.session.openWithCallback(self.callbackNewFile, vInputBox, title=_(self["filelist"].getCurrentDirectory()), windowTitle=_("Create new file in..."), text="name") + elif answer == "NEWDIR": + self.session.openWithCallback(self.callbackNewDir, vInputBox, title=_(self["filelist"].getCurrentDirectory()), windowTitle=_("Create new directory in..."), text="name") + elif answer == "SETSTARTDIR": + newStartDir = self["filelist"].getSelection()[0] + dei = self.session.openWithCallback(self.callbackSetStartDir, MessageBox, _("Do you want to set\n" + newStartDir + "\nas start directory?"), MessageBox.TYPE_YESNO) + dei.setTitle(_("Dream-Explorer...")) + elif answer == "SORTNAME": + list = self.sortName() + elif answer == "SORTDATE": + list = self.sortDate() + elif answer == "HELP": + hilfe = _("Dreambox-Explorer\ncoded 2010 by Vali\n\nSupport & Help on\nwww.dreambox-tools.info") + dei = self.session.open(MessageBox, _(hilfe), MessageBox.TYPE_INFO) + dei.setTitle(_("Info...")) + elif answer == "SOFTLINK": + if not (self.MediaFilter): + self.session.openWithCallback(self.callbackCPmaniger, SoftLinkScreen, self["filelist"].getCurrentDirectory()) + elif answer == "CHMOD644": + os_system("chmod 644 " + self["filelist"].getCurrentDirectory() + self["filelist"].getFilename()) + elif answer == "CHMOD755": + os_system("chmod 755 " + self["filelist"].getCurrentDirectory() + self["filelist"].getFilename()) + elif answer == "BLURAY": + if self.playfile: + fileRef = eServiceReference("3:0:0:0:0:0:0:0:0:0:" + self.playfile) + self.session.open(MoviePlayer, fileRef) + + def up(self): + self["filelist"].up() + self.updateLocationInfo() + + def down(self): + self["filelist"].down() + self.updateLocationInfo() + + def left(self): + self["filelist"].pageUp() + self.updateLocationInfo() + + def right(self): + self["filelist"].pageDown() + self.updateLocationInfo() + + def Humanizer(self, size): + if (size < 1024): + humansize = str(size) + " B" + elif (size < 1048576): + humansize = str(size / 1024) + " KB" + else: + humansize = str(size / 1048576) + " MB" + return humansize + + def Info(self): + if self["filelist"].canDescent(): + if self["filelist"].getSelectionIndex() != 0: + curSelDir = self["filelist"].getSelection()[0] + try: + dir_stats = os_stat(curSelDir) + dir_infos = _("size ") + str(self.Humanizer(dir_stats.st_size)) + " " + dir_infos = dir_infos + _("last-mod ") + time_strftime("%d.%m.%Y %H:%M:%S", time_localtime(dir_stats.st_mtime)) + " " + dir_infos = dir_infos + _("mode ") + str(dir_stats.st_mode) + except: + dir_infos = _("read error") + self.setTitle(_(dir_infos)) + else: + dei = self.session.open(MessageBox, _("Box: ") + self.MyBox + "\n\n" + ScanSysem_str(), MessageBox.TYPE_INFO) + dei.setTitle(_("Dream-Explorer")) + else: + curSelFile = self["filelist"].getCurrentDirectory() + self["filelist"].getFilename() + try: + file_stats = os_stat(curSelFile) + file_infos = _("size ") + str(self.Humanizer(file_stats.st_size)) + " " + file_infos = file_infos + _("last-mod ") + time_strftime("%d.%m.%Y %H:%M:%S", time_localtime(file_stats.st_mtime)) + " " + file_infos = file_infos + _("mode ") + str(file_stats.st_mode) + except: + file_infos = _("read error") + self.setTitle(_(file_infos)) + if curSelFile.endswith(".ts"): + serviceref = eServiceReference("1:0:0:0:0:0:0:0:0:0:" + curSelFile) + serviceHandler = eServiceCenter.getInstance() + info = serviceHandler.info(serviceref) + evt = info.getEvent(serviceref) + if evt: + self.session.open(EventViewSimple, evt, ServiceReference(serviceref)) + + def setBookmark(self, answer): + answer = answer and answer[1] + try: + if answer[0] == "/": + self["filelist"].changeDir(answer[:-1]) + self.updateLocationInfo() + except: + pass + + def goToBookmark(self): + bml = [(_("Cancel"), "BACK")] + for onemark in self.booklines: + bml.append((_(onemark), onemark)) + dei = self.session.openWithCallback(self.setBookmark, ChoiceBox, title=_("My Bookmarks"), list=bml) + dei.setTitle(_("Dream-Explorer")) + + def ExecDelete(self): + if self.MediaFilter: + dei = self.session.open(MessageBox, _('Turn off the media-filter first.'), MessageBox.TYPE_INFO) + dei.setTitle(_("Dream-Explorer...")) + return + if not (self["filelist"].canDescent()): + DELfilename = self["filelist"].getCurrentDirectory() + self["filelist"].getFilename() + dei = self.session.openWithCallback(self.callbackExecDelete, MessageBox, _("Do you realy want to DELETE:\n") + DELfilename, MessageBox.TYPE_YESNO) + dei.setTitle(_("Dream-Explorer - DELETE file...")) + elif (self["filelist"].getSelectionIndex() != 0) and (self["filelist"].canDescent()): + DELDIR = self["filelist"].getSelection()[0] + dei = self.session.openWithCallback(self.callbackDelDir, MessageBox, _("Do you realy want to DELETE:\n") + DELDIR + _('\n\nYou do it at your own risk!'), MessageBox.TYPE_YESNO) + dei.setTitle(_("Dream-Explorer - DELETE DIRECTORY...")) + + def callbackExecDelete(self, answer): + if answer is True: + DELfilename = self["filelist"].getCurrentDirectory() + self["filelist"].getFilename() + order = 'rm -f \"' + DELfilename + '\"' + try: + os_system(order) + self["filelist"].refresh() + except: + dei = self.session.open(MessageBox, _("%s \nFAILED!") % order, MessageBox.TYPE_ERROR) + dei.setTitle(_("Dream-Explorer")) + self["filelist"].refresh() + + def callbackDelDir(self, answer): + if answer is True: + DELDIR = self["filelist"].getSelection()[0] + order = 'rm -r \"' + DELDIR + '\"' + try: + os_system(order) + self["filelist"].refresh() + except: + dei = self.session.open(MessageBox, _("%s \nFAILED!") % order, MessageBox.TYPE_ERROR) + dei.setTitle(_("Dream-Explorer")) + self["filelist"].refresh() + + def ExecRename(self): + if self.MediaFilter: + dei = self.session.open(MessageBox, _('Turn off the media-filter first.'), MessageBox.TYPE_INFO) + dei.setTitle(_("Dream-Explorer...")) + return + if not (self["filelist"].canDescent()): + RENfilename = self["filelist"].getFilename() + self.session.openWithCallback(self.callbackExecRename, vInputBox, title=_("old: ") + RENfilename, windowTitle=_("Rename file..."), text=RENfilename) + elif (self["filelist"].getSelectionIndex() != 0) and (self["filelist"].canDescent()): + RENDIR = self["filelist"].getSelection()[0] + self.session.openWithCallback(self.callbackRenDir, vInputBox, title=_("old: ") + RENDIR, windowTitle=_("Rename directory..."), text=RENDIR) + + def callbackExecRename(self, answer): + if answer is not None: + source = self["filelist"].getCurrentDirectory() + self["filelist"].getFilename() + dest = self["filelist"].getCurrentDirectory() + answer + try: + os_rename(source, dest) + self["filelist"].refresh() + except: + dei = self.session.open(MessageBox, _("Rename: %s \nFAILED!") % answer, MessageBox.TYPE_ERROR) + dei.setTitle(_("Dream-Explorer")) + self["filelist"].refresh() + + def callbackRenDir(self, answer): + if answer is not None: + source = self["filelist"].getSelection()[0] + dest = answer + try: + os_rename(source, dest) + self["filelist"].refresh() + except: + dei = self.session.open(MessageBox, _("Rename: %s \nFAILED!") % answer, MessageBox.TYPE_ERROR) + dei.setTitle(_("Dream-Explorer")) + self["filelist"].refresh() + + def callbackNewFile(self, answer): + if answer is None: + return + dest = self["filelist"].getCurrentDirectory() + if (" " in answer) or (" " in dest) or (answer == ""): + dei = self.session.open(MessageBox, _("File name error !"), MessageBox.TYPE_ERROR) + dei.setTitle(_("Dream-Explorer")) + return + else: + order = 'touch ' + dest + answer + try: + if not fileExists(dest + answer): + os_system(order) + self["filelist"].refresh() + except: + dei = self.session.open(MessageBox, _("%s \nFAILED!") % order, MessageBox.TYPE_ERROR) + dei.setTitle(_("Dream-Explorer")) + self["filelist"].refresh() + + def callbackNewDir(self, answer): + if answer is None: + return + dest = self["filelist"].getCurrentDirectory() + if (" " in answer) or (" " in dest) or (answer == ""): + dei = self.session.open(MessageBox, _("Directory name error !"), MessageBox.TYPE_ERROR) + dei.setTitle(_("Dream-Explorer")) + return + else: + order = dest + answer + try: + if not pathExists(dest + answer): + os_mkdir(order) + self["filelist"].refresh() + except: + dei = self.session.open(MessageBox, _("%s \nFAILED!") % order, MessageBox.TYPE_ERROR) + dei.setTitle(_("Dream-Explorer")) + self["filelist"].refresh() + + def go2CPmaniger(self): + if self.MediaFilter: + dei = self.session.open(MessageBox, _('Turn off the media-filter first.'), MessageBox.TYPE_INFO) + dei.setTitle(_("Dream-Explorer...")) + return + if not (self["filelist"].canDescent()): + source = self["filelist"].getCurrentDirectory() + self["filelist"].getFilename() + self.session.openWithCallback(self.callbackCPmaniger, CPmaniger, source) + elif (self["filelist"].getSelectionIndex() != 0) and (self["filelist"].canDescent()): # NEW + source = self["filelist"].getSelection()[0] + self.session.openWithCallback(self.callbackCPmaniger, CPmaniger, source) + + def callbackCPmaniger(self, answer): + self["filelist"].refresh() + + def callbackSetStartDir(self, answerSD): + if answerSD is True: + config.plugins.DreamExplorer.startDir.value = self["filelist"].getSelection()[0] + config.plugins.DreamExplorer.startDir.save() + + def sortName(self): + list = self["filelist"].sortName() + try: + if self.MediaFilter: + self.setTitle(_("[sort by Name] ") + self["filelist"].getCurrentDirectory()) + else: + self.setTitle(_("[sort by Name] ") + self["filelist"].getCurrentDirectory()) + except: + self.setTitle(_("Dream-Explorer")) + + def sortDate(self): + list = self["filelist"].sortDate() + try: + if self.MediaFilter: + self.setTitle(_("[sort by Date] ") + self["filelist"].getCurrentDirectory()) + else: + self.setTitle(_("[sort by Date] ") + self["filelist"].getCurrentDirectory()) + except: + self.setTitle(_("Dream-Explorer")) + + def searchMusic(self): + slist = [] + foundIndex = 0 + index = 0 + files = os_listdir(self["filelist"].getCurrentDirectory()) + files.sort() + for name in files: + testname = name.lower() + if testname.endswith(".mp3") or name.endswith(".m4a") or name.endswith(".ogg") or name.endswith(".flac"): + slist.append((Item(text=name, filename=os_path.join(self["filelist"].getCurrentDirectory(), name)),)) + if self["filelist"].getFilename() == name: + foundIndex = index + index = index + 1 + return slist, foundIndex + + def explExit(self): + self.session.nav.playService(self.altservice) + try: + if self.MediaFilter: + config.plugins.DreamExplorer.MediaFilter.value = "on" + else: + config.plugins.DreamExplorer.MediaFilter.value = "off" + config.plugins.DreamExplorer.MediaFilter.save() + except: + pass + self.close() + + def CloseAndPlay(self): + try: + if self.MediaFilter: + config.plugins.DreamExplorer.MediaFilter.value = "on" + else: + config.plugins.DreamExplorer.MediaFilter.value = "off" + config.plugins.DreamExplorer.MediaFilter.save() + except: + pass + self.close() + + +# ####### DREAM-EXPLORER END ####################### class vEditor(Screen): - global HDSkn - if HDSkn: - if (getDesktop(0).size().width()) > 1030: - skin = """ - - - """ - else: - skin = """ - - - """ - else: - skin = """ - - - """ - - def __init__(self, session, file): - self.skin = vEditor.skin - Screen.__init__(self, session) - self.setTitle(_("File-Explorer")) - self.session = session - self.file_name = file - self.list = [] - self["filedata"] = MenuList(self.list) - self["actions"] = ActionMap(["WizardActions"], - { - "ok": self.editLine, - "back": self.exitEditor - }, -1) - self.selLine = None - self.oldLine = None - self.isChanged = False - self.GetFileData(file) - - def exitEditor(self): - if self.isChanged: - warningtext = _("\nhave been CHANGED! Do you want to save it?\n\nWARNING!") - warningtext = warningtext + _("\n\nThe Editor-Funktions are beta (not full tested) !!!") - warningtext = warningtext + _("\nThe author are NOT RESPONSIBLE\nfor DATA LOST OR DISORDERS !!!") - dei = self.session.openWithCallback(self.SaveFile, MessageBox, self.file_name + warningtext, MessageBox.TYPE_YESNO) - dei.setTitle(_("Dream-Explorer...")) - else: - self.close() - - def GetFileData(self, fx): - try: - flines = open(fx, "r") - for line in flines: - self.list.append(line) - flines.close() - self.setTitle(fx) - except: - pass - - def editLine(self): - try: - self.selLine = self["filedata"].getSelectionIndex() - self.oldLine = self.list[self.selLine] - editableText = self.list[self.selLine][:-1] - self.session.openWithCallback(self.callbackEditLine, vInputBox, title=_("old: ") + self.list[self.selLine], windowTitle=_("Edit line " + str(self.selLine + 1)), text=editableText) - except: - dei = self.session.open(MessageBox, _("This line is not editable!"), MessageBox.TYPE_ERROR) - dei.setTitle(_("Error...")) - - def callbackEditLine(self, newline): - if newline is not None: - for x in self.list: - if x == self.oldLine: - self.isChanged = True - self.list.remove(x) - self.list.insert(self.selLine, newline + '\n') - self.selLine = None - self.oldLine = None - - def SaveFile(self, answer): - if answer is True: - try: - eFile = open(self.file_name, "w") - for x in self.list: - eFile.writelines(x) - eFile.close() - except: - pass - self.close() - else: - self.close() + if HDSkn: + if (getDesktop(0).size().width()) > 1030: + skin = """ + + + """ + else: + skin = """ + + + """ + else: + skin = """ + + + """ + + def __init__(self, session, file): + self.skin = vEditor.skin + Screen.__init__(self, session) + self.setTitle(_("File-Explorer")) + self.session = session + self.file_name = file + self.list = [] + self["filedata"] = MenuList(self.list) + self["actions"] = ActionMap(["WizardActions"], + { + "ok": self.editLine, + "back": self.exitEditor + }, -1) + self.selLine = None + self.oldLine = None + self.isChanged = False + self.GetFileData(file) + + def exitEditor(self): + if self.isChanged: + warningtext = _("\nhave been CHANGED! Do you want to save it?\n\nWARNING!") + warningtext = warningtext + _("\n\nThe Editor-Funktions are beta (not full tested) !!!") + warningtext = warningtext + _("\nThe author are NOT RESPONSIBLE\nfor DATA LOST OR DISORDERS !!!") + dei = self.session.openWithCallback(self.SaveFile, MessageBox, self.file_name + warningtext, MessageBox.TYPE_YESNO) + dei.setTitle(_("Dream-Explorer...")) + else: + self.close() + + def GetFileData(self, fx): + try: + flines = open(fx, "r") + for line in flines: + self.list.append(line) + flines.close() + self.setTitle(fx) + except: + pass + + def editLine(self): + try: + self.selLine = self["filedata"].getSelectionIndex() + self.oldLine = self.list[self.selLine] + editableText = self.list[self.selLine][:-1] + self.session.openWithCallback(self.callbackEditLine, vInputBox, title=_("old: ") + self.list[self.selLine], windowTitle=_("Edit line " + str(self.selLine + 1)), text=editableText) + except: + dei = self.session.open(MessageBox, _("This line is not editable!"), MessageBox.TYPE_ERROR) + dei.setTitle(_("Error...")) + + def callbackEditLine(self, newline): + if newline is not None: + for x in self.list: + if x == self.oldLine: + self.isChanged = True + self.list.remove(x) + self.list.insert(self.selLine, newline + '\n') + self.selLine = None + self.oldLine = None + + def SaveFile(self, answer): + if answer is True: + try: + eFile = open(self.file_name, "w") + for x in self.list: + eFile.writelines(x) + eFile.close() + except: + pass + self.close() + else: + self.close() class MviExplorer(Screen): - skin = """ - - """ - - def __init__(self, session, file): - self.skin = MviExplorer.skin - Screen.__init__(self, session) - self.setTitle(_("mvi-Explorer")) - self.file_name = file - self["actions"] = ActionMap(["WizardActions"], - { - "ok": self.close, - "back": self.close - }, -1) - self.onLayoutFinish.append(self.showMvi) - - def showMvi(self): - os.system("/usr/bin/showiframe " + self.file_name) + skin = """ + + """ + + def __init__(self, session, file): + self.skin = MviExplorer.skin + Screen.__init__(self, session) + self.setTitle(_("mvi-Explorer")) + self.file_name = file + self["actions"] = ActionMap(["WizardActions"], + { + "ok": self.close, + "back": self.close + }, -1) + self.onLayoutFinish.append(self.showMvi) + + def showMvi(self): + os_system("/usr/bin/showiframe " + self.file_name) class PictureExplorerII(Screen): - global HDSkn - if HDSkn: - if (getDesktop(0).size().width()) > 1030: - skin = """ - - - - """ - else: - skin = """ - - - - """ - else: - skin = """ - - - - """ - - def __init__(self, session, whatPic=None, whatDir=None): - self.skin = PictureExplorerII.skin - Screen.__init__(self, session) - self.setTitle(_("Picture-Explorer")) - self.session = session - self.whatPic = whatPic - self.whatDir = whatDir - self.picList = [] - self.Pindex = 0 - self.EXscale = (AVSwitch().getFramebufferScale()) - self.EXpicload = ePicLoad() - self["Picture"] = Pixmap() - self["State"] = Label(_('loading... ') + self.whatPic) - self["actions"] = ActionMap(["WizardActions", "DirectionActions"], - { - "ok": self.info, - "back": self.close, - "up": self.info, - "down": self.close, - "left": self.Pleft, - "right": self.Pright - }, -1) - self.EXpicload.PictureData.get().append(self.DecodeAction) - self.onLayoutFinish.append(self.Show_Picture) - - def Show_Picture(self): - if self.whatPic is not None: - self.EXpicload.setPara([self["Picture"].instance.size().width(), self["Picture"].instance.size().height(), self.EXscale[0], self.EXscale[1], 0, 1, "#002C2C39"]) - self.EXpicload.startDecode(self.whatPic) - if self.whatDir is not None: - pidx = 0 - for root, dirs, files in os.walk(self.whatDir): - for name in files: - if name.endswith(".jpg") or name.endswith(".jpeg") or name.endswith(".Jpg") or name.endswith(".Jpeg") or name.endswith(".JPG") or name.endswith(".JPEG"): - self.picList.append(name) - if name in self.whatPic: - self.Pindex = pidx - pidx = pidx + 1 - files.sort() - - def DecodeAction(self, pictureInfo=""): - if self.whatPic is not None: - self["State"].setText(_("ready...")) - self["State"].visible = False - ptr = self.EXpicload.getData() - self["Picture"].instance.setPixmap(ptr) - - def Pright(self): - if len(self.picList) > 2: - if self.Pindex < (len(self.picList) - 1): - self.Pindex = self.Pindex + 1 - self.whatPic = self.whatDir + str(self.picList[self.Pindex]) - self["State"].visible = True - self["State"].setText(_('loading... ' + self.whatPic)) - self.EXpicload.startDecode(self.whatPic) - else: - self["State"].setText(_("wait...")) - self["State"].visible = False - self.session.open(MessageBox, _('No more picture-files.'), MessageBox.TYPE_INFO) - - def Pleft(self): - if len(self.picList) > 2: - if self.Pindex > 0: - self.Pindex = self.Pindex - 1 - self.whatPic = self.whatDir + str(self.picList[self.Pindex]) - self["State"].visible = True - self["State"].setText(_('loading... ') + self.whatPic) - self.EXpicload.startDecode(self.whatPic) - else: - self["State"].setText(_("wait...")) - self["State"].visible = False - self.session.open(MessageBox, _('No more picture-files.'), MessageBox.TYPE_INFO) - - def info(self): - if self["State"].visible: - self["State"].setText(_("wait...")) - self["State"].visible = False - else: - self["State"].visible = True - self["State"].setText(_(self.whatPic)) + if HDSkn: + if (getDesktop(0).size().width()) > 1030: + skin = """ + + + + """ + else: + skin = """ + + + + """ + else: + skin = """ + + + + """ + + def __init__(self, session, whatPic=None, whatDir=None): + self.skin = PictureExplorerII.skin + Screen.__init__(self, session) + self.setTitle(_("Picture-Explorer")) + self.session = session + self.whatPic = whatPic + self.whatDir = whatDir + self.picList = [] + self.Pindex = 0 + self.EXscale = (AVSwitch().getFramebufferScale()) + self.EXpicload = ePicLoad() + self["Picture"] = Pixmap() + self["State"] = Label(_('loading... ') + self.whatPic) + self["actions"] = ActionMap(["WizardActions", "DirectionActions"], + { + "ok": self.info, + "back": self.close, + "up": self.info, + "down": self.close, + "left": self.Pleft, + "right": self.Pright + }, -1) + self.EXpicload.PictureData.get().append(self.DecodeAction) + self.onLayoutFinish.append(self.Show_Picture) + + def Show_Picture(self): + if self.whatPic is not None: + self.EXpicload.setPara([self["Picture"].instance.size().width(), self["Picture"].instance.size().height(), self.EXscale[0], self.EXscale[1], 0, 1, "#002C2C39"]) + self.EXpicload.startDecode(self.whatPic) + if self.whatDir is not None: + pidx = 0 + for root, dirs, files in os_walk(self.whatDir): + for name in files: + if name.endswith(".jpg") or name.endswith(".jpeg") or name.endswith(".Jpg") or name.endswith(".Jpeg") or name.endswith(".JPG") or name.endswith(".JPEG"): + self.picList.append(name) + if name in self.whatPic: + self.Pindex = pidx + pidx = pidx + 1 + files.sort() + + def DecodeAction(self, pictureInfo=""): + if self.whatPic is not None: + self["State"].setText(_("ready...")) + self["State"].visible = False + ptr = self.EXpicload.getData() + self["Picture"].instance.setPixmap(ptr) + + def Pright(self): + if len(self.picList) > 2: + if self.Pindex < (len(self.picList) - 1): + self.Pindex = self.Pindex + 1 + self.whatPic = self.whatDir + str(self.picList[self.Pindex]) + self["State"].visible = True + self["State"].setText(_('loading... ' + self.whatPic)) + self.EXpicload.startDecode(self.whatPic) + else: + self["State"].setText(_("wait...")) + self["State"].visible = False + self.session.open(MessageBox, _('No more picture-files.'), MessageBox.TYPE_INFO) + + def Pleft(self): + if len(self.picList) > 2: + if self.Pindex > 0: + self.Pindex = self.Pindex - 1 + self.whatPic = self.whatDir + str(self.picList[self.Pindex]) + self["State"].visible = True + self["State"].setText(_('loading... ') + self.whatPic) + self.EXpicload.startDecode(self.whatPic) + else: + self["State"].setText(_("wait...")) + self["State"].visible = False + self.session.open(MessageBox, _('No more picture-files.'), MessageBox.TYPE_INFO) + + def info(self): + if self["State"].visible: + self["State"].setText(_("wait...")) + self["State"].visible = False + else: + self["State"].visible = True + self["State"].setText(_(self.whatPic)) class MoviePlayer(MP_parent): - def __init__(self, session, service): - self.session = session - self.WithoutStopClose = False - MP_parent.__init__(self, self.session, service) + def __init__(self, session, service): + self.session = session + self.WithoutStopClose = False + MP_parent.__init__(self, self.session, service) - def leavePlayer(self): - self.is_closing = True - self.close() + def leavePlayer(self): + self.is_closing = True + self.close() - def leavePlayerConfirmed(self, answer): - pass + def leavePlayerConfirmed(self, answer): + pass - def doEofInternal(self, playing): - if not self.execing: - return - if not playing: - return - self.leavePlayer() + def doEofInternal(self, playing): + if not self.execing: + return + if not playing: + return + self.leavePlayer() - def showMovies(self): - self.WithoutStopClose = True - self.close() + def showMovies(self): + self.WithoutStopClose = True + self.close() - def movieSelected(self, service): - self.leavePlayer(self.de_instance) + def movieSelected(self, service): + self.leavePlayer(self.de_instance) - def __onClose(self): - if not (self.WithoutStopClose): - self.session.nav.playService(self.lastservice) + def __onClose(self): + if not (self.WithoutStopClose): + self.session.nav.playService(self.lastservice) class MusicExplorer(MoviePlayer): - skin = """ - - - Remaining - - - Name - - """ - - def __init__(self, session, service, MusicDir, theFile): - self.session = session - MoviePlayer.__init__(self, session, service) - self.MusicDir = MusicDir - self.musicList = [] - self.Mindex = 0 - self.curFile = theFile - self.searchMusic() - self.onLayoutFinish.append(self.showMMI) - MoviePlayer.WithoutStopClose = False - - def showMMI(self): - os.system("/usr/bin/showiframe /usr/lib/enigma2/python/Plugins/Extensions/DreamExplorer/res/music.mvi") - - def searchMusic(self): - midx = 0 - for root, dirs, files in os.walk(self.MusicDir): - for name in files: - name = name.lower() - if name.endswith(".mp3") or name.endswith(".mp2") or name.endswith(".ogg") or name.endswith(".wav") or name.endswith(".flac") or name.endswith(".m4a"): - self.musicList.append(name) - if self.curFile in name: - self.Mindex = midx - midx = midx + 1 - - def seekFwd(self): - if len(self.musicList) > 2: - if self.Mindex < (len(self.musicList) - 1): - self.Mindex = self.Mindex + 1 - nextfile = self.MusicDir + str(self.musicList[self.Mindex]) - nextRef = eServiceReference("4097:0:0:0:0:0:0:0:0:0:" + nextfile) - self.session.nav.playService(nextRef) - else: - self.session.open(MessageBox, _('No more playable files.'), MessageBox.TYPE_INFO) - - def seekBack(self): - if len(self.musicList) > 2: - if self.Mindex > 0: - self.Mindex = self.Mindex - 1 - nextfile = self.MusicDir + str(self.musicList[self.Mindex]) - nextRef = eServiceReference("4097:0:0:0:0:0:0:0:0:0:" + nextfile) - self.session.nav.playService(nextRef) - else: - self.session.open(MessageBox, _('No more playable files.'), MessageBox.TYPE_INFO) - - def doEofInternal(self, playing): - if not self.execing: - return - if not playing: - return - self.seekFwd() + skin = """ + + + Remaining + + + Name + + """ + + def __init__(self, session, service, MusicDir, theFile): + self.session = session + MoviePlayer.__init__(self, session, service) + self.MusicDir = MusicDir + self.musicList = [] + self.Mindex = 0 + self.curFile = theFile + self.searchMusic() + self.onLayoutFinish.append(self.showMMI) + MoviePlayer.WithoutStopClose = False + + def showMMI(self): + os_system("/usr/bin/showiframe /usr/lib/enigma2/python/Plugins/Extensions/DreamExplorer/res/music.mvi") + + def searchMusic(self): + midx = 0 + for root, dirs, files in os_walk(self.MusicDir): + for name in files: + name = name.lower() + if name.endswith(".mp3") or name.endswith(".mp2") or name.endswith(".ogg") or name.endswith(".wav") or name.endswith(".flac") or name.endswith(".m4a"): + self.musicList.append(name) + if self.curFile in name: + self.Mindex = midx + midx = midx + 1 + + def seekFwd(self): + if len(self.musicList) > 2: + if self.Mindex < (len(self.musicList) - 1): + self.Mindex = self.Mindex + 1 + nextfile = self.MusicDir + str(self.musicList[self.Mindex]) + nextRef = eServiceReference("4097:0:0:0:0:0:0:0:0:0:" + nextfile) + self.session.nav.playService(nextRef) + else: + self.session.open(MessageBox, _('No more playable files.'), MessageBox.TYPE_INFO) + + def seekBack(self): + if len(self.musicList) > 2: + if self.Mindex > 0: + self.Mindex = self.Mindex - 1 + nextfile = self.MusicDir + str(self.musicList[self.Mindex]) + nextRef = eServiceReference("4097:0:0:0:0:0:0:0:0:0:" + nextfile) + self.session.nav.playService(nextRef) + else: + self.session.open(MessageBox, _('No more playable files.'), MessageBox.TYPE_INFO) + + def doEofInternal(self, playing): + if not self.execing: + return + if not playing: + return + self.seekFwd() def ScanSysem_str(): - try: - ret = "" - out_line = os.popen("uptime").readline() - ret = ret + "at" + out_line + "\n" - out_lines = [] - out_lines = os.popen("cat /proc/meminfo").readlines() - for lidx in range(len(out_lines) - 1): - tstLine = out_lines[lidx].split() - if "MemTotal:" in tstLine: - ret = ret + out_lines[lidx] - elif "MemFree:" in tstLine: - ret = ret + out_lines[lidx] + "\n" - out_lines = [] - out_lines = os.popen("cat /proc/stat").readlines() - for lidx in range(len(out_lines) - 1): - tstLine = out_lines[lidx].split() - if "procs_running" in tstLine: - ret = ret + _("Running processes: ") + tstLine[1] - return ret - except: - return "N/A" + try: + ret = "" + out_line = os_popen("uptime").readline() + ret = ret + "at" + out_line + "\n" + out_lines = [] + out_lines = os_popen("cat /proc/meminfo").readlines() + for lidx in range(len(out_lines) - 1): + tstLine = out_lines[lidx].split() + if "MemTotal:" in tstLine: + ret = ret + out_lines[lidx] + elif "MemFree:" in tstLine: + ret = ret + out_lines[lidx] + "\n" + out_lines = [] + out_lines = os_popen("cat /proc/stat").readlines() + for lidx in range(len(out_lines) - 1): + tstLine = out_lines[lidx].split() + if "procs_running" in tstLine: + ret = ret + _("Running processes: ") + tstLine[1] + return ret + except: + return "N/A" class vInputBox(InputBox): - vibnewx = str(getDesktop(0).size().width() - 80) - sknew = '\n' - sknew = sknew + '\n\n' - skin = sknew + vibnewx = str(getDesktop(0).size().width() - 80) + sknew = '\n' + sknew = sknew + '\n\n' + skin = sknew - def __init__(self, session, title="", windowTitle=_("Input"), useableChars=None, **kwargs): - InputBox.__init__(self, session, title, windowTitle, useableChars, **kwargs) + def __init__(self, session, title="", windowTitle=_("Input"), useableChars=None, **kwargs): + InputBox.__init__(self, session, title, windowTitle, useableChars, **kwargs) class CPmaniger(Screen): - global HDSkn - if HDSkn: - if (getDesktop(0).size().width()) > 1030: - skin = """ - - - - - - - - - """ - else: - skin = """ - - - - - - - - - """ - else: - skin = """ - - - - - - - - - """ - - def __init__(self, session, source="/tmp/none"): - self.skin = CPmaniger.skin - Screen.__init__(self, session) - self.setTitle(_("Select Copy/Move location...")) - self.sesion = session - self.src = source - self["File"] = Label(_("WARNING! they doing now COPY or MOVE\n") + source + _("\nto:")) - self["CPto"] = myFileList(config.plugins.DreamExplorer.CopyDest.value, showDirectories=True, showFiles=False, matchingPattern="^.*\.*", useServiceRef=False) - - self["key_red"] = StaticText(_("MOVE")) - self["key_yellow"] = StaticText(_("COPY")) - - self["actions"] = ActionMap(["WizardActions", "ColorActions"], - { - "ok": self.ok, - "back": self.NothingToDo, - "red": self.MoveFile, - "yellow": self.CopyFile - }, -1) - self.onLayoutFinish.append(self.OneDescent) - - def OneDescent(self): - if self["CPto"].canDescent(): - self["CPto"].descent() - - def ok(self): - if self["CPto"].canDescent(): - self["CPto"].descent() - - def NothingToDo(self): - self.close(" ") - - def CopyFile(self): - if self["CPto"].getSelectionIndex() != 0: - dest = self["CPto"].getSelection()[0] - if self.src[len(self.src) - 1] == '/': - order = 'cp -af \"' + self.src + '\" \"' + dest + '\"' - else: - order = 'cp \"' + self.src + '\" \"' + dest + '\"' - try: - config.plugins.DreamExplorer.CopyDest.value = dest - config.plugins.DreamExplorer.CopyDest.save() - os.system(order) - except: - dei = self.session.open(MessageBox, _("%s \nFAILED!") % order, MessageBox.TYPE_ERROR) - dei.setTitle(_("Dream-Explorer")) - self.close(" ") - - def MoveFile(self): - if self["CPto"].getSelectionIndex() != 0: - dest = self["CPto"].getSelection()[0] - if self.src[len(self.src) - 1] == '/': - order = 'cp -af \"' + self.src + '\" \"' + dest + '\"' - DELorder = 'rm -r \"' + self.src + '\"' - else: - order = 'cp \"' + self.src + '\" \"' + dest + '\"' - DELorder = 'rm -f \"' + self.src + '\"' - try: - config.plugins.DreamExplorer.CopyDest.value = dest - config.plugins.DreamExplorer.CopyDest.save() - os.system(order) - except: - dei = self.session.open(MessageBox, _("%s \nFAILED!") % order, MessageBox.TYPE_ERROR) - dei.setTitle(_("Dream-Explorer")) - try: - os.system(DELorder) - except: - dei = self.session.open(MessageBox, _("%s \nFAILED!") % DELorder, MessageBox.TYPE_ERROR) - dei.setTitle(_("Dream-Explorer")) - self.close(" ") + if HDSkn: + if (getDesktop(0).size().width()) > 1030: + skin = """ + + + + + + + + + """ + else: + skin = """ + + + + + + + + + """ + else: + skin = """ + + + + + + + + + """ + + def __init__(self, session, source="/tmp/none"): + self.skin = CPmaniger.skin + Screen.__init__(self, session) + self.setTitle(_("Select Copy/Move location...")) + self.sesion = session + self.src = source + self["File"] = Label(_("WARNING! they doing now COPY or MOVE\n") + source + _("\nto:")) + self["CPto"] = myFileList(config.plugins.DreamExplorer.CopyDest.value, showDirectories=True, showFiles=False, matchingPattern=r"^.*\.*", useServiceRef=False) + + self["key_red"] = StaticText(_("MOVE")) + self["key_yellow"] = StaticText(_("COPY")) + self["actions"] = ActionMap(["WizardActions", "ColorActions"], + { + "ok": self.ok, + "back": self.NothingToDo, + "red": self.MoveFile, + "yellow": self.CopyFile + }, -1) + self.onLayoutFinish.append(self.OneDescent) + + def OneDescent(self): + if self["CPto"].canDescent(): + self["CPto"].descent() + + def ok(self): + if self["CPto"].canDescent(): + self["CPto"].descent() + + def NothingToDo(self): + self.close(" ") + + def CopyFile(self): + if self["CPto"].getSelectionIndex() != 0: + dest = self["CPto"].getSelection()[0] + if self.src[len(self.src) - 1] == '/': + order = 'cp -af \"' + self.src + '\" \"' + dest + '\"' + else: + order = 'cp \"' + self.src + '\" \"' + dest + '\"' + try: + config.plugins.DreamExplorer.CopyDest.value = dest + config.plugins.DreamExplorer.CopyDest.save() + os_system(order) + except: + dei = self.session.open(MessageBox, _("%s \nFAILED!") % order, MessageBox.TYPE_ERROR) + dei.setTitle(_("Dream-Explorer")) + self.close(" ") + + def MoveFile(self): + if self["CPto"].getSelectionIndex() != 0: + dest = self["CPto"].getSelection()[0] + if self.src[len(self.src) - 1] == '/': + order = 'cp -af \"' + self.src + '\" \"' + dest + '\"' + DELorder = 'rm -r \"' + self.src + '\"' + else: + order = 'cp \"' + self.src + '\" \"' + dest + '\"' + DELorder = 'rm -f \"' + self.src + '\"' + try: + config.plugins.DreamExplorer.CopyDest.value = dest + config.plugins.DreamExplorer.CopyDest.save() + os_system(order) + except: + dei = self.session.open(MessageBox, _("%s \nFAILED!") % order, MessageBox.TYPE_ERROR) + dei.setTitle(_("Dream-Explorer")) + try: + os_system(DELorder) + except: + dei = self.session.open(MessageBox, _("%s \nFAILED!") % DELorder, MessageBox.TYPE_ERROR) + dei.setTitle(_("Dream-Explorer")) + self.close(" ") class SoftLinkScreen(Screen): - global HDSkn - if HDSkn: - if (getDesktop(0).size().width()) > 1030: - skin = """ - - - - - - - - - """ - else: - skin = """ - - - - - - - - - """ - else: - skin = """ - - - - - - - - - """ - - def __init__(self, session, source="/tmp/"): - self.skin = SoftLinkScreen.skin - Screen.__init__(self, session) - self.setTitle(_("Make a softlink...")) - self.sesion = session - self.src = source - self.newSLname = " " - self["File"] = Label(_("Set first the Softlink name ...")) - self["SLto"] = myFileList('/', showDirectories=True, showFiles=True, matchingPattern=None, useServiceRef=False) - - self["key_red"] = StaticText(_("Set name")) - self["key_yellow"] = StaticText(_("Make a softlink")) - - self["actions"] = ActionMap(["WizardActions", "ColorActions"], - { - "ok": self.ok, - "back": self.NothingToDo, - "red": self.GetSLname, - "yellow": self.MakeSLnow - }, -1) - - def GetSLname(self): - self.session.openWithCallback(self.callbackSetLinkName, vInputBox, title=_("Write the new softlink name here:"), windowTitle=_("Dream Explorer..."), text="newname") - - def callbackSetLinkName(self, answer): - if answer is None: - return - if (" " in answer) or (answer == ""): - dei = self.session.open(MessageBox, _("Softlink name error !"), MessageBox.TYPE_ERROR) - dei.setTitle(_("Dream-Explorer")) - return - else: - self.newSLname = self.src + answer - self["File"].setText(_("WARNING! they make now a softlink from\n") + self.newSLname + _("\nto:")) - - def ok(self): - if self["SLto"].canDescent(): - self["SLto"].descent() - - def NothingToDo(self): - self.close(" ") - - def MakeSLnow(self): - if self.newSLname != " ": - if self["SLto"].getSelectionIndex() != 0: - if self["SLto"].canDescent(): - order = 'ln -s \"' + self["SLto"].getSelection()[0] + '\" \"' + self.newSLname + '\"' - else: - order = 'ln -s \"' + (self["SLto"].getCurrentDirectory() + self["SLto"].getFilename()) + '\" \"' + self.newSLname + '\"' - os.system(order) - self.close(" ") - else: - dei = self.session.open(MessageBox, _("Softlink name error !"), MessageBox.TYPE_ERROR) - dei.setTitle(_("Dream-Explorer")) + if HDSkn: + if (getDesktop(0).size().width()) > 1030: + skin = """ + + + + + + + + + """ + else: + skin = """ + + + + + + + + + """ + else: + skin = """ + + + + + + + + + """ + + def __init__(self, session, source="/tmp/"): + self.skin = SoftLinkScreen.skin + Screen.__init__(self, session) + self.setTitle(_("Make a softlink...")) + self.sesion = session + self.src = source + self.newSLname = " " + self["File"] = Label(_("Set first the Softlink name ...")) + self["SLto"] = myFileList('/', showDirectories=True, showFiles=True, matchingPattern=None, useServiceRef=False) + + self["key_red"] = StaticText(_("Set name")) + self["key_yellow"] = StaticText(_("Make a softlink")) + self["actions"] = ActionMap(["WizardActions", "ColorActions"], + { + "ok": self.ok, + "back": self.NothingToDo, + "red": self.GetSLname, + "yellow": self.MakeSLnow + }, -1) + + def GetSLname(self): + self.session.openWithCallback(self.callbackSetLinkName, vInputBox, title=_("Write the new softlink name here:"), windowTitle=_("Dream Explorer..."), text="newname") + + def callbackSetLinkName(self, answer): + if answer is None: + return + if (" " in answer) or (answer == ""): + dei = self.session.open(MessageBox, _("Softlink name error !"), MessageBox.TYPE_ERROR) + dei.setTitle(_("Dream-Explorer")) + return + else: + self.newSLname = self.src + answer + self["File"].setText(_("WARNING! they make now a softlink from\n") + self.newSLname + _("\nto:")) + + def ok(self): + if self["SLto"].canDescent(): + self["SLto"].descent() + + def NothingToDo(self): + self.close(" ") + + def MakeSLnow(self): + if self.newSLname != " ": + if self["SLto"].getSelectionIndex() != 0: + if self["SLto"].canDescent(): + order = 'ln -s \"' + self["SLto"].getSelection()[0] + '\" \"' + self.newSLname + '\"' + else: + order = 'ln -s \"' + (self["SLto"].getCurrentDirectory() + self["SLto"].getFilename()) + '\" \"' + self.newSLname + '\"' + os_system(order) + self.close(" ") + else: + dei = self.session.open(MessageBox, _("Softlink name error !"), MessageBox.TYPE_ERROR) + dei.setTitle(_("Dream-Explorer")) From 2f19eeeffc69c7bf41426dfe866c7a65ffe84745 Mon Sep 17 00:00:00 2001 From: Belfagor2005 <72314956+Belfagor2005@users.noreply.github.com> Date: Sat, 27 Dec 2025 14:55:16 +0100 Subject: [PATCH 2/2] fix sort functions --- dreamexplorer/src/myFileList.py | 28 ++++++++++++++-------------- dreamexplorer/src/plugin.py | 5 ----- 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/dreamexplorer/src/myFileList.py b/dreamexplorer/src/myFileList.py index 883802f62..a2575d90a 100644 --- a/dreamexplorer/src/myFileList.py +++ b/dreamexplorer/src/myFileList.py @@ -1,21 +1,21 @@ ####################################################################### # -# Vali's File-List with some extendet functions -# based on FileList(Enigma-2) +# Vali's File-List with some extendet functions +# based on FileList(Enigma-2) # -# Coded by Vali (c)2009-2011 -# Main idea and getTSLength/getTSInfo/Sort functions by DarkVolli -# Support: www.dreambox-tools.info +# Coded by Vali (c)2009-2011 +# Main idea and getTSLength/getTSInfo/Sort functions by DarkVolli +# Support: www.dreambox-tools.info # -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. # -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # ####################################################################### @@ -369,7 +369,7 @@ def byDateFunc(self, a): return (0, float(os_stat(path).st_ctime)) except: pass - + # Fallback: use name return (1, self.byNameFunc(a)) diff --git a/dreamexplorer/src/plugin.py b/dreamexplorer/src/plugin.py index a0d21b045..a26a97955 100644 --- a/dreamexplorer/src/plugin.py +++ b/dreamexplorer/src/plugin.py @@ -16,7 +16,6 @@ # ####################################################################### -# for localized messages from Plugins.Plugin import PluginDescriptor from Screens.Screen import Screen from Screens.InfoBar import InfoBar @@ -32,7 +31,6 @@ from Components.Label import Label from Components.MenuList import MenuList from Components.Pixmap import Pixmap -# from Components.ScrollLabel import ScrollLabel from Components.config import config, ConfigSubsection, ConfigText from Components.Sources.StaticText import StaticText from Tools.Directories import fileExists, pathExists @@ -44,14 +42,12 @@ # from vInputBox import vInputBox from enigma import ( - # eConsoleAppContainer, eServiceReference, ePicLoad, getDesktop, eServiceCenter ) -# --- OS operations --- from os import ( system as os_system, stat as os_stat, @@ -63,7 +59,6 @@ listdir as os_listdir ) -# --- Time operations --- from time import ( strftime as time_strftime, localtime as time_localtime