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.currentlyPlayingServiceReference = None
23 self.currentlyPlayingService = None
25 self.RecordTimer = RecordTimer.RecordTimer()
27 def callEvent(self, i):
32 def playService(self, ref):
33 print "playing", ref.toString()
34 self.currentlyPlayingServiceReference = None
35 self.currentlyPlayingService = None
40 if not self.pnav.playService(ref):
41 self.currentlyPlayingServiceReference = ref
45 def getCurrentlyPlayingServiceReference(self):
46 return self.currentlyPlayingServiceReference
48 def recordService(self, ref):
49 print "recording service: %s" % (str(ref))
50 if isinstance(ref, ServiceReference.ServiceReference):
52 service = self.pnav.recordService(ref)
55 print "record returned non-zero"
60 def getCurrentService(self):
62 if not self.currentlyPlayingService:
63 self.currentlyPlayingService = self.pnav.getCurrentService()
64 return self.currentlyPlayingService
67 def stopService(self):
68 self.pnav.stopService()
69 self.currentlyPlayingService = None
72 return self.pnav.pause(p)
74 def recordWithTimer(self, ref, begin, end, name, description, eit):
75 if isinstance(ref, eServiceReference):
76 ref = ServiceReference.ServiceReference(ref)
77 entry = RecordTimer.RecordTimerEntry(ref, begin, end, name, description, eit)
78 self.RecordTimer.record(entry)
82 self.RecordTimer.shutdown()
85 def stopUserServices(self):