diff options
Diffstat (limited to 'lib/python/Components/Converter')
| -rw-r--r-- | lib/python/Components/Converter/FrontendInfo.py | 4 | ||||
| -rw-r--r-- | lib/python/Components/Converter/RdsInfo.py | 14 | ||||
| -rw-r--r-- | lib/python/Components/Converter/ServiceInfo.py | 36 | ||||
| -rw-r--r-- | lib/python/Components/Converter/ServiceName.py | 2 | ||||
| -rw-r--r-- | lib/python/Components/Converter/ServicePosition.py | 6 | ||||
| -rw-r--r-- | lib/python/Components/Converter/ServiceTime.py | 2 | ||||
| -rw-r--r-- | lib/python/Components/Converter/Streaming.py | 3 |
7 files changed, 25 insertions, 42 deletions
diff --git a/lib/python/Components/Converter/FrontendInfo.py b/lib/python/Components/Converter/FrontendInfo.py index 796ac330..4043a1be 100644 --- a/lib/python/Components/Converter/FrontendInfo.py +++ b/lib/python/Components/Converter/FrontendInfo.py @@ -29,7 +29,7 @@ class FrontendInfo(Converter, object): @cached def getText(self): - assert self.type not in [self.LOCK, self.SLOT_NUMBER], "the text output of FrontendInfo cannot be used for lock info" + assert self.type not in (self.LOCK, self.SLOT_NUMBER), "the text output of FrontendInfo cannot be used for lock info" percent = None if self.type == self.BER: # as count count = self.source.ber @@ -54,7 +54,7 @@ class FrontendInfo(Converter, object): @cached def getBool(self): - assert self.type in [self.LOCK, self.BER], "the boolean output of FrontendInfo can only be used for lock or BER info" + assert self.type in (self.LOCK, self.BER), "the boolean output of FrontendInfo can only be used for lock or BER info" if self.type == self.LOCK: lock = self.source.lock if lock is None: diff --git a/lib/python/Components/Converter/RdsInfo.py b/lib/python/Components/Converter/RdsInfo.py index 3a7b2be3..f3f2b673 100644 --- a/lib/python/Components/Converter/RdsInfo.py +++ b/lib/python/Components/Converter/RdsInfo.py @@ -9,18 +9,12 @@ class RdsInfo(Converter, object): def __init__(self, type): Converter.__init__(self, type) - self.type = { - "RadioText": self.RADIO_TEXT_CHANGED, - "RtpText": self.RTP_TEXT_CHANGED, - "RasInteractiveAvailable": self.RASS_INTERACTIVE_AVAILABLE + self.type, self.interesting_events = { + "RadioText": (self.RADIO_TEXT_CHANGED, (iPlayableService.evUpdatedRadioText,)), + "RtpText": (self.RTP_TEXT_CHANGED, (iPlayableService.evUpdatedRtpText,)), + "RasInteractiveAvailable": (self.RASS_INTERACTIVE_AVAILABLE, (iPlayableService.evUpdatedRassInteractivePicMask,)) }[type] - self.interesting_events = { - self.RADIO_TEXT_CHANGED: [iPlayableService.evUpdatedRadioText], - self.RTP_TEXT_CHANGED: [iPlayableService.evUpdatedRtpText], - self.RASS_INTERACTIVE_AVAILABLE: [iPlayableService.evUpdatedRassInteractivePicMask] - }[self.type] - @cached def getText(self): decoder = self.source.decoder diff --git a/lib/python/Components/Converter/ServiceInfo.py b/lib/python/Components/Converter/ServiceInfo.py index 71180254..d4054f0c 100644 --- a/lib/python/Components/Converter/ServiceInfo.py +++ b/lib/python/Components/Converter/ServiceInfo.py @@ -13,26 +13,16 @@ class ServiceInfo(Converter, object): def __init__(self, type): Converter.__init__(self, type) - self.type = { - "HasTelext": self.HAS_TELETEXT, - "IsMultichannel": self.IS_MULTICHANNEL, - "IsCrypted": self.IS_CRYPTED, - "IsWidescreen": self.IS_WIDESCREEN, - "SubservicesAvailable": self.SUBSERVICES_AVAILABLE, - "VideoWidth": self.XRES, - "VideoHeight": self.YRES, + self.type, self.interesting_events = { + "HasTelext": (self.HAS_TELETEXT, (iPlayableService.evUpdatedInfo,)), + "IsMultichannel": (self.IS_MULTICHANNEL, (iPlayableService.evUpdatedInfo,)), + "IsCrypted": (self.IS_CRYPTED, (iPlayableService.evUpdatedInfo,)), + "IsWidescreen": (self.IS_WIDESCREEN, (iPlayableService.evVideoSizeChanged,)), + "SubservicesAvailable": (self.SUBSERVICES_AVAILABLE, (iPlayableService.evUpdatedEventInfo,)), + "VideoWidth": (self.XRES, (iPlayableService.evVideoSizeChanged,)), + "VideoHeight": (self.YRES, (iPlayableService.evVideoSizeChanged,)), }[type] - self.interesting_events = { - self.HAS_TELETEXT: [iPlayableService.evUpdatedInfo], - self.IS_MULTICHANNEL: [iPlayableService.evUpdatedInfo], - self.IS_CRYPTED: [iPlayableService.evUpdatedInfo], - self.IS_WIDESCREEN: [iPlayableService.evVideoSizeChanged], - self.SUBSERVICES_AVAILABLE: [iPlayableService.evUpdatedEventInfo], - self.XRES: [iPlayableService.evVideoSizeChanged], - self.YRES: [iPlayableService.evVideoSizeChanged], - }[self.type] - def getServiceInfoString(self, info, what): v = info.getInfo(what) if v == -1: @@ -56,16 +46,18 @@ class ServiceInfo(Converter, object): audio = service.audioTracks() if audio: n = audio.getNumberOfTracks() - for x in range(n): - i = audio.getTrackInfo(x) + idx = 0 + while idx < n: + i = audio.getTrackInfo(idx) description = i.getDescription(); - if description.find("AC3") != -1 or description.find("DTS") != -1: + if "AC3" in description or "DTS" in description: return True + idx += 1 return False elif self.type == self.IS_CRYPTED: return info.getInfo(iServiceInformation.sIsCrypted) == 1 elif self.type == self.IS_WIDESCREEN: - return info.getInfo(iServiceInformation.sAspect) in [3, 4, 7, 8, 0xB, 0xC, 0xF, 0x10] + return info.getInfo(iServiceInformation.sAspect) in (3, 4, 7, 8, 0xB, 0xC, 0xF, 0x10) elif self.type == self.SUBSERVICES_AVAILABLE: subservices = service.subServices() return subservices and subservices.getNumberOfSubservices() > 0 diff --git a/lib/python/Components/Converter/ServiceName.py b/lib/python/Components/Converter/ServiceName.py index 18b1f2a5..210c1aab 100644 --- a/lib/python/Components/Converter/ServiceName.py +++ b/lib/python/Components/Converter/ServiceName.py @@ -47,5 +47,5 @@ class ServiceName(Converter, object): text = property(getText) def changed(self, what): - if what[0] != self.CHANGED_SPECIFIC or what[1] in [iPlayableService.evStart]: + if what[0] != self.CHANGED_SPECIFIC or what[1] in (iPlayableService.evStart,): Converter.changed(self, what) diff --git a/lib/python/Components/Converter/ServicePosition.py b/lib/python/Components/Converter/ServicePosition.py index 2bcc5492..b92af40b 100644 --- a/lib/python/Components/Converter/ServicePosition.py +++ b/lib/python/Components/Converter/ServicePosition.py @@ -35,7 +35,7 @@ class ServicePosition(Converter, Poll, object): elif type == "Gauge": self.type = self.TYPE_GAUGE else: - raise ElementError("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") self.poll_enabled = self.type != self.TYPE_LENGTH @@ -128,8 +128,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: diff --git a/lib/python/Components/Converter/ServiceTime.py b/lib/python/Components/Converter/ServiceTime.py index 89965067..d30839c6 100644 --- a/lib/python/Components/Converter/ServiceTime.py +++ b/lib/python/Components/Converter/ServiceTime.py @@ -16,7 +16,7 @@ class ServiceTime(Converter, object): elif type == "Duration": self.type = self.DURATION else: - raise ElementError("'%s' is not <StartTime|EndTime|Duration> for eEventTime converter" % type) + raise ElementError("'%s' is not <StartTime|EndTime|Duration> for ServiceTime converter" % type) @cached def getTime(self): diff --git a/lib/python/Components/Converter/Streaming.py b/lib/python/Components/Converter/Streaming.py index 2746ee84..0c0d274c 100644 --- a/lib/python/Components/Converter/Streaming.py +++ b/lib/python/Components/Converter/Streaming.py @@ -9,9 +9,6 @@ from Components.Element import cached # "+d:[p:t[,p:t...]]" with d=demux nr, p: pid, t: type class Streaming(Converter): - def __init__(self, type): - Converter.__init__(self, type) - @cached def getText(self): service = self.source.service |
