1 from enigma import iRdsDecoder, iPlayableService
2 from Components.Converter.Converter import Converter
3 from Components.Element import cached
5 class RdsInfo(Converter, object):
6 RASS_INTERACTIVE_AVAILABLE = 0
10 def __init__(self, type):
11 Converter.__init__(self, type)
12 self.type, self.interesting_events = {
13 "RadioText": (self.RADIO_TEXT_CHANGED, (iPlayableService.evUpdatedRadioText,)),
14 "RtpText": (self.RTP_TEXT_CHANGED, (iPlayableService.evUpdatedRtpText,)),
15 "RasInteractiveAvailable": (self.RASS_INTERACTIVE_AVAILABLE, (iPlayableService.evUpdatedRassInteractivePicMask,))
20 decoder = self.source.decoder
23 if self.type == self.RADIO_TEXT_CHANGED:
24 text = decoder.getText(iRdsDecoder.RadioText)
25 elif self.type == self.RTP_TEXT_CHANGED:
26 text = decoder.getText(iRdsDecoder.RtpText)
28 print "unknown RdsInfo Converter type", self.type
31 text = property(getText)
35 decoder = self.source.decoder
36 if self.type == self.RASS_INTERACTIVE_AVAILABLE:
37 mask = decoder and decoder.getRassInteractiveMask()
38 return (mask and mask[0] & 1 and True) or False
39 elif self.type == self.RADIO_TEXT_CHANGED:
40 return (len(decoder.getText(iRdsDecoder.RadioText)) and True) or False
41 elif self.type == self.RTP_TEXT_CHANGED:
42 return (len(decoder.getText(iRdsDecoder.RtpText)) and True) or False
43 boolean = property(getBoolean)
45 def changed(self, what):
46 if what[0] != self.CHANGED_SPECIFIC or what[1] in self.interesting_events:
47 Converter.changed(self, what)