From 2cacfb04d1bff4047534b63618c3744346f65fd5 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Mon, 3 Apr 2006 08:12:07 +0000 Subject: faster loading of movie list (done by initially not loading the file length and updating the file lengths after displaying the list in the background (timer driven)) --- lib/python/Components/MovieList.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'lib/python/Components/MovieList.py') diff --git a/lib/python/Components/MovieList.py b/lib/python/Components/MovieList.py index a921b8df..681dec2b 100644 --- a/lib/python/Components/MovieList.py +++ b/lib/python/Components/MovieList.py @@ -13,7 +13,7 @@ from enigma import eServiceReference, eServiceCenter, \ # # | name of movie | # -def MovieListEntry(serviceref, serviceHandler): +def MovieListEntry(serviceref, serviceHandler, withLength = False): if serviceref.flags & eServiceReference.mustDescent: return None @@ -23,7 +23,10 @@ def MovieListEntry(serviceref, serviceHandler): # ignore service which refuse to info return None - len = info.getLength(serviceref) + if withLength: + len = info.getLength(serviceref) + else: + len = 0 if len > 0: len = "%d:%02d" % (len / 60, len % 60) else: @@ -91,6 +94,14 @@ class MovieList(HTMLComponent, GUIComponent): self.list.remove(l) self.l.setList(self.list) + def __len__(self): + return len(self.list) + + def updateLengthOfIndex(self, index): + serviceHandler = eServiceCenter.getInstance() + self.list[index] = MovieListEntry(self.list[index][0][0], serviceHandler, True) + self.l.invalidateEntry(index) + def load(self, root): # this lists our root service, then building a # nice list -- cgit v1.2.3