from os import path as os_path, remove as os_remove, listdir as os_listdir
from time import strftime
-from enigma import iPlayableService, eTimer, eServiceCenter, iServiceInformation
+from enigma import iPlayableService, eTimer, eServiceCenter, iServiceInformation, loadPic
from Screens.Screen import Screen
from Screens.MessageBox import MessageBox
from Screens.InputBox import InputBox
from Components.ServicePosition import ServicePositionGauge
from Components.ServiceEventTracker import ServiceEventTracker, InfoBarBase
from Components.Playlist import PlaylistIOInternal, PlaylistIOM3U, PlaylistIOPLS
+from Components.AVSwitch import AVSwitch
from Screens.InfoBarGenerics import InfoBarSeek, InfoBarAudioSelection, InfoBarCueSheetSupport, InfoBarNotifications, InfoBarSubtitleSupport
from ServiceReference import ServiceReference
from Screens.ChoiceBox import ChoiceBox
break
if self.default_pixmap is None:
self.default_pixmap = resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/no_coverArt.png")
+ self.coverFileNames = ["folder.png", "folder.jpg"]
return Pixmap.applySkin(self, desktop, screen)
class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoBarCueSheetSupport, InfoBarNotifications, InfoBarSubtitleSupport, HelpableScreen):
def updateCoverArtPixmap(self, path):
while not path.endswith("/"):
path = path[:-1]
- pngname = path + "folder.png"
-
- if not fileExists(pngname):
- pngname = self["coverArt"].default_pixmap
- if self.coverArtFileName != pngname:
- self.coverArtFileName = pngname
- self["coverArt"].instance.setPixmapFromFile(self.coverArtFileName)
+ new_coverArtFileName = self["coverArt"].default_pixmap
+ for filename in self["coverArt"].coverFileNames:
+ if fileExists(path + filename):
+ new_coverArtFileName = path + filename
+ if self.coverArtFileName != new_coverArtFileName:
+ self.coverArtFileName = new_coverArtFileName
+ pixmap = loadPic(self.coverArtFileName, 116, 116, AVSwitch().getAspectRatioSetting()/2,1,0,0)
+ if pixmap is not None:
+ self["coverArt"].instance.setPixmap(pixmap.__deref__())
def leftDown(self):
self.lefttimer = True
if x[0][1] == True: #isDir
if recursive:
self.copyDirectory(x[0][0])
- elif filelist.getServiceRef().type != 4098:
+ elif filelist.getServiceRef() and filelist.getServiceRef().type == 4097:
self.playlist.addFile(x[0][0])
self.playlist.updateList()
if self.filelist.getServiceRef().type == 4098: # playlist
ServiceRef = self.filelist.getServiceRef()
extension = ServiceRef.getPath()[ServiceRef.getPath().rfind('.') + 1:]
- print "extension:", extension
if self.playlistparsers.has_key(extension):
playlist = self.playlistparsers[extension]()
list = playlist.open(ServiceRef.getPath())
self.unPauseService()
if needsInfoUpdate == True:
- self.updateCoverArtPixmap(currref.getPath())
+ path = self.playlist.getServiceRefList()[self.playlist.getCurrentIndex()].getPath()
+ self.updateCoverArtPixmap(path)
else:
pngname = self["coverArt"].default_pixmap
self.coverArtFileName = pngname
self["text4"] = Label("")
def setText(self, text, line):
- print "lcd set text:", text, line
if len(text) > 10:
if text[-4:] == ".mp3":
text = text[:-4]