2 from Components.ParentalControl import parentalControl
3 from Tools.BoundFunction import boundFunction
6 import NavigationInstance
7 import ServiceReference
11 # TODO: remove pNavgation, eNavigation and rewrite this stuff in python.
14 if NavigationInstance.instance is not None:
15 raise NavigationInstance.instance
17 NavigationInstance.instance = self
18 self.ServiceHandler = eServiceCenter.getInstance()
20 import Navigation as Nav
23 self.pnav = pNavigation()
24 self.pnav.m_event.get().append(self.callEvent)
26 self.currentlyPlayingServiceReference = None
27 self.currentlyPlayingService = None
29 self.RecordTimer = RecordTimer.RecordTimer()
31 def callEvent(self, i):
36 def playService(self, ref, checkParentalControl = True):
37 print "playing", ref and ref.toString()
38 self.currentlyPlayingServiceReference = None
39 self.currentlyPlayingService = None
44 if not checkParentalControl or parentalControl.isServicePlayable(ref.toCompareString(), boundFunction(self.playService, checkParentalControl = False)):
45 if self.pnav and not self.pnav.playService(ref):
46 self.currentlyPlayingServiceReference = ref
52 def getCurrentlyPlayingServiceReference(self):
53 return self.currentlyPlayingServiceReference
55 def recordService(self, ref):
56 print "recording service: %s" % (str(ref))
57 if isinstance(ref, ServiceReference.ServiceReference):
59 service = self.pnav and self.pnav.recordService(ref)
62 print "record returned non-zero"
67 def getCurrentService(self):
69 if not self.currentlyPlayingService:
70 self.currentlyPlayingService = self.pnav and self.pnav.getCurrentService()
71 return self.currentlyPlayingService
74 def stopService(self):
77 self.pnav.stopService()
78 self.currentlyPlayingService = None
79 self.currentlyPlayingServiceReference = None
82 return self.pnav and self.pnav.pause(p)
84 def recordWithTimer(self, ref, begin, end, name, description, eit):
85 if isinstance(ref, eServiceReference):
86 ref = ServiceReference.ServiceReference(ref)
87 entry = RecordTimer.RecordTimerEntry(ref, begin, end, name, description, eit)
88 self.RecordTimer.record(entry)
92 self.RecordTimer.shutdown()
93 self.ServiceHandler = None
96 def stopUserServices(self):