aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Components/Converter/RemainingToText.py
diff options
context:
space:
mode:
authorFraxinas <andreas.frisch@multimedia-labs.de>2008-12-14 01:22:59 +0100
committerFraxinas <andreas.frisch@multimedia-labs.de>2008-12-14 01:22:59 +0100
commit56ac7a4a764a4251a851778df09967405aa9a930 (patch)
tree43ec1be37fefc1ac4a6e03bb51e43b5f579ec9cc /lib/python/Components/Converter/RemainingToText.py
parent5b4292943b2cf011b19929aa19c85a939cc72714 (diff)
parentb833353b5285a547eb18c079aa860c9ee2765d6e (diff)
downloadenigma2-56ac7a4a764a4251a851778df09967405aa9a930.tar.gz
enigma2-56ac7a4a764a4251a851778df09967405aa9a930.zip
Merge branch 'master' of fraxinas@git.opendreambox.org:/git/enigma2
Diffstat (limited to 'lib/python/Components/Converter/RemainingToText.py')
-rw-r--r--lib/python/Components/Converter/RemainingToText.py34
1 files changed, 29 insertions, 5 deletions
diff --git a/lib/python/Components/Converter/RemainingToText.py b/lib/python/Components/Converter/RemainingToText.py
index adefe9cf..4249e30a 100644
--- a/lib/python/Components/Converter/RemainingToText.py
+++ b/lib/python/Components/Converter/RemainingToText.py
@@ -2,19 +2,43 @@ from Components.Converter.Converter import Converter
from Components.Element import cached
class RemainingToText(Converter, object):
+ DEFAULT = 0
+ WITH_SECONDS = 1
+ NO_SECONDS = 2
+
def __init__(self, type):
Converter.__init__(self, type)
+ if type == "WithSeconds":
+ self.type = self.WITH_SECONDS
+ elif type == "NoSeconds":
+ self.type = self.NO_SECONDS
+ else:
+ self.type = self.DEFAULT
@cached
def getText(self):
- r = self.source.time
- if r is None:
+ time = self.source.time
+ if time is None:
return ""
(duration, remaining) = self.source.time
- if remaining is not None:
- return "+%d min" % (remaining / 60)
+
+ if self.type == self.WITH_SECONDS:
+ if remaining is not None:
+ return "%d:%02d:%02d" % (remaining / 3600, (remaining / 60) - ((remaining / 3600) * 60), remaining % 60)
+ else:
+ return "%02d:%02d:%02d" % (duration / 3600, (duration / 60) - ((duration / 3600) * 60), duration % 60)
+ elif self.type == self.NO_SECONDS:
+ if remaining is not None:
+ 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.DEFAULT:
+ if remaining is not None:
+ return "+%d min" % (remaining / 60)
+ else:
+ return "%d min" % (duration / 60)
else:
- return "%d min" % (duration / 60)
+ return "???"
text = property(getText)