aboutsummaryrefslogtreecommitdiff
path: root/lib/python
diff options
context:
space:
mode:
authorFelix Domke <tmbinc@elitedvb.net>2009-04-23 22:35:25 +0200
committerFelix Domke <tmbinc@elitedvb.net>2009-04-23 22:35:25 +0200
commitadad9e85aa49169991a7edffbbc01479e8761a82 (patch)
tree5ec2b92c57ac4408335ad5e4a003180d8e7cdcd8 /lib/python
parent11e416ae02c53daa3841096e9792804f3d0e51dd (diff)
downloadenigma2-adad9e85aa49169991a7edffbbc01479e8761a82.tar.gz
enigma2-adad9e85aa49169991a7edffbbc01479e8761a82.zip
Patch by Stephan Reicholf: Display time as unix timestamp, remaining time in seconds
Diffstat (limited to 'lib/python')
-rw-r--r--lib/python/Components/Converter/ClockToText.py6
-rw-r--r--lib/python/Components/Converter/RemainingToText.py8
2 files changed, 14 insertions, 0 deletions
diff --git a/lib/python/Components/Converter/ClockToText.py b/lib/python/Components/Converter/ClockToText.py
index 109f9125..8ef98742 100644
--- a/lib/python/Components/Converter/ClockToText.py
+++ b/lib/python/Components/Converter/ClockToText.py
@@ -9,6 +9,7 @@ class ClockToText(Converter, object):
DATE = 3
FORMAT = 4
AS_LENGTH = 5
+ TIMESTAMP = 6
# add: date, date as string, weekday, ...
# (whatever you need!)
@@ -23,6 +24,8 @@ class ClockToText(Converter, object):
self.type = self.DATE
elif type == "AsLength":
self.type = self.AS_LENGTH
+ elif type == "Timestamp":
+ self.type = self.TIMESTAMP
elif str(type).find("Format") != -1:
self.type = self.FORMAT
self.fmt_string = type[7:]
@@ -40,6 +43,8 @@ class ClockToText(Converter, object):
return "%d min" % (time / 60)
elif self.type == self.AS_LENGTH:
return "%d:%02d" % (time / 60, time % 60)
+ elif self.type == self.TIMESTAMP:
+ return str(time)
t = localtime(time)
@@ -57,6 +62,7 @@ class ClockToText(Converter, object):
return str(s1+s2)
else:
return strftime(self.fmt_string, t)
+
else:
return "???"
diff --git a/lib/python/Components/Converter/RemainingToText.py b/lib/python/Components/Converter/RemainingToText.py
index 4249e30a..66897579 100644
--- a/lib/python/Components/Converter/RemainingToText.py
+++ b/lib/python/Components/Converter/RemainingToText.py
@@ -5,6 +5,7 @@ class RemainingToText(Converter, object):
DEFAULT = 0
WITH_SECONDS = 1
NO_SECONDS = 2
+ IN_SECONDS = 3
def __init__(self, type):
Converter.__init__(self, type)
@@ -12,6 +13,8 @@ class RemainingToText(Converter, object):
self.type = self.WITH_SECONDS
elif type == "NoSeconds":
self.type = self.NO_SECONDS
+ elif type == "InSeconds":
+ self.type = self.IN_SECONDS
else:
self.type = self.DEFAULT
@@ -33,6 +36,11 @@ class RemainingToText(Converter, object):
return "+%d:%02d" % (remaining / 3600, (remaining / 60) - ((remaining / 3600) * 60))
else:
return "%02d:%02d" % (duration / 3600, (duration / 60) - ((duration / 3600) * 60))
+ elif self.type == self.IN_SECONDS:
+ if remaining is not None:
+ return str(remaining)
+ else:
+ return str(duration)
elif self.type == self.DEFAULT:
if remaining is not None:
return "+%d min" % (remaining / 60)