X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/5e0d91a196bfe872d04d676e5f6c2d5940786be0..19ce1123c780a9475e2f158712da6e73fa543e9c:/lib/python/Components/MovieList.py diff --git a/lib/python/Components/MovieList.py b/lib/python/Components/MovieList.py index 8e4fc043..ace36012 100644 --- a/lib/python/Components/MovieList.py +++ b/lib/python/Components/MovieList.py @@ -2,6 +2,7 @@ from GUIComponent import GUIComponent from Tools.FuzzyDate import FuzzyTime from ServiceReference import ServiceReference from Components.MultiContent import MultiContentEntryText +from Components.config import config from enigma import eListboxPythonMultiContent, eListbox, gFont, iServiceInformation, \ RT_HALIGN_LEFT, RT_HALIGN_RIGHT, eServiceReference, eServiceCenter @@ -10,19 +11,19 @@ class MovieList(GUIComponent): SORT_ALPHANUMERIC = 1 SORT_RECORDED = 2 - LISTTYPE_ORIGINAL = 0 - LISTTYPE_COMPACT_DESCRIPTION = 1 - LISTTYPE_COMPACT = 2 - LISTTYPE_MINIMAL = 3 + LISTTYPE_ORIGINAL = 1 + LISTTYPE_COMPACT_DESCRIPTION = 2 + LISTTYPE_COMPACT = 3 + LISTTYPE_MINIMAL = 4 - HIDE_DESCRIPTION = 0 - SHOW_DESCRIPTION = 1 + HIDE_DESCRIPTION = 1 + SHOW_DESCRIPTION = 2 - def __init__(self, root, list_type, sort_type, descr_state): + def __init__(self, root, list_type=None, sort_type=None, descr_state=None): GUIComponent.__init__(self) - self.list_type = list_type - self.descr_state = descr_state - self.sort_type = sort_type + self.list_type = list_type or self.LISTTYPE_ORIGINAL + self.descr_state = descr_state or self.HIDE_DESCRIPTION + self.sort_type = sort_type or self.SORT_RECORDED self.l = eListboxPythonMultiContent() self.tags = set() @@ -83,13 +84,19 @@ class MovieList(GUIComponent): if len <= 0: #recalc len when not already done cur_idx = self.l.getCurrentSelectionIndex() x = self.list[cur_idx] - len = x[1].getLength(x[0]) #recalc the movie length... + if config.usage.load_length_of_movies_in_moviellist.value: + len = x[1].getLength(x[0]) #recalc the movie length... + else: + len = 0 #dont recalc movielist to speedup loading the list self.list[cur_idx] = (x[0], x[1], x[2], len) #update entry in list... so next time we don't need to recalc if len > 0: len = "%d:%02d" % (len / 60, len % 60) else: - len = "?:??" + if config.usage.load_length_of_movies_in_moviellist.value: + len = "?:??" + else: + len = "X:XX" res = [ None ] @@ -153,6 +160,10 @@ class MovieList(GUIComponent): instance.setContent(self.l) instance.selectionChanged.get().append(self.selectionChanged) + def preWidgetRemove(self, instance): + instance.setContent(None) + instance.selectionChanged.get().remove(self.selectionChanged) + def reload(self, root = None, filter_tags = None): if root is not None: self.load(root, filter_tags) @@ -225,7 +236,7 @@ class MovieList(GUIComponent): ref = x[0] info = self.serviceHandler.info(ref) name = info and info.getName(ref) - return name and name.lower() or "" + return (name and name.lower() or "", -x[2]) def moveTo(self, serviceref): count = 0