aboutsummaryrefslogtreecommitdiff
path: root/lib/python
diff options
context:
space:
mode:
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>2007-08-02 16:00:23 +0000
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>2007-08-02 16:00:23 +0000
commit432e8eb47c99b0a953c33c01d7f4d222c747228c (patch)
tree59ad21448ee19b62948d786dbbed272ec1b14109 /lib/python
parent8f957309b2bfb7df00c123f91ebb6d1d302848ba (diff)
downloadenigma2-432e8eb47c99b0a953c33c01d7f4d222c747228c.tar.gz
enigma2-432e8eb47c99b0a953c33c01d7f4d222c747228c.zip
add new converter (useable to get movie creation time and duration)
Diffstat (limited to 'lib/python')
-rw-r--r--lib/python/Components/Converter/Makefile.am2
-rw-r--r--lib/python/Components/Converter/ServiceTime.py38
2 files changed, 39 insertions, 1 deletions
diff --git a/lib/python/Components/Converter/Makefile.am b/lib/python/Components/Converter/Makefile.am
index d525c0ae..81dfdd4d 100644
--- a/lib/python/Components/Converter/Makefile.am
+++ b/lib/python/Components/Converter/Makefile.am
@@ -4,4 +4,4 @@ install_PYTHON = \
__init__.py ClockToText.py Converter.py EventName.py StaticText.py EventTime.py \
Poll.py RemainingToText.py StringList.py ServiceName.py FrontendInfo.py ServiceInfo.py \
ConditionalShowHide.py ServicePosition.py ValueRange.py RdsInfo.py Streaming.py \
- StaticMultiList.py
+ StaticMultiList.py ServiceTime.py
diff --git a/lib/python/Components/Converter/ServiceTime.py b/lib/python/Components/Converter/ServiceTime.py
new file mode 100644
index 00000000..16bcae3a
--- /dev/null
+++ b/lib/python/Components/Converter/ServiceTime.py
@@ -0,0 +1,38 @@
+from Converter import Converter
+from Components.Element import cached
+from enigma import iServiceInformation
+
+class ServiceTime(Converter, object):
+ STARTTIME = 0
+ ENDTIME = 1
+ DURATION = 2
+
+ def __init__(self, type):
+ Converter.__init__(self, type)
+ if type == "EndTime":
+ self.type = self.ENDTIME
+ elif type == "StartTime":
+ self.type = self.STARTTIME
+ elif type == "Duration":
+ self.type = self.DURATION
+ else:
+ raise str("'%s' is not <StartTime|EndTime|Duration> for eEventTime converter" % type)
+
+ @cached
+ def getTime(self):
+ service = self.source.service
+ info = self.source.info
+
+ if not info or not service:
+ return None
+
+ if self.type == self.STARTTIME:
+ return info.getInfo(service, iServiceInformation.sTimeCreate)
+ elif self.type == self.ENDTIME:
+ begin = info.getInfo(service, iServiceInformation.sTimeCreate)
+ len = info.getLength(service)
+ return begin + len
+ elif self.type == self.DURATION:
+ return info.getLength(service)
+
+ time = property(getTime)