just recalc length of visible entries in movie selection
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Mon, 9 Jul 2007 23:14:46 +0000 (23:14 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Mon, 9 Jul 2007 23:14:46 +0000 (23:14 +0000)
lib/python/Components/MovieList.py
lib/python/Screens/MovieSelection.py

index c3ec1b1..45a34fb 100644 (file)
@@ -26,6 +26,12 @@ class MovieList(GUIComponent):
                if serviceref.flags & eServiceReference.mustDescent:
                        return None
 
                if serviceref.flags & eServiceReference.mustDescent:
                        return None
 
+               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...
+                       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:
                if len > 0:
                        len = "%d:%02d" % (len / 60, len % 60)
                else:
@@ -86,12 +92,6 @@ class MovieList(GUIComponent):
        def __len__(self):
                return len(self.list)
 
        def __len__(self):
                return len(self.list)
 
-       def updateLengthOfIndex(self, index):
-               if len(self.list) > index:
-                       x = self.list[index]
-                       self.list[index] = (x[0], x[1], x[2], x[1].getLength(x[0]))
-                       self.l.invalidateEntry(index)
-
        def load(self, root, filter_tags):
                # this lists our root service, then building a 
                # nice list
        def load(self, root, filter_tags):
                # this lists our root service, then building a 
                # nice list
index ac0ca37..ab36add 100644 (file)
@@ -110,9 +110,6 @@ class MovieSelection(Screen):
                        })
                self["actions"].csel = self
                self.onShown.append(self.go)
                        })
                self["actions"].csel = self
                self.onShown.append(self.go)
-               
-               self.lengthTimer = eTimer()
-               self.lengthTimer.timeout.get().append(self.updateLengthData)
                self.inited = False
 
        def showEventInformation(self):
                self.inited = False
 
        def showEventInformation(self):
@@ -139,12 +136,6 @@ class MovieSelection(Screen):
 
                self.updateTags()
 
 
                self.updateTags()
 
-       def updateLengthData(self):
-               self.list.updateLengthOfIndex(self.lengthPosition)
-               self.lengthPosition += 1
-               if self.lengthPosition < self.lengthLength:
-                       self.lengthTimer.start(10, 1)
-
        def moveTo(self):
                self["list"].moveTo(self.selectedmovie)
 
        def moveTo(self):
                self["list"].moveTo(self.selectedmovie)
 
@@ -152,7 +143,6 @@ class MovieSelection(Screen):
                return self["list"].getCurrent()
 
        def movieSelected(self):
                return self["list"].getCurrent()
 
        def movieSelected(self):
-               self.lengthTimer.stop()
                current = self.getCurrent()
                if current is not None:
                        self.close(current)
                current = self.getCurrent()
                if current is not None:
                        self.close(current)
@@ -197,15 +187,9 @@ class MovieSelection(Screen):
 
        def reloadList(self):
                self["list"].reload(self.current_ref, self.selected_tags)
 
        def reloadList(self):
                self["list"].reload(self.current_ref, self.selected_tags)
-               self.lengthTimer.start(10, 1)
-               self.lengthPosition = 0
-               self.lengthLength = len(self["list"])
-               
                title = _("Recorded files...")
                title = _("Recorded files...")
-               
                if self.selected_tags is not None:
                        title += " - " + ','.join(self.selected_tags)
                if self.selected_tags is not None:
                        title += " - " + ','.join(self.selected_tags)
-               
                self.setTitle(title)
 
        def showAll(self):
                self.setTitle(title)
 
        def showAll(self):