X-Git-Url: http://code.vuplus.com/gitweb/?a=blobdiff_plain;f=lib%2Fpython%2FComponents%2FMediaPlayer.py;h=44937fa3de825429e47ad5a3cd20c47f6461ec92;hb=ed40f6f85c9c07c3c1224ae20601082c0309a631;hp=45551ccc1f368e5a866eaaddb701ab0e653378f8;hpb=25b529dd304871c705456047049dd29935f1ffe3;p=vuplus_dvbapp diff --git a/lib/python/Components/MediaPlayer.py b/lib/python/Components/MediaPlayer.py index 45551cc..44937fa 100644 --- a/lib/python/Components/MediaPlayer.py +++ b/lib/python/Components/MediaPlayer.py @@ -3,19 +3,10 @@ from GUIComponent import * from MenuList import MenuList -from Tools.Directories import * -import os +from Tools.Directories import SCOPE_SKIN_IMAGE, resolveFilename +from os import path -from enigma import * - -RT_HALIGN_LEFT = 0 -RT_HALIGN_RIGHT = 1 -RT_HALIGN_CENTER = 2 -RT_HALIGN_BLOCK = 4 - -RT_VALIGN_TOP = 0 -RT_VALIGN_CENTER = 8 -RT_VALIGN_BOTTOM = 16 +from enigma import eListboxPythonMultiContent, eListbox, RT_VALIGN_CENTER, loadPNG, gFont STATE_PLAY = 0 STATE_PAUSE = 1 @@ -32,7 +23,7 @@ ForwardIcon = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "ico_mp_forward.png")) def PlaylistEntryComponent(serviceref, state): res = [ serviceref ] - res.append((eListboxPythonMultiContent.TYPE_TEXT,25, 0, 470, 32, 0, RT_VALIGN_CENTER, os.path.split(serviceref.getPath().split('/')[-1])[1])) + res.append((eListboxPythonMultiContent.TYPE_TEXT,25, 0, 470, 32, 0, RT_VALIGN_CENTER, path.split(serviceref.getPath().split('/')[-1])[1])) png = None if state == STATE_PLAY: png = PlayIcon @@ -57,13 +48,13 @@ class PlayList(MenuList, HTMLComponent, GUIComponent): self.list = [] self.l.setList(self.list) self.l.setFont(0, gFont("Regular", 18)) - self.currPlaying = 0 + self.currPlaying = -1 self.oldCurrPlaying = -1 def clear(self): del self.list[:] self.l.setList(self.list) - self.currPlaying = 0 + self.currPlaying = -1 self.oldCurrPlaying = -1 GUI_WIDGET = eListbox @@ -93,7 +84,8 @@ class PlayList(MenuList, HTMLComponent, GUIComponent): def updateState(self, state): if len(self.list) > self.oldCurrPlaying and self.oldCurrPlaying != -1: self.list[self.oldCurrPlaying] = PlaylistEntryComponent(self.list[self.oldCurrPlaying][0], STATE_NONE) - self.list[self.currPlaying] = PlaylistEntryComponent(self.list[self.currPlaying][0], state) + if self.currPlaying != -1 and self.currPlaying < len(self.list): + self.list[self.currPlaying] = PlaylistEntryComponent(self.list[self.currPlaying][0], state) self.updateList() def playFile(self):