use coverart png given in skin
[enigma2.git] / lib / python / Plugins / Extensions / MediaPlayer / plugin.py
index 0de820c84189591246b7ea1cf2ef7fe2337cb222..3783ddd4a47aa97619424d8a8d0ced3c005108b8 100644 (file)
@@ -30,6 +30,17 @@ class MyPlayList(PlayList):
                self.currPlaying = -1
                self.oldCurrPlaying = -1
 
+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.default_pixmap is None:
+                       self.default_pixmap = resolveFilename(SCOPE_SKIN_IMAGE, "no_coverArt.png")
+               return Pixmap.applySkin(self, desktop)
+
 class MediaPlayer(Screen, InfoBarSeek, InfoBarAudioSelection, InfoBarCueSheetSupport, InfoBarNotifications, HelpableScreen):
        ALLOW_SUSPEND = True
        ENABLE_RESUME_SUPPORT = True
@@ -73,7 +84,7 @@ class MediaPlayer(Screen, InfoBarSeek, InfoBarAudioSelection, InfoBarCueSheetSup
                self["year"] = Label("")
                self["genretext"] = Label(_("Genre:"))
                self["genre"] = Label("")
-               self["coverArt"] = Pixmap()
+               self["coverArt"] = MediaPixmap()
 
                self.seek_target = None
 
@@ -237,7 +248,7 @@ class MediaPlayer(Screen, InfoBarSeek, InfoBarAudioSelection, InfoBarCueSheetSup
                path = os_path.dirname(filename)
                pngname = path + "/" + "folder.png"
                if not os_path.exists(pngname):
-                       pngname = resolveFilename(SCOPE_SKIN_IMAGE, "no_coverArt.png")
+                       pngname = self["coverArt"].default_pixmap
                if self.coverArtFileName != pngname:
                        self.coverArtFileName = pngname
                        self["coverArt"].instance.setPixmapFromFile(self.coverArtFileName)
@@ -707,7 +718,7 @@ def main(session, **kwargs):
 
 def menu(menuid, **kwargs):
        if menuid == "mainmenu":
-               return [(_("Media player"), main)]
+               return [(_("Media player"), main, "media_player", 45)]
        return []
 
 def filescan_open(list, session, **kwargs):
@@ -750,6 +761,6 @@ def filescan(**kwargs):
 from Plugins.Plugin import PluginDescriptor
 def Plugins(**kwargs):
        return [
-               PluginDescriptor(name = "MediaPlayer", description = "Play back media files", where = PluginDescriptor.WHERE_SETUP, fnc = menu),
+               PluginDescriptor(name = "MediaPlayer", description = "Play back media files", where = PluginDescriptor.WHERE_MENU, fnc = menu),
                PluginDescriptor(name = "MediaPlayer", where = PluginDescriptor.WHERE_FILESCAN, fnc = filescan)
        ]