to prevent bsods stop currently playing file, when remove it from playlist
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Thu, 27 Apr 2006 20:27:13 +0000 (20:27 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Thu, 27 Apr 2006 20:27:13 +0000 (20:27 +0000)
lib/python/Components/MediaPlayer.py
lib/python/Screens/MediaPlayer.py

index 31799c5bff97c81d7572916a67d8fcd002296fc2..31406e49ca258be0a8820a4ec03fa2d76030340e 100644 (file)
@@ -63,7 +63,9 @@ class PlayList(HTMLComponent, GUIComponent, MenuList):
        def clear(self):
                self.list = []
                self.l.setList(self.list)
-    
+               self.currPlaying = 0
+               self.oldCurrPlaying = -1
+
        def GUIcreate(self, parent):
                self.instance = eListbox(parent)
                self.instance.setContent(self.l)
@@ -81,8 +83,8 @@ class PlayList(HTMLComponent, GUIComponent, MenuList):
        def deleteFile(self, index):
                if self.currPlaying >= index:
                        self.currPlaying -= 1
-               self.list = self.list[:index] + self.list[index + 1:]
-       
+               del self.list[index]
+
        def setCurrentPlaying(self, index):
                self.oldCurrPlaying = self.currPlaying
                self.currPlaying = index
@@ -121,4 +123,4 @@ class PlayList(HTMLComponent, GUIComponent, MenuList):
                return list
        
        def __len__(self):
-               return len(self.list)
\ No newline at end of file
+               return len(self.list)
index dddf5f50a6e9c302f27d22f16a0b908bc786963d..21f26ffa4c89879eebe4475f0b661cf68a40059f 100644 (file)
@@ -278,6 +278,8 @@ class MediaPlayer(Screen, InfoBarSeek):
                elif choice[1] == "filelist":
                        self.switchToFileList()
                elif choice[1] == "delete":
+                       if self.playlist.getSelectionIndex() == self.playlist.getCurrentIndex():
+                               self.stopEntry()
                        self.deleteEntry()
                elif choice[1] == "clear":
                        self.stopEntry()
@@ -356,5 +358,6 @@ class MediaPlayer(Screen, InfoBarSeek):
        def stopEntry(self):
                self.playlist.stopFile()
                self.session.nav.playService(None)
+               self.updateMusicInformation(clear=True)