revert local change
[enigma2.git] / lib / python / Components / Sources / CurrentService.py
index bec6d2d..8e582d5 100644 (file)
@@ -1,22 +1,31 @@
 from Components.PerServiceDisplay import PerServiceBase
 from enigma import iPlayableService
 from Source import Source
+from Components.Element import cached
+
+from time import time
 
 class CurrentService(PerServiceBase, Source):
        def __init__(self, navcore):
                Source.__init__(self)
                PerServiceBase.__init__(self, navcore, 
                        { 
-                               iPlayableService.evStart: self.changed,
-                               iPlayableService.evEnd: self.changed 
-                       })
+                               iPlayableService.evStart: self.serviceEvent,
+                               iPlayableService.evEnd: self.serviceEvent,
+                               # FIXME: we should check 'interesting_events'
+                               # which is not always provided.
+                               iPlayableService.evUpdatedInfo: self.serviceEvent,
+                               iPlayableService.evUpdatedEventInfo: self.serviceEvent,
+                               iPlayableService.evCuesheetChanged: self.serviceEvent,
+                               iPlayableService.evVideoSizeChanged: self.serviceEvent
+                       }, with_event=True)
                self.navcore = navcore
 
-       def getCurrentService(self):
-               service = self.navcore.getCurrentService()
-               return service
+       def serviceEvent(self, event):
+               self.changed((self.CHANGED_SPECIFIC, event))
 
-       def stopEvent(self):
-               self.changed()
+       @cached
+       def getCurrentService(self):
+               return self.navcore.getCurrentService()
 
        service = property(getCurrentService)