Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions dreamexplorer/src/__init__.py
Original file line number Diff line number Diff line change
@@ -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


Expand Down
Binary file modified dreamexplorer/src/dreamexplorer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
144 changes: 82 additions & 62 deletions dreamexplorer/src/myFileList.py
Original file line number Diff line number Diff line change
@@ -1,70 +1,83 @@
#######################################################################
#
# 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.
#
#######################################################################

# 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):
Expand All @@ -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")
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Loading
Loading