1 from Converter import Converter
3 from enigma import iPlayableService
4 from Components.Element import cached
6 class ServicePosition(Converter, Poll, object):
12 def __init__(self, type):
14 Converter.__init__(self, type)
16 self.type = self.TYPE_LENGTH
17 elif type == "Position":
18 self.type = self.TYPE_POSITION
19 elif type == "Remaining":
20 self.type = self.TYPE_REMAINING
22 self.type = self.TYPE_GAUGE
24 self.poll_interval = 500
25 self.poll_enabled = self.type != self.TYPE_LENGTH
28 s = self.source.service
32 def getPosition(self):
36 pos = seek.getPlayPosition()
46 length = seek.getLength()
53 service = self.source.service
54 cue = service and service.cueSheet()
55 return cue and cue.getCutList()
63 if self.type == self.TYPE_LENGTH:
65 elif self.type == self.TYPE_POSITION:
67 elif self.type == self.TYPE_REMAINING:
68 l = self.length - self.position
78 return sign + "%d:%02d" % (l/60, l%60)
80 position = property(getPosition)
81 length = property(getLength)
82 cutlist = property(getCutlist)
83 text = property(getText)
85 def changed(self, what):
86 cutlist_refresh = what[0] != self.CHANGED_SPECIFIC or what[1] in [iPlayableService.evCuesheetChanged]
87 time_refresh = what[0] == self.CHANGED_POLL or what[0] == self.CHANGED_SPECIFIC and what[1] in [iPlayableService.evCuesheetChanged]
90 if self.type == self.TYPE_GAUGE:
91 self.downstream_elements.cutlist_changed()
94 self.downstream_elements.changed(what)