aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Components/Sources/EventInfo.py
blob: fc420d8312638a1a31779c9cee8e92b6698edbf7 (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 Tools.Event import Event
from enigma import iPlayableService
from Source import Source

class EventInfo(PerServiceBase, Source):
	NOW = 0
	NEXT = 1
	
	def __init__(self, navcore, now_or_next):
		Source.__init__(self)
		PerServiceBase.__init__(self, navcore, 
			{ 
				iPlayableService.evUpdatedEventInfo: self.ourEvent, 
				iPlayableService.evEnd: self.stopEvent 
			})
		
		self.event = None
		self.now_or_next = now_or_next
		
	def ourEvent(self):
		service = self.navcore.getCurrentService()
		info = service and service.info()
		self.event = info and info.getEvent(self.now_or_next)
		self.changed()

	def stopEvent(self):
		self.event = None
		self.changed()