1 from HTMLComponent import *
2 from GUIComponent import *
3 from Tools.FuzzyDate import FuzzyTime
4 from ServiceReference import ServiceReference
6 from enigma import eListboxPythonMultiContent, eListbox, gFont, iServiceInformation
8 from enigma import eServiceReference, eServiceCenter, \
9 eServiceCenterPtr, iListableServicePtr, \
10 iStaticServiceInformationPtr
27 def MovieListEntry(serviceref, serviceHandler):
30 info = serviceHandler.info(serviceref)
33 # ignore service which refuse to info
36 len = info.getLength(serviceref)
38 len = "%d:%02d" % (len / 60, len % 60)
42 res.append((0, 0, 0, 560, 30, 0, RT_HALIGN_LEFT, info.getName(serviceref)))
44 description = info.getInfoString(serviceref, iServiceInformation.sDescription)
45 begin = info.getInfo(serviceref, iServiceInformation.sTimeCreate)
50 begin_string = t[0] + ", " + t[1]
52 res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 30, 560, 20, 1, RT_HALIGN_LEFT, description))
53 res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 50, 270, 20, 1, RT_HALIGN_LEFT, begin_string))
54 res.append((eListboxPythonMultiContent.TYPE_TEXT, 290, 50, 270, 20, 1, RT_HALIGN_RIGHT, len))
58 class MovieList(HTMLComponent, GUIComponent):
59 def __init__(self, root):
60 GUIComponent.__init__(self)
61 self.l = eListboxPythonMultiContent()
64 self.l.setFont(0, gFont("Regular", 30))
65 self.l.setFont(1, gFont("Regular", 18))
67 def moveToIndex(self, index):
68 self.instance.moveSelectionTo(index)
70 def getCurrentIndex(self):
71 return self.instance.getCurrentIndex()
74 return self.l.getCurrentSelection()
76 def GUIcreate(self, parent):
77 self.instance = eListbox(parent)
78 self.instance.setContent(self.l)
79 self.instance.setItemHeight(75)
82 self.instance.setContent(None)
85 def reload(self, root = None):
90 self.l.setList(self.list)
93 # this lists our root service, then building a
99 serviceHandler = eServiceCenter.getInstance()
100 list = serviceHandler.list(root)
103 raise "listing of movies failed"
113 # now process them...
114 for ref in movieList:
115 self.list.append(MovieListEntry(ref, serviceHandler))
117 def moveTo(self, serviceref):
121 if str(ServiceReference(x[0])) == str(ServiceReference(serviceref)):
124 self.instance.moveSelectionTo(found)
127 self.instance.moveSelection(self.instance.moveDown)