from HTMLComponent import *
from GUIComponent import *
+from Tools.FuzzyDate import FuzzyTime
+from ServiceReference import ServiceReference
-from enigma import eListboxPythonMultiContent, eListbox, gFont
+from enigma import eListboxPythonMultiContent, eListbox, gFont, iServiceInformation
from enigma import eServiceReference, eServiceCenter, \
eServiceCenterPtr, iListableServicePtr, \
iStaticServiceInformationPtr
-
-
RT_HALIGN_LEFT = 0
RT_HALIGN_RIGHT = 1
RT_HALIGN_CENTER = 2
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)
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, len))
+ 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)
+ begin_string = t[0] + ", " + t[1]
+
+ res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 30, 560, 20, 1, RT_HALIGN_LEFT, description))
+ res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 50, 270, 20, 1, RT_HALIGN_LEFT, begin_string))
+ res.append((eListboxPythonMultiContent.TYPE_TEXT, 290, 50, 270, 20, 1, RT_HALIGN_RIGHT, len))
return res
def __init__(self, root):
GUIComponent.__init__(self)
self.l = eListboxPythonMultiContent()
- self.load(root)
- self.l.setList(self.list)
- self.l.setFont(0, gFont("Arial", 30))
- self.l.setFont(1, gFont("Arial", 18))
-
+ if root is not None:
+ self.reload(root)
+ self.l.setFont(0, gFont("Regular", 30))
+ self.l.setFont(1, gFont("Regular", 18))
+
+ def moveToIndex(self, index):
+ self.instance.moveSelectionTo(index)
+
+ def getCurrentIndex(self):
+ return self.instance.getCurrentIndex()
+
def getCurrent(self):
return self.l.getCurrentSelection()
self.instance.setContent(None)
self.instance = None
+ def reload(self, root = None):
+ if root is not None:
+ self.load(root)
+ else:
+ self.load(self.root)
+ self.l.setList(self.list)
+
def load(self, root):
# this lists our root service, then building a
# nice list
self.list = [ ]
+ self.root = root
- 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)
# now process them...
for ref in movieList:
self.list.append(MovieListEntry(ref, serviceHandler))
+
+ def moveTo(self, serviceref):
+ found = 0
+ count = 0
+ for x in self.list:
+ if str(ServiceReference(x[0])) == str(ServiceReference(serviceref)):
+ found = count
+ count += 1
+ self.instance.moveSelectionTo(found)
+
+ def moveDown(self):
+ self.instance.moveSelection(self.instance.moveDown)