4 import NavigationInstance
5 import ServiceReference
9 # TODO: remove pNavgation, eNavigation and rewrite this stuff in python.
12 if NavigationInstance.instance is not None:
13 raise NavigationInstance.instance
15 NavigationInstance.instance = self
16 self.ServiceHandler = eServiceCenter.getInstance()
18 import Navigation as Nav
21 self.pnav = pNavigation()
22 self.pnav.m_event.get().append(self.callEvent)
24 self.currentlyPlayingServiceReference = None
25 self.currentlyPlayingService = None
27 self.RecordTimer = RecordTimer.RecordTimer()
29 def callEvent(self, i):
34 def playService(self, ref):
35 print "playing", ref and ref.toString()
36 self.currentlyPlayingServiceReference = None
37 self.currentlyPlayingService = None
42 if self.pnav and not self.pnav.playService(ref):
43 self.currentlyPlayingServiceReference = ref
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 and self.pnav.recordService(ref)
57 print "record returned non-zero"
62 def getCurrentService(self):
64 if not self.currentlyPlayingService:
65 self.currentlyPlayingService = self.pnav and self.pnav.getCurrentService()
66 return self.currentlyPlayingService
69 def stopService(self):
72 self.pnav.stopService()
73 self.currentlyPlayingService = None
74 self.currentlyPlayingServiceReference = None
77 return self.pnav and self.pnav.pause(p)
79 def recordWithTimer(self, ref, begin, end, name, description, eit):
80 if isinstance(ref, eServiceReference):
81 ref = ServiceReference.ServiceReference(ref)
82 entry = RecordTimer.RecordTimerEntry(ref, begin, end, name, description, eit)
83 self.RecordTimer.record(entry)
87 self.RecordTimer.shutdown()
88 self.ServiceHandler = None
91 def stopUserServices(self):