4 import NavigationInstance
5 import ServiceReference
7 # TODO: remove pNavgation, eNavigation and rewrite this stuff in python.
10 if NavigationInstance.instance is not None:
11 raise NavigationInstance.instance
13 NavigationInstance.instance = self
14 self.ServiceHandler = eServiceCenter.getInstance()
16 import Navigation as Nav
19 self.pnav = pNavigation()
20 self.pnav.m_event.get().append(self.callEvent)
22 self.currentlyPlayingService = None
23 self.currentlyPlayingServiceReference = None
24 self.lastServiceRef = None
26 self.RecordTimer = RecordTimer.RecordTimer()
28 def callEvent(self, i):
32 def playService(self, ref):
33 self.lastServiceRef = self.currentlyPlayingServiceReference
34 self.currentlyPlayingServiceReference = None
39 if not self.pnav.playService(ref):
40 self.currentlyPlayingServiceReference = ref
45 return self.playService(self.lastServiceRef)
47 def getCurrentlyPlayingServiceReference(self):
48 return self.currentlyPlayingServiceReference
50 def recordService(self, ref):
51 print "recording service: %s" % (str(ref))
52 if isinstance(ref, ServiceReference.ServiceReference):
54 service = self.pnav.recordService(ref)
57 print "record returned non-zero"
62 def enqueueService(self, ref):
63 return self.pnav.enqueueService(ref)
65 def getCurrentService(self):
66 service = self.pnav.getCurrentService()
73 def stopService(self):
74 self.pnav.stopService()
76 def getPlaylist(self):
77 playlist = ePlaylistPtr()
78 if self.pnav.getPlaylist(playlist):
83 return self.pnav.pause(p)
85 def recordWithTimer(self, ref, begin, end, name, description, eit):
86 if isinstance(ref, eServiceReference):
87 ref = ServiceReference.ServiceReference(ref)
88 entry = RecordTimer.RecordTimerEntry(ref, begin, end, name, description, eit)
89 self.RecordTimer.record(entry)
93 self.RecordTimer.shutdown()
95 def stopUserServices(self):