Merge branch 'master' of /home/tmbinc/enigma2-git
[enigma2.git] / lib / python / Components / Converter / ServicePosition.py
index d7a55daea47ce81cc5f1bb4b04f8fcc7461ed5e1..56a6db675aa344203a6e23990e8f01ef9c7a1889 100644 (file)
@@ -1,7 +1,7 @@
 from Converter import Converter
 from Poll import Poll
 from enigma import iPlayableService
-from Components.Element import cached
+from Components.Element import cached, ElementError
 
 class ServicePosition(Converter, Poll, object):
        TYPE_LENGTH = 0
@@ -21,11 +21,6 @@ class ServicePosition(Converter, Poll, object):
                self.showHours = 'ShowHours' in args
                self.showNoSeconds = 'ShowNoSeconds' in args
 
-               if self.detailed:
-                       self.poll_interval = 100
-               else:
-                       self.poll_interval = 500
-
                if type == "Length":
                        self.type = self.TYPE_LENGTH
                elif type == "Position":
@@ -35,9 +30,16 @@ 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|NoSeconds}"
+                       raise ElementError("type must be {Length|Position|Remaining|Gauge} with optional arguments {Negate|Detailed|ShowHours|ShowNoSeconds} for ServicePosition converter")
+
+               if self.detailed:
+                       self.poll_interval = 100
+               elif self.type == self.TYPE_LENGTH:
+                       self.poll_interval = 2000
+               else:
+                       self.poll_interval = 500
 
-               self.poll_enabled = self.type != self.TYPE_LENGTH
+               self.poll_enabled = True
 
        def getSeek(self):
                s = self.source.service
@@ -128,8 +130,8 @@ class ServicePosition(Converter, Poll, object):
        value = property(getValue)
 
        def changed(self, what):
-               cutlist_refresh = what[0] != self.CHANGED_SPECIFIC or what[1] in [iPlayableService.evCuesheetChanged]
-               time_refresh = what[0] == self.CHANGED_POLL or what[0] == self.CHANGED_SPECIFIC and what[1] in [iPlayableService.evCuesheetChanged]
+               cutlist_refresh = what[0] != self.CHANGED_SPECIFIC or what[1] in (iPlayableService.evCuesheetChanged,)
+               time_refresh = what[0] == self.CHANGED_POLL or what[0] == self.CHANGED_SPECIFIC and what[1] in (iPlayableService.evCuesheetChanged,)
 
                if cutlist_refresh:
                        if self.type == self.TYPE_GAUGE: