from Converter import Converter
from Poll import Poll
from enigma import iPlayableService
+from Components.Element import cached
class ServicePosition(Converter, Poll, object):
TYPE_LENGTH = 0,
s = self.source.service
return s and s.seek()
+ @cached
def getPosition(self):
seek = self.getSeek()
if seek is None:
return 0
return pos[1]
+ @cached
def getLength(self):
seek = self.getSeek()
if seek is None:
return 0
return length[1]
+ @cached
def getCutlist(self):
service = self.source.service
cue = service and service.cueSheet()
return cue and cue.getCutList()
+ @cached
def getText(self):
seek = self.getSeek()
if seek is None:
l = self.length - self.position
l /= 90000
- return "%d:%02d" % (l/60, l%60)
+
+ if l > 0:
+ sign = ""
+ else:
+ l = -l
+ sign = "-"
+
+ return sign + "%d:%02d" % (l/60, l%60)
position = property(getPosition)
length = property(getLength)