X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/5acb8fc9d204c63e0da84142c570c5ca41424cae..3ad1f5540aa20e5b8132ededc367d8f319b2d5dd:/lib/python/Components/MovieList.py diff --git a/lib/python/Components/MovieList.py b/lib/python/Components/MovieList.py index ff047225..666067fc 100644 --- a/lib/python/Components/MovieList.py +++ b/lib/python/Components/MovieList.py @@ -25,25 +25,28 @@ RT_WRAP = 32 # | name of movie | # def MovieListEntry(serviceref, serviceHandler): - res = [ serviceref ] + if serviceref.flags & eServiceReference.mustDescent: + return None info = serviceHandler.info(serviceref) if info is None: # ignore service which refuse to info - return + return None len = info.getLength(serviceref) - if len: + if len > 0: len = "%d:%02d" % (len / 60, len % 60) 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 +74,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) @@ -89,6 +92,12 @@ class MovieList(HTMLComponent, GUIComponent): self.load(self.root) self.l.setList(self.list) + def removeService(self, service): + for l in self.list[:]: + if l[0][0] == service: + self.list.remove(l) + self.l.setList(self.list) + def load(self, root): # this lists our root service, then building a # nice list @@ -112,13 +121,17 @@ class MovieList(HTMLComponent, GUIComponent): # now process them... for ref in movieList: - self.list.append(MovieListEntry(ref, serviceHandler)) - + a = MovieListEntry(ref, serviceHandler) + if a is not None: + self.list.append(a) + + 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)