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
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":
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
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: