2 from Components.ParentalControl import parentalControl
3 from Tools.BoundFunction import boundFunction
7 import NavigationInstance
8 import ServiceReference
12 # TODO: remove pNavgation, eNavigation and rewrite this stuff in python.
15 if NavigationInstance.instance is not None:
16 raise NavigationInstance.instance
18 NavigationInstance.instance = self
19 self.ServiceHandler = eServiceCenter.getInstance()
21 import Navigation as Nav
24 self.pnav = pNavigation()
25 self.pnav.m_event.get().append(self.callEvent)
27 self.currentlyPlayingServiceReference = None
28 self.currentlyPlayingService = None
30 self.RecordTimer = RecordTimer.RecordTimer()
31 self.SleepTimer = SleepTimer.SleepTimer()
33 def callEvent(self, i):
38 def playService(self, ref, checkParentalControl = True):
39 print "playing", ref and ref.toString()
40 self.currentlyPlayingServiceReference = None
41 self.currentlyPlayingService = None
46 if not checkParentalControl or parentalControl.isServicePlayable(ref.toCompareString(), boundFunction(self.playService, checkParentalControl = False)):
47 if self.pnav and not self.pnav.playService(ref):
48 self.currentlyPlayingServiceReference = ref
54 def getCurrentlyPlayingServiceReference(self):
55 return self.currentlyPlayingServiceReference
57 def recordService(self, ref):
58 print "recording service: %s" % (str(ref))
59 if isinstance(ref, ServiceReference.ServiceReference):
61 service = self.pnav and self.pnav.recordService(ref)
64 print "record returned non-zero"
69 def getCurrentService(self):
71 if not self.currentlyPlayingService:
72 self.currentlyPlayingService = self.pnav and self.pnav.getCurrentService()
73 return self.currentlyPlayingService
76 def stopService(self):
79 self.pnav.stopService()
80 self.currentlyPlayingService = None
81 self.currentlyPlayingServiceReference = None
84 return self.pnav and self.pnav.pause(p)
86 def recordWithTimer(self, ref, begin, end, name, description, eit):
87 if isinstance(ref, eServiceReference):
88 ref = ServiceReference.ServiceReference(ref)
89 entry = RecordTimer.RecordTimerEntry(ref, begin, end, name, description, eit)
90 self.RecordTimer.record(entry)
94 self.RecordTimer.shutdown()
95 self.ServiceHandler = None
98 def stopUserServices(self):