From 17647e30993cc20d8f94f2de4a0bc78ce6b593cb Mon Sep 17 00:00:00 2001 From: Felix Domke Date: Wed, 17 Aug 2005 02:14:32 +0000 Subject: [PATCH] - add ServicePosition --- lib/python/Components/Makefile.am | 3 +- lib/python/Components/ServicePosition.py | 48 ++++++++++++++++++++++++ lib/python/Components/__init__.py | 2 +- 3 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 lib/python/Components/ServicePosition.py diff --git a/lib/python/Components/Makefile.am b/lib/python/Components/Makefile.am index e0849620..969077aa 100644 --- a/lib/python/Components/Makefile.am +++ b/lib/python/Components/Makefile.am @@ -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 \ - InputDevice.py + InputDevice.py ServicePosition.py + diff --git a/lib/python/Components/ServicePosition.py b/lib/python/Components/ServicePosition.py new file mode 100644 index 00000000..1795637e --- /dev/null +++ b/lib/python/Components/ServicePosition.py @@ -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(""); diff --git a/lib/python/Components/__init__.py b/lib/python/Components/__init__.py index 9f15abd4..8453ced5 100644 --- a/lib/python/Components/__init__.py +++ b/lib/python/Components/__init__.py @@ -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", - "components", "config", "TimerList", "TimeInput", "MovieList" ] + "components", "config", "TimerList", "TimeInput", "MovieList", "ServicePosition" ] -- 2.30.2