1 from Converter import Converter
3 from enigma import iPlayableService
4 from Components.Element import cached
6 class ServicePosition(Converter, Poll, object):
11 TYPE_POSITION_DETAILED = 4
13 def __init__(self, type):
15 Converter.__init__(self, type)
17 self.poll_interval = 500
20 self.type = self.TYPE_LENGTH
21 elif type == "Position":
22 self.type = self.TYPE_POSITION
23 elif type == "PositionDetailed":
24 self.type = self.TYPE_POSITION_DETAILED
25 self.poll_interval = 100
26 elif type == "Remaining":
27 self.type = self.TYPE_REMAINING
29 self.type = self.TYPE_GAUGE
31 self.poll_enabled = self.type != self.TYPE_LENGTH
34 s = self.source.service
38 def getPosition(self):
42 pos = seek.getPlayPosition()
52 length = seek.getLength()
59 service = self.source.service
60 cue = service and service.cueSheet()
61 return cue and cue.getCutList()
69 if self.type == self.TYPE_LENGTH:
71 elif self.type in [self.TYPE_POSITION, self.TYPE_POSITION_DETAILED]:
73 elif self.type == self.TYPE_REMAINING:
74 l = self.length - self.position
76 if self.type != self.TYPE_POSITION_DETAILED:
85 if self.type != self.TYPE_POSITION_DETAILED:
86 return sign + "%d:%02d" % (l/60, l%60)
88 return sign + "%d:%02d:%03d" % ((l/60/90000), (l/90000)%60, (l%90000)/90)
90 position = property(getPosition)
91 length = property(getLength)
92 cutlist = property(getCutlist)
93 text = property(getText)
95 def changed(self, what):
96 cutlist_refresh = what[0] != self.CHANGED_SPECIFIC or what[1] in [iPlayableService.evCuesheetChanged]
97 time_refresh = what[0] == self.CHANGED_POLL or what[0] == self.CHANGED_SPECIFIC and what[1] in [iPlayableService.evCuesheetChanged]
100 if self.type == self.TYPE_GAUGE:
101 self.downstream_elements.cutlist_changed()
104 self.downstream_elements.changed(what)