user correct playlist parser from dict
[enigma2.git] / lib / python / Plugins / Extensions / MediaPlayer / plugin.py
index a144f2cd69d24f672d65b2cc37e7696248735cad..ed1a88747925e24d2dd16522e729c0fbbafb7c78 100644 (file)
@@ -66,7 +66,7 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB
                self.addPlaylistParser(PlaylistIOInternal, "e2pls")
 
                # '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|avi|mkv|mp4|dat|flac)", useServiceRef = True, additionalExtensions = "4098:m3u 4098:e2pls 4098:pls")
+               self.filelist = FileList(None, matchingPattern = "(?i)^.*\.(mp2|mp3|ogg|ts|wav|wave|m3u|pls|e2pls|mpg|vob|avi|mkv|mp4|dat|flac)", useServiceRef = True, additionalExtensions = "4098:m3u 4098:e2pls 4098:pls")
                self["filelist"] = self.filelist
 
                self.playlist = MyPlayList()
@@ -592,12 +592,13 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB
        def PlaylistSelected(self,path):
                if path is not None:
                        self.clear_playlist()
-                       self.playlistIOInternal = PlaylistIOInternal()
-                       list = self.playlistIOInternal.open(path[1])
-                       if list:
+                       extension = path[0].rsplit('.',1)[-1]
+                       if self.playlistparsers.has_key(extension):
+                               playlist = self.playlistparsers[extension]()
+                               list = playlist.open(path[1])
                                for x in list:
                                        self.playlist.addFile(x.ref)
-                               self.playlist.updateList()
+                       self.playlist.updateList()
 
        def delete_saved_playlist(self):
                listpath = []
@@ -727,7 +728,7 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB
                                ext = text[-4:].lower()
 
                                # FIXME: the information if the service contains video (and we should hide our window) should com from the service instead 
-                               if ext not in [".mp3", ".wav", ".ogg", "flac"] and not self.isAudioCD:
+                               if ext not in [".mp2", ".mp3", ".wav", ".ogg", "flac"] and not self.isAudioCD:
                                        self.hide()
                                else:
                                        needsInfoUpdate = True
@@ -754,7 +755,7 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB
                                currref = self.playlist.getServiceRefList()[idx]
                                text = currref.getPath()
                                ext = text[-4:].lower()
-                               if ext not in [".mp3", ".wav", ".ogg", "flac"] and not self.isAudioCD:
+                               if ext not in [".mp2", ".mp3", ".wav", ".ogg", "flac"] and not self.isAudioCD:
                                        self.hide()
                                else:
                                        needsInfoUpdate = True