From e716326ec3576fae8909d6637bd224330125d8dd Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Fri, 6 Oct 2006 12:51:40 +0000 Subject: [PATCH] fix media player behaviour when adding a single file: adds the whole directory to the playlist now and plays the selected file (advantage: the next file is automatically played after the selected file finished playing) --- lib/python/Screens/MediaPlayer.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/lib/python/Screens/MediaPlayer.py b/lib/python/Screens/MediaPlayer.py index 4c142332..446621df 100644 --- a/lib/python/Screens/MediaPlayer.py +++ b/lib/python/Screens/MediaPlayer.py @@ -283,7 +283,10 @@ class MediaPlayer(Screen, InfoBarSeek): self.filelist.descent() self.updateCurrentInfo() else: - self.copyFile() + self.playlist.clear() + self.copyDirectory(os.path.dirname(self.filelist.getSelection()[0].getPath()) + "/", recursive = False) + self.playServiceRefEntry(self.filelist.getServiceRef()) + if self.currList == "playlist": selection = self["playlist"].getSelection() self.changeEntry(self.playlist.getSelectionIndex()) @@ -364,12 +367,14 @@ class MediaPlayer(Screen, InfoBarSeek): elif choice[1] == "hide": self.hide() - def copyDirectory(self, directory): + def copyDirectory(self, directory, recursive = True): + print "copyDirectory", directory filelist = FileList(directory, useServiceRef = True, isTop = True) for x in filelist.getFileList(): if x[0][1] == True: #isDir - self.copyDirectory(x[0][0]) + if recursive: + self.copyDirectory(x[0][0]) else: self.playlist.addFile(x[0][0]) self.playlist.updateList() @@ -428,6 +433,13 @@ class MediaPlayer(Screen, InfoBarSeek): self.playlist.setCurrentPlaying(index) self.playEntry() + def playServiceRefEntry(self, serviceref): + serviceRefList = self.playlist.getServiceRefList() + for count in range(len(serviceRefList)): + if serviceRefList[count] == serviceref: + self.changeEntry(count) + break + def playEntry(self): if len(self.playlist.getServiceRefList()): currref = self.playlist.getServiceRefList()[self.playlist.getCurrentIndex()] -- 2.30.2