From dc2c27a337f958696295d818281805f6c17a4631 Mon Sep 17 00:00:00 2001 From: Andreas Monzner Date: Thu, 27 Dec 2007 10:23:07 +0000 Subject: [PATCH] add possibility to add complete content of a directory to playlist just with one button press --- .../Plugins/Extensions/MediaPlayer/plugin.py | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/lib/python/Plugins/Extensions/MediaPlayer/plugin.py b/lib/python/Plugins/Extensions/MediaPlayer/plugin.py index 46e2db24..63e2b302 100644 --- a/lib/python/Plugins/Extensions/MediaPlayer/plugin.py +++ b/lib/python/Plugins/Extensions/MediaPlayer/plugin.py @@ -107,7 +107,7 @@ class MediaPlayer(Screen, InfoBarSeek, InfoBarAudioSelection, InfoBarCueSheetSup self["MediaPlayerActions"] = HelpableActionMap(self, "MediaPlayerActions", { - "play": (self.playEntry, _("play entry")), + "play": (self.xplayEntry, _("play entry")), "pause": (self.pauseEntry, _("pause")), "stop": (self.stopEntry, _("stop entry")), "previous": (self.previousEntry, _("play previous playlist entry")), @@ -591,7 +591,24 @@ class MediaPlayer(Screen, InfoBarSeek, InfoBarAudioSelection, InfoBarCueSheetSup if serviceRefList[count] == serviceref: self.changeEntry(count) break - + + def xplayEntry(self): + if self.currList == "playlist": + self.playEntry() + else: + self.stopEntry() + self.playlist.clear() + sel = self.filelist.getSelection() + if sel: + if sel[1]: # can descent + # add directory to playlist + self.copyDirectory(sel[0]) + else: + # add files to playlist + self.copyDirectory(os_path.dirname(sel[0].getPath()) + "/", recursive = False) + if len(self.playlist) > 0: + self.changeEntry(0) + def playEntry(self): if len(self.playlist.getServiceRefList()): needsInfoUpdate = False -- 2.30.2