From: ghost Date: Tue, 9 Dec 2008 22:37:05 +0000 (+0100) Subject: ServicePosition.py: add Option "ShowNoSeconds" X-Git-Tag: 2.6.0~543^2~20^2~1 X-Git-Url: https://git.cweiske.de/enigma2.git/commitdiff_plain/efe45cc966495fe6d581a465df5a3c6a1280d633 ServicePosition.py: add Option "ShowNoSeconds" --- diff --git a/lib/python/Components/Converter/ServicePosition.py b/lib/python/Components/Converter/ServicePosition.py index b488258b..d7a55dae 100644 --- a/lib/python/Components/Converter/ServicePosition.py +++ b/lib/python/Components/Converter/ServicePosition.py @@ -19,6 +19,7 @@ class ServicePosition(Converter, Poll, object): self.negate = 'Negate' in args self.detailed = 'Detailed' in args self.showHours = 'ShowHours' in args + self.showNoSeconds = 'ShowNoSeconds' in args if self.detailed: self.poll_interval = 100 @@ -34,7 +35,7 @@ class ServicePosition(Converter, Poll, object): elif type == "Gauge": self.type = self.TYPE_GAUGE else: - raise "type must be {Length|Position|Remaining|Gauge} with optional arguments {Negate|Detailed|ShowHours}" + raise "type must be {Length|Position|Remaining|Gauge} with optional arguments {Negate|Detailed|ShowHours|NoSeconds}" self.poll_enabled = self.type != self.TYPE_LENGTH @@ -94,9 +95,15 @@ class ServicePosition(Converter, Poll, object): if not self.detailed: if self.showHours: - return sign + "%d:%02d:%02d" % (l/3600, l%3600/60, l%60) + if self.showNoSeconds: + return sign + "%d:%02d" % (l/3600, l%3600/60) + else: + return sign + "%d:%02d:%02d" % (l/3600, l%3600/60, l%60) else: - return sign + "%d:%02d" % (l/60, l%60) + if self.showNoSeconds: + return sign + "%d" % (l/60) + else: + return sign + "%d:%02d" % (l/60, l%60) else: if self.showHours: return sign + "%d:%02d:%02d:%03d" % ((l/3600/90000), (l/90000)%3600/60, (l/90000)%60, (l%90000)/90)