prepare moving audio cdtext extraction to seperate plugin
[enigma2.git] / lib / python / Components / MediaPlayer.py
index 2579b27..791274f 100644 (file)
@@ -3,7 +3,7 @@ from MenuList import MenuList
 from Tools.Directories import SCOPE_SKIN_IMAGE, resolveFilename
 from os import path
 
-from enigma import eListboxPythonMultiContent, eListbox, RT_VALIGN_CENTER, gFont, eServiceCenter
+from enigma import eListboxPythonMultiContent, RT_VALIGN_CENTER, gFont, eServiceCenter
 
 from Tools.LoadPixmap import LoadPixmap
 
@@ -14,15 +14,18 @@ STATE_REWIND = 3
 STATE_FORWARD = 4
 STATE_NONE = 5
 
-PlayIcon = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "ico_mp_play.png"))
-PauseIcon = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "ico_mp_pause.png"))
-StopIcon = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "ico_mp_stop.png"))
-RewindIcon = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "ico_mp_rewind.png"))
-ForwardIcon = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "ico_mp_forward.png"))
+PlayIcon = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/ico_mp_play.png"))
+PauseIcon = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/ico_mp_pause.png"))
+StopIcon = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/ico_mp_stop.png"))
+RewindIcon = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/ico_mp_rewind.png"))
+ForwardIcon = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/ico_mp_forward.png"))
 
 def PlaylistEntryComponent(serviceref, state):
        res = [ serviceref ]
-       res.append((eListboxPythonMultiContent.TYPE_TEXT,25, 0, 470, 32, 0, RT_VALIGN_CENTER, path.split(serviceref.getPath().split('/')[-1])[1]))
+       text = serviceref.getName()
+       if text is "":
+               text = path.split(serviceref.getPath().split('/')[-1])[1]
+       res.append((eListboxPythonMultiContent.TYPE_TEXT,25, 0, 470, 32, 0, RT_VALIGN_CENTER, text))
        png = None
        if state == STATE_PLAY:
                png = PlayIcon
@@ -42,7 +45,7 @@ def PlaylistEntryComponent(serviceref, state):
 
 class PlayList(MenuList):
        def __init__(self, enableWrapAround = False):
-               MenuList.__init__(self, [], enableWrapAround, eListboxPythonMultiContent())
+               MenuList.__init__(self, [], enableWrapAround, eListboxPythonMultiContent)
                self.l.setFont(0, gFont("Regular", 18))
                self.l.setItemHeight(22)
                self.currPlaying = -1
@@ -61,6 +64,10 @@ class PlayList(MenuList):
        def addFile(self, serviceref):
                self.list.append(PlaylistEntryComponent(serviceref, STATE_NONE))
 
+       def updateFile(self, index, newserviceref):
+               if index < len(self.list):
+                   self.list[index] = PlaylistEntryComponent(newserviceref, STATE_NONE)
+
        def deleteFile(self, index):
                if self.currPlaying >= index:
                        self.currPlaying -= 1