X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/1109344c9409572f9829e46971b71a7fe1d3c8cc..0221901d960f4935240dc7d5e8e44ace748e1223:/lib/python/Components/Converter/ClockToText.py diff --git a/lib/python/Components/Converter/ClockToText.py b/lib/python/Components/Converter/ClockToText.py index 65e431bc..8ef98742 100644 --- a/lib/python/Components/Converter/ClockToText.py +++ b/lib/python/Components/Converter/ClockToText.py @@ -8,6 +8,8 @@ class ClockToText(Converter, object): IN_MINUTES = 2 DATE = 3 FORMAT = 4 + AS_LENGTH = 5 + TIMESTAMP = 6 # add: date, date as string, weekday, ... # (whatever you need!) @@ -20,7 +22,11 @@ class ClockToText(Converter, object): self.type = self.IN_MINUTES elif type == "Date": self.type = self.DATE - elif type.find("Format") != -1: + 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:] else: @@ -35,6 +41,10 @@ class ClockToText(Converter, object): # handle durations if self.type == self.IN_MINUTES: 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) @@ -52,6 +62,7 @@ class ClockToText(Converter, object): return str(s1+s2) else: return strftime(self.fmt_string, t) + else: return "???"