Merge branch 'master' of git.opendreambox.org:/git/enigma2
[enigma2.git] / lib / python / Plugins / Extensions / MediaPlayer / plugin.py
index 8477ecc17cfa2b962511c2991e0189e8a7ee2110..c25af780bfc58eb602e7c78644af3cfab0344d6d 100644 (file)
@@ -44,6 +44,7 @@ class MediaPixmap(Pixmap):
 
        def applySkin(self, desktop, screen):
                from Tools.LoadPixmap import LoadPixmap
+               noCoverFile = None
                if self.skinAttributes is not None:
                        for (attrib, value) in self.skinAttributes:
                                if attrib == "pixmap":
@@ -82,10 +83,10 @@ class MediaPixmap(Pixmap):
        def showDefaultCover(self):
                self.instance.setPixmap(self.noCoverPixmap)
 
-       #def destroy(self):
-               #Pixmap.destroy(self)
-               #print "mediapixmap ***********+ destroy"
-               
+       def embeddedCoverArt(self):
+               print "[embeddedCoverArt] found"
+               self.coverArtFileName = "/tmp/.id3coverart"
+               self.picload.startDecode(self.coverArtFileName)
 
 class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoBarCueSheetSupport, InfoBarNotifications, InfoBarSubtitleSupport, HelpableScreen):
        ALLOW_SUSPEND = True
@@ -110,7 +111,7 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB
 
                # 'None' is magic to start at the list of mountpoints
                defaultDir = config.mediaplayer.defaultDir.getValue()
-               self.filelist = FileList(defaultDir, 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 = FileList(defaultDir, matchingPattern = "(?i)^.*\.(mp2|mp3|ogg|ts|wav|wave|m3u|pls|e2pls|mpg|vob|avi|divx|mkv|mp4|m4a|dat|flac)", useServiceRef = True, additionalExtensions = "4098:m3u 4098:e2pls 4098:pls")
                self["filelist"] = self.filelist
 
                self.playlist = MyPlayList()
@@ -224,7 +225,8 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB
                        {
                                iPlayableService.evUpdatedInfo: self.__evUpdatedInfo,
                                iPlayableService.evUser+11: self.__evDecodeError,
-                               iPlayableService.evUser+12: self.__evPluginError
+                               iPlayableService.evUser+12: self.__evPluginError,
+                               iPlayableService.evUser+13: self["coverArt"].embeddedCoverArt
                        })
 
        def doNothing(self):
@@ -481,17 +483,20 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB
                        else:
                                menu.append((_("add files to playlist"), "copyfiles"))
                        menu.append((_("switch to playlist"), "playlist"))
-                       menu.append((_("delete file"), "deletefile"))
+                       if config.usage.setup_level.index >= 1: # intermediate+
+                               menu.append((_("delete file"), "deletefile"))
                else:
                        menu.append((_("switch to filelist"), "filelist"))
-                       menu.append((_("shuffle playlist"), "shuffle"))
-                       menu.append((_("Delete entry"), "deleteentry"))
                        menu.append((_("clear playlist"), "clear"))
+                       menu.append((_("Delete entry"), "deleteentry"))
+                       if config.usage.setup_level.index >= 1: # intermediate+
+                               menu.append((_("shuffle playlist"), "shuffle"))
                menu.append((_("hide player"), "hide"));
-               menu.append((_("save playlist"), "saveplaylist"));
                menu.append((_("load playlist"), "loadplaylist"));
-               menu.append((_("delete saved playlist"), "deleteplaylist"));
-               menu.append((_("Edit settings"), "settings"))
+               if config.usage.setup_level.index >= 1: # intermediate+
+                       menu.append((_("save playlist"), "saveplaylist"));
+                       menu.append((_("delete saved playlist"), "deleteplaylist"));
+                       menu.append((_("Edit settings"), "settings"))
                self.session.openWithCallback(self.menuCallback, ChoiceBox, title="", list=menu)
 
        def menuCallback(self, choice):