restart service after leaving the media player
authorStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Wed, 5 Apr 2006 10:01:39 +0000 (10:01 +0000)
committerStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Wed, 5 Apr 2006 10:01:39 +0000 (10:01 +0000)
lib/python/Screens/MediaPlayer.py

index da50ae5..fe1e0a8 100644 (file)
@@ -21,6 +21,7 @@ import os
 class MediaPlayer(Screen, InfoBarSeek):
        def __init__(self, session, args = None):
                Screen.__init__(self, session)
 class MediaPlayer(Screen, InfoBarSeek):
        def __init__(self, session, args = None):
                Screen.__init__(self, session)
+               self.oldService = self.session.nav.getCurrentlyPlayingServiceReference()
                self.session.nav.stopService()
                
                self.filelist = FileList(resolveFilename(SCOPE_MEDIA), matchingPattern = "^.*\.(mp3|ogg|ts|wav|wave)", useServiceRef = True)
                self.session.nav.stopService()
                
                self.filelist = FileList(resolveFilename(SCOPE_MEDIA), matchingPattern = "^.*\.(mp3|ogg|ts|wav|wave)", useServiceRef = True)
@@ -49,7 +50,7 @@ class MediaPlayer(Screen, InfoBarSeek):
                self["actions"] = NumberActionMap(["OkCancelActions", "DirectionActions", "NumberActions", "MediaPlayerSeekActions"],
                {
                        "ok": self.ok,
                self["actions"] = NumberActionMap(["OkCancelActions", "DirectionActions", "NumberActions", "MediaPlayerSeekActions"],
                {
                        "ok": self.ok,
-                       "cancel": self.close,
+                       "cancel": self.exit,
                        
                        "right": self.rightDown,
                        "rightRepeated": self.doNothing,
                        
                        "right": self.rightDown,
                        "rightRepeated": self.doNothing,
@@ -115,6 +116,9 @@ class MediaPlayer(Screen, InfoBarSeek):
        def doNothing(self):
                pass
        
        def doNothing(self):
                pass
        
+       def exit(self):
+               self.close()
+       
        def checkSkipShowHideLock(self):
                self.updatedSeekState()
        
        def checkSkipShowHideLock(self):
                self.updatedSeekState()
        
@@ -122,7 +126,7 @@ class MediaPlayer(Screen, InfoBarSeek):
                self.nextEntry()
                
        def __onClose(self):
                self.nextEntry()
                
        def __onClose(self):
-               self.session.nav.playService(None)
+               self.session.nav.playService(self.oldService)
        
        def delMPTimer(self):
                del self.rightKeyTimer
        
        def delMPTimer(self):
                del self.rightKeyTimer