add possibility to add complete content of a directory to playlist just with
[enigma2.git] / lib / python / Plugins / Extensions / MediaPlayer / plugin.py
index 2c9097fb7dc830e312c7bf88b16607352775e464..63e2b302899a1e13e6bb2a62964bb10590daec5f 100644 (file)
@@ -33,10 +33,11 @@ class MyPlayList(PlayList):
 class MediaPixmap(Pixmap):
        def applySkin(self, desktop):
                self.default_pixmap = None
 class MediaPixmap(Pixmap):
        def applySkin(self, desktop):
                self.default_pixmap = None
-               for (attrib, value) in self.skinAttributes:
-                       if attrib == "pixmap":
-                               self.default_pixmap = value
-                               break
+               if self.skinAttributes is not None:
+                       for (attrib, value) in self.skinAttributes:
+                               if attrib == "pixmap":
+                                       self.default_pixmap = value
+                                       break
                if self.default_pixmap is None:
                        self.default_pixmap = resolveFilename(SCOPE_SKIN_IMAGE, "no_coverArt.png")
                return Pixmap.applySkin(self, desktop)
                if self.default_pixmap is None:
                        self.default_pixmap = resolveFilename(SCOPE_SKIN_IMAGE, "no_coverArt.png")
                return Pixmap.applySkin(self, desktop)
@@ -106,7 +107,7 @@ class MediaPlayer(Screen, InfoBarSeek, InfoBarAudioSelection, InfoBarCueSheetSup
 
                self["MediaPlayerActions"] = HelpableActionMap(self, "MediaPlayerActions", 
                        {
 
                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")),
                                "pause": (self.pauseEntry, _("pause")),
                                "stop": (self.stopEntry, _("stop entry")),
                                "previous": (self.previousEntry, _("play previous playlist entry")),
@@ -590,7 +591,24 @@ class MediaPlayer(Screen, InfoBarSeek, InfoBarAudioSelection, InfoBarCueSheetSup
                        if serviceRefList[count] == serviceref:
                                self.changeEntry(count)
                                break
                        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
        def playEntry(self):
                if len(self.playlist.getServiceRefList()):
                        needsInfoUpdate = False