add lcd
[enigma2.git] / lib / python / Components / MovieList.py
index 4144353..ecf5060 100644 (file)
@@ -7,8 +7,6 @@ from enigma import eServiceReference, eServiceCenter, \
        eServiceCenterPtr, iListableServicePtr, \
        iStaticServiceInformationPtr
 
-
-
 RT_HALIGN_LEFT = 0
 RT_HALIGN_RIGHT = 1
 RT_HALIGN_CENTER = 2
@@ -27,17 +25,22 @@ RT_WRAP = 32
 def MovieListEntry(serviceref, serviceHandler):
        res = [ serviceref ]
 
-       info = iStaticServiceInformationPtr()
-
-       if serviceHandler.info(serviceref, info):
+       info = serviceHandler.info(serviceref)
+       
+       if info is None:
                # ignore service which refuse to info
-               del info
                return
        
+       len = info.getLength(serviceref)
+       if len:
+               len = "%d:%02d" % (len / 60, len % 60)
+       else:
+               len = "?:??"
+       
        res.append((0, 0, 400, 30, 0, RT_HALIGN_LEFT, info.getName(serviceref)))
        res.append((0, 30, 200, 20, 1, RT_HALIGN_LEFT, "Toller Film"))
        res.append((0, 50, 200, 20, 1, RT_HALIGN_LEFT, "Aufgenommen: irgendwann"))
-       res.append((200, 50, 200, 20, 1, RT_HALIGN_RIGHT, "1232MB"))
+       res.append((200, 50, 200, 20, 1, RT_HALIGN_RIGHT, len))
        
        return res
 
@@ -68,18 +71,16 @@ class MovieList(HTMLComponent, GUIComponent):
                
                self.list = [ ]
                
-               serviceHandler = eServiceCenterPtr()
-               eServiceCenter.getInstance(serviceHandler)
-               list = iListableServicePtr()
+               serviceHandler = eServiceCenter.getInstance()
+               list = serviceHandler.list(root)
                
-               if serviceHandler.list(root, list):
+               if list is None:
                        raise "listing of movies failed"
 
                movieList = [ ]
                while 1:
-                       s = eServiceReference()
-                       if list.getNext(s):
-                               del s
+                       s = list.getNext()
+                       if not s.valid():
                                del list
                                break
                        movieList.append(s)