- add ServicePosition
authorFelix Domke <tmbinc@elitedvb.net>
Wed, 17 Aug 2005 02:14:32 +0000 (02:14 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Wed, 17 Aug 2005 02:14:32 +0000 (02:14 +0000)
lib/python/Components/Makefile.am
lib/python/Components/ServicePosition.py [new file with mode: 0644]
lib/python/Components/__init__.py

index e08496204126fcc1d4e63cd6984244eb902b8efd..969077aab4c52ab01c6e1c580dc9d8017e977299 100644 (file)
@@ -7,4 +7,5 @@ install_DATA = \
        ConfigList.py Header.py ServiceName.py VariableValue.py                 \
        EventInfo.py Label.py ServiceScan.py VolumeBar.py                       \
        GUIComponent.py MenuList.py TextInput.py __init__.py MovieList.py       \
        ConfigList.py Header.py ServiceName.py VariableValue.py                 \
        EventInfo.py Label.py ServiceScan.py VolumeBar.py                       \
        GUIComponent.py MenuList.py TextInput.py __init__.py MovieList.py       \
-       InputDevice.py
+       InputDevice.py ServicePosition.py
+       
diff --git a/lib/python/Components/ServicePosition.py b/lib/python/Components/ServicePosition.py
new file mode 100644 (file)
index 0000000..1795637
--- /dev/null
@@ -0,0 +1,48 @@
+from PerServiceDisplay import *
+from enigma import eTimer
+
+
+from enigma import pNavigation, iSeekableServicePtr
+
+class ServicePosition(PerServiceDisplay):
+       def __init__(self, navcore):
+               self.updateTimer = eTimer()
+               self.updateTimer.timeout.get().append(self.update)
+               PerServiceDisplay.__init__(self, navcore,
+                       {
+                               pNavigation.evNewService: self.newService,
+                               pNavigation.evStopService: self.stopEvent
+                       })
+
+       def newService(self):
+               seek = iSeekableServicePtr()
+               service = self.navcore.getCurrentService()
+               
+               self.updateTimer.stop()
+               
+               if service != None:
+                       if not service.seek(seek):
+                               self.updateTimer.start(500)
+               
+       
+       def update(self):
+               seek = iSeekableServicePtr()
+               service = self.navcore.getCurrentService()
+               
+               l = -1
+               
+               if service != None:
+                       if not service.seek(seek):
+                               # r = seek.getLength()
+                               r = seek.getPlayPosition()
+                               if not r[0]:
+                                       l = r[1] / 90000
+
+               if l != -1:
+                       self.setText("%d:%02d" % (l/60, l%60))
+               else:
+                       self.setText("-:--")
+       
+       def stopEvent(self):
+               self.updateTimer.stop()
+               self.setText("");
index 9f15abd41b78c9833aed4f14eda5851af80e7dae..8453ced56daaf08cd729fd3e3fe19a745b35bcb3 100644 (file)
@@ -3,5 +3,5 @@ __all__ = ["ActionMap", "Button", "Clock", "ConfigList", "EventInfo",
        "GUIComponent", "GUISkin", "HTMLComponent", "HTMLSkin", "Header",
        "Label", "MenuList", "PerServiceDisplay", "ProgressBar", "ServiceList",
        "ServiceName", "ServiceScan", "VariableText", "VariableValue", "VolumeBar",
        "GUIComponent", "GUISkin", "HTMLComponent", "HTMLSkin", "Header",
        "Label", "MenuList", "PerServiceDisplay", "ProgressBar", "ServiceList",
        "ServiceName", "ServiceScan", "VariableText", "VariableValue", "VolumeBar",
-       "components", "config", "TimerList", "TimeInput", "MovieList" ]
+       "components", "config", "TimerList", "TimeInput", "MovieList", "ServicePosition" ]