1 from PerServiceDisplay import *
2 from enigma import eTimer
5 from enigma import pNavigation, iSeekableServicePtr
7 class ServicePosition(PerServiceDisplay):
12 def __init__(self, navcore, type):
13 self.updateTimer = eTimer()
14 self.updateTimer.timeout.get().append(self.update)
15 PerServiceDisplay.__init__(self, navcore,
17 pNavigation.evNewService: self.newService,
18 pNavigation.evStopService: self.stopEvent
24 self.setType(self.type)
26 def setType(self, type):
29 seek = iSeekableServicePtr()
30 service = self.navcore.getCurrentService()
32 self.updateTimer.stop()
38 if self.type != self.TYPE_LENGTH:
39 self.updateTimer.start(500)
41 self.length = self.get(self.TYPE_LENGTH)
47 service = self.navcore.getCurrentService()
52 if what == self.TYPE_LENGTH:
54 elif what == self.TYPE_POSITION:
55 r = seek.getPlayPosition()
63 if self.type == self.TYPE_LENGTH:
65 elif self.type == self.TYPE_POSITION:
66 l = self.get(self.TYPE_POSITION)
67 elif self.type == self.TYPE_REMAINING:
68 l = self.length - self.get(self.TYPE_POSITION)
70 self.setText("%d:%02d" % (l/60, l%60))
75 self.updateTimer.stop()