fix stupid code
[enigma2.git] / lib / python / Screens / MediaPlayer.py
index 446621dfbace1f32a329751e62d2777b74ea6217..4e299b27b75bf21f2316e7ce632b3c2fbcbb547b 100644 (file)
@@ -4,7 +4,6 @@ from Screens.MessageBox import MessageBox
 from Components.ActionMap import NumberActionMap
 from Components.Label import Label
 from Components.Input import Input
-from Components.GUIComponent import *
 from Components.Pixmap import Pixmap
 from Components.Label import Label
 from Components.FileList import FileEntryComponent, FileList
@@ -34,7 +33,8 @@ class MediaPlayer(Screen, InfoBarSeek):
                self.addPlaylistParser(PlaylistIOPLS, "pls")
                self.addPlaylistParser(PlaylistIOInternal, "e2pls")
 
-               self.filelist = FileList(resolveFilename(SCOPE_MEDIA), matchingPattern = "(?i)^.*\.(mp3|ogg|ts|wav|wave|m3u|pls|e2pls|mpg|vob)", useServiceRef = True)
+               # 'None' is magic to start at the list of mountpoints
+               self.filelist = FileList(None, matchingPattern = "(?i)^.*\.(mp3|ogg|ts|wav|wave|m3u|pls|e2pls|mpg|vob)", useServiceRef = True)
                self["filelist"] = self.filelist
 
                self.playlist = PlayList()
@@ -271,9 +271,15 @@ class MediaPlayer(Screen, InfoBarSeek):
                text = ""
                if self.currList == "filelist":
                        if not self.filelist.canDescent():
-                               text = self.filelist.getServiceRef().getPath()
+                               r = self.filelist.getServiceRef()
+                               if r is None:
+                                       return
+                               text = r.getPath()
                if self.currList == "playlist":
-                       text = self.playlist.getSelection().getPath()
+                       t = self.playlist.getSelection()
+                       if t is None:
+                               return
+                       text = t.getPath()
 
                self["currenttext"].setText(os.path.basename(text))
 
@@ -283,6 +289,7 @@ class MediaPlayer(Screen, InfoBarSeek):
                                self.filelist.descent()
                                self.updateCurrentInfo()
                        else:
+                               self.stopEntry()
                                self.playlist.clear()
                                self.copyDirectory(os.path.dirname(self.filelist.getSelection()[0].getPath()) + "/", recursive = False)
                                self.playServiceRefEntry(self.filelist.getServiceRef())