diff options
| author | Felix Domke <tmbinc@elitedvb.net> | 2009-02-11 12:52:48 +0100 |
|---|---|---|
| committer | Felix Domke <tmbinc@elitedvb.net> | 2009-02-11 12:52:48 +0100 |
| commit | bbfcb7ea1f040d030277e2b6f2efa9ea0967bf2b (patch) | |
| tree | c5945c791698c14723e989449e6b4bfcc275c05d /lib/python/Components/Converter/RemainingToText.py | |
| parent | 4f7990ff2a55874b9eb65e3c9cd47dacb9f76deb (diff) | |
| parent | 5e6f814d005a01caa437a532e61f4b338617ff67 (diff) | |
| download | enigma2-bbfcb7ea1f040d030277e2b6f2efa9ea0967bf2b.tar.gz enigma2-bbfcb7ea1f040d030277e2b6f2efa9ea0967bf2b.zip | |
Merge branch 'master' of /home/tmbinc/enigma2-git into tmbinc/FixTimingBugs
Conflicts:
lib/dvb/decoder.cpp
Diffstat (limited to 'lib/python/Components/Converter/RemainingToText.py')
| -rw-r--r-- | lib/python/Components/Converter/RemainingToText.py | 34 |
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) |
