aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Components/Sources/RadioText.py
blob: 21a3f1aab364228a92cfdde89ac0bec9ba025664 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from Components.PerServiceDisplay import PerServiceBase
from Components.Element import cached
from enigma import iPlayableService
from Source import Source

class RdsDecoder(PerServiceBase, Source, object):
	def __init__(self, navcore):
		Source.__init__(self)
		PerServiceBase.__init__(self, navcore,
			{
				iPlayableService.evStart: self.gotEvent,
				iPlayableService.evUpdatedRadioText: self.gotEvent,
				iPlayableService.evUpdatedRtpText: self.gotEvent,
				iPlayableService.evUpdatedRassInteractivePicMask: self.gotEvent,
				iPlayableService.evEnd: self.gotEvent
			}, with_event=True)

	@cached
	def getDecoder(self):
		service = self.navcore.getCurrentService()
		return service and service.rdsDecoder()

	decoder = property(getDecoder)

	def gotEvent(self, what):
		if what in [iPlayableService.evStart, iPlayableService.evEnd]:
			self.changed((self.CHANGED_CLEAR,))
		else:
			self.changed((self.CHANGED_ALL,))