shutdown channel if tune fails
[enigma2.git] / Navigation.py
index 5fe2651783d94c40276346badf41f17f95ff2f33..c453c6c71ca0dcba1141070e180fe470c9c4a4b4 100644 (file)
@@ -11,19 +11,16 @@ class Navigation:
                        raise NavigationInstance.instance
                
                NavigationInstance.instance = self
-               self.ServiceHandler = eServiceCenterPtr()
-               eServiceCenter.getInstance(self.ServiceHandler)
+               self.ServiceHandler = eServiceCenter.getInstance()
 
                import Navigation as Nav
                Nav.navcore = self
                
-               print "Navcore instance set!"
-               print Nav.navcore
-               
                self.pnav = pNavigation()
                self.pnav.m_event.get().append(self.callEvent)
                self.event = [ ]
                self.currentlyPlayingService = None
+               self.currentlyPlayingServiceReference = None
                
                self.RecordTimer = RecordTimer.RecordTimer()
 
@@ -33,6 +30,10 @@ class Navigation:
        
        def playService(self, ref):
                self.currentlyPlayingServiceReference = None
+               if ref is None:
+                       self.stopService()
+                       return 0
+               
                if not self.pnav.playService(ref):
                        self.currentlyPlayingServiceReference = ref
                        return 0
@@ -45,23 +46,28 @@ class Navigation:
                print "recording service: %s" % (str(ref))
                if isinstance(ref, ServiceReference.ServiceReference):
                        ref = ref.ref
-               service = iRecordableServicePtr()
-               if self.pnav.recordService(ref, service):
+               service = self.pnav.recordService(ref)
+               
+               if service is None:
                        print "record returned non-zero"
                        return None
                else:
-                       print "ok, recordService didn't fail"
                        return service
        
        def enqueueService(self, ref):
                return self.pnav.enqueueService(ref)
        
        def getCurrentService(self):
-               service = iPlayableServicePtr()
-               if self.pnav.getCurrentService(service):
+               service = self.pnav.getCurrentService()
+               
+               if service is None:
                        return None
+               
                return service
        
+       def stopService(self):
+               self.pnav.stopService()
+       
        def getPlaylist(self):
                playlist = ePlaylistPtr()
                if self.pnav.getPlaylist(playlist):