aboutsummaryrefslogtreecommitdiff
path: root/lib/python
diff options
context:
space:
mode:
authorFelix Domke <tmbinc@elitedvb.net>2006-03-07 00:43:22 +0000
committerFelix Domke <tmbinc@elitedvb.net>2006-03-07 00:43:22 +0000
commitb66054905ad03ecc77b93119424c0a1b4401f548 (patch)
tree1968f84a9d4fc224dc2dba353553b5d5897114ec /lib/python
parentab5217c2155e480f54fb7762b9362772beda9775 (diff)
downloadenigma2-b66054905ad03ecc77b93119424c0a1b4401f548.tar.gz
enigma2-b66054905ad03ecc77b93119424c0a1b4401f548.zip
add TYPE_RELATIVE support for the ServicePosition component
Diffstat (limited to 'lib/python')
-rw-r--r--lib/python/Components/ServicePosition.py40
1 files changed, 28 insertions, 12 deletions
diff --git a/lib/python/Components/ServicePosition.py b/lib/python/Components/ServicePosition.py
index 349ee392..467a80e3 100644
--- a/lib/python/Components/ServicePosition.py
+++ b/lib/python/Components/ServicePosition.py
@@ -1,12 +1,12 @@
-from PerServiceDisplay import *
-from enigma import eTimer
-
-from enigma import iPlayableService, iSeekableServicePtr, ePositionGauge
+from PerServiceDisplay import PerServiceDisplay, PerServiceBase
+from enigma import eTimer, iPlayableService, iSeekableServicePtr, ePositionGauge
+import time
class ServicePosition(PerServiceDisplay):
TYPE_LENGTH = 0,
TYPE_POSITION = 1,
- TYPE_REMAINING = 2
+ TYPE_REMAINING = 2,
+ TYPE_RELATIVE = 3
def __init__(self, navcore, type):
self.updateTimer = eTimer()
@@ -17,6 +17,7 @@ class ServicePosition(PerServiceDisplay):
iPlayableService.evEnd: self.stopEvent
})
self.type = type
+ self.relative_base = 0
# self.setType(type)
def newService(self):
@@ -28,6 +29,9 @@ class ServicePosition(PerServiceDisplay):
self.updateTimer.start(500)
self.update()
+ def setRelative(self, rel):
+ self.relative_base = rel
+
def get(self, what):
service = self.navcore.getCurrentService()
seek = service and service.seek()
@@ -48,14 +52,26 @@ class ServicePosition(PerServiceDisplay):
seek = service.seek()
if seek is not None:
- if self.type == self.TYPE_LENGTH:
- l = self.get(self.TYPE_LENGTH)
- elif self.type == self.TYPE_POSITION:
- l = self.get(self.TYPE_POSITION)
- elif self.type == self.TYPE_REMAINING:
- l = self.get(self.TYPE_LENGTH) - self.get(self.TYPE_POSITION)
+ if self.type != self.TYPE_RELATIVE:
+ if self.type == self.TYPE_LENGTH:
+ l = self.get(self.TYPE_LENGTH)
+ elif self.type == self.TYPE_POSITION:
+ l = self.get(self.TYPE_POSITION)
+ elif self.type == self.TYPE_REMAINING:
+ l = self.get(self.TYPE_LENGTH) - self.get(self.TYPE_POSITION)
- self.setText("%d:%02d" % (l/60, l%60))
+ self.setText("%d:%02d" % (l/60, l%60))
+ else:
+ l = self.get(self.TYPE_POSITION)
+ if l != -1:
+ l += self.relative_base
+ t = time.localtime(l)
+ timestr = "%2d:%02d:%02d" % (t.tm_hour, t.tm_min, t.tm_sec)
+ else:
+ timestr = ""
+
+ self.setText(timestr)
+
self.updateTimer.start(500)
else:
self.updateTimer.start(10000)