From 55c37c32a8e3545266d50af73457e9e53932f3de Mon Sep 17 00:00:00 2001 From: Felix Domke Date: Fri, 13 Jan 2006 20:35:28 +0000 Subject: [PATCH] sort movie list --- lib/python/Components/MovieList.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/python/Components/MovieList.py b/lib/python/Components/MovieList.py index ff047225..25c32b66 100644 --- a/lib/python/Components/MovieList.py +++ b/lib/python/Components/MovieList.py @@ -25,8 +25,6 @@ RT_WRAP = 32 # | name of movie | # def MovieListEntry(serviceref, serviceHandler): - res = [ serviceref ] - info = serviceHandler.info(serviceref) if info is None: @@ -39,11 +37,13 @@ def MovieListEntry(serviceref, serviceHandler): else: len = "?:??" + begin = info.getInfo(serviceref, iServiceInformation.sTimeCreate) + res = [ (serviceref, begin) ] + res.append((0, 0, 0, 560, 30, 0, RT_HALIGN_LEFT, info.getName(serviceref))) description = info.getInfoString(serviceref, iServiceInformation.sDescription) - begin = info.getInfo(serviceref, iServiceInformation.sTimeCreate) - + begin_string = "" if begin > 0: t = FuzzyTime(begin) @@ -71,7 +71,7 @@ class MovieList(HTMLComponent, GUIComponent): return self.instance.getCurrentIndex() def getCurrent(self): - return self.l.getCurrentSelection() + return self.l.getCurrentSelection()[0] def GUIcreate(self, parent): self.instance = eListbox(parent) @@ -113,12 +113,14 @@ class MovieList(HTMLComponent, GUIComponent): # now process them... for ref in movieList: self.list.append(MovieListEntry(ref, serviceHandler)) - + + self.list.sort(key=lambda x: -x[0][1]) + def moveTo(self, serviceref): found = 0 count = 0 for x in self.list: - if str(ServiceReference(x[0])) == str(ServiceReference(serviceref)): + if str(ServiceReference(x[0][0])) == str(ServiceReference(serviceref)): found = count count += 1 self.instance.moveSelectionTo(found) -- 2.30.2