ServiceName converter now can handle iPlayableService's and
[enigma2.git] / lib / python / Components / MediaPlayer.py
index aff191997e687e97c7d8f9cdb26319d6fad4c0bd..a728aef77a5ce0d7ff8bad636e0011b0cdcb7af9 100644 (file)
@@ -1,12 +1,12 @@
-from HTMLComponent import *
-from GUIComponent import *
+from HTMLComponent import HTMLComponent
+from GUIComponent import GUIComponent
 
 from MenuList import MenuList
 
 from Tools.Directories import SCOPE_SKIN_IMAGE, resolveFilename
 from os import path
 
-from enigma import eListboxPythonMultiContent, eListbox, RT_VALIGN_CENTER, loadPNG, gFont
+from enigma import eListboxPythonMultiContent, eListbox, RT_VALIGN_CENTER, loadPNG, gFont, eServiceCenter
 
 STATE_PLAY = 0
 STATE_PAUSE = 1
@@ -48,8 +48,10 @@ class PlayList(MenuList, HTMLComponent, GUIComponent):
                self.list = []
                self.l.setList(self.list)
                self.l.setFont(0, gFont("Regular", 18))
+               self.l.setItemHeight(22)
                self.currPlaying = -1
                self.oldCurrPlaying = -1
+               self.serviceHandler = eServiceCenter.getInstance()
        
        def clear(self):
                del self.list[:]
@@ -61,7 +63,6 @@ class PlayList(MenuList, HTMLComponent, GUIComponent):
 
        def postWidgetCreate(self, instance):
                instance.setContent(self.l)
-               instance.setItemHeight(22)
 
        def getSelection(self):
                return self.l.getCurrentSelection()[0]
@@ -108,6 +109,14 @@ class PlayList(MenuList, HTMLComponent, GUIComponent):
                
        def getCurrentIndex(self):
                return self.currPlaying
+
+       def getCurrentEvent(self):
+               l = self.l.getCurrentSelection()
+               return l and self.serviceHandler.info(l[0]).getEvent(l[0])
+
+       def getCurrent(self):
+               l = self.l.getCurrentSelection()
+               return l and l[0]
        
        def getServiceRefList(self):
                return [ x[0] for x in self.list ]