allow disable of service validation
[enigma2.git] / lib / python / Components / Sources / RadioText.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 RadioText(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.evEnd: self.gotEvent
14                         }, with_event=True)
15
16         @cached
17         def getText(self):
18                 service = self.navcore.getCurrentService()
19                 return service and service.radioText()
20
21         radiotext = property(getText)
22
23         def gotEvent(self, what):
24                 if what in [iPlayableService.evStart, iPlayableService.evEnd]:
25                         self.changed((self.CHANGED_CLEAR,))
26                 else:
27                         self.changed((self.CHANGED_ALL,))