3ec9a25db60fa65e02d9c8396eee977dd808140b
[enigma2.git] / lib / python / Components / Sources / RdsDecoder.py
1 from Components.PerServiceDisplay import PerServiceBase
2 from Components.Element import cached
3 from enigma import iPlayableService
4 from Source import Source
5
6 class RdsDecoder(PerServiceBase, Source, object):
7         def __init__(self, navcore):
8                 Source.__init__(self)
9                 PerServiceBase.__init__(self, navcore,
10                         {
11                                 iPlayableService.evStart: self.gotEvent,
12                                 iPlayableService.evUpdatedRadioText: self.gotEvent,
13                                 iPlayableService.evUpdatedRtpText: self.gotEvent,
14                                 iPlayableService.evUpdatedRassInteractivePicMask: self.gotEvent,
15                                 iPlayableService.evEnd: self.gotEvent
16                         }, with_event=True)
17
18         @cached
19         def getDecoder(self):
20                 service = self.navcore.getCurrentService()
21                 return service and service.rdsDecoder()
22
23         decoder = property(getDecoder)
24
25         def gotEvent(self, what):
26                 if what in [iPlayableService.evStart, iPlayableService.evEnd]:
27                         self.changed((self.CHANGED_CLEAR,))
28                 else:
29                         self.changed((self.CHANGED_SPECIFIC, what))
30
31         def destroy(self):
32                 PerServiceBase.destroy(self)
33                 Source.destroy(self)