add missing dm800se color oled screens. refs #530
[enigma2.git] / lib / python / Plugins / Extensions / MediaPlayer / plugin.py
old mode 100644 (file)
new mode 100755 (executable)
index 0f46c99..28cf723
@@ -19,7 +19,7 @@ from Components.Playlist import PlaylistIOInternal, PlaylistIOM3U, PlaylistIOPLS
 from Components.AVSwitch import AVSwitch
 from Components.Harddisk import harddiskmanager
 from Components.config import config
-from Tools.Directories import fileExists, pathExists, resolveFilename, SCOPE_CONFIG, SCOPE_PLAYLIST, SCOPE_SKIN_IMAGE
+from Tools.Directories import fileExists, pathExists, resolveFilename, SCOPE_CONFIG, SCOPE_PLAYLIST, SCOPE_CURRENT_SKIN
 from settings import MediaPlayerSettings
 import random
 
@@ -50,7 +50,7 @@ class MediaPixmap(Pixmap):
                                        noCoverFile = value
                                        break
                if noCoverFile is None:
-                       noCoverFile = resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/no_coverArt.png")
+                       noCoverFile = resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/no_coverArt.png")
                self.noCoverPixmap = LoadPixmap(noCoverFile)
                return Pixmap.applySkin(self, desktop, screen)
 
@@ -110,7 +110,7 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB
 
                # 'None' is magic to start at the list of mountpoints
                defaultDir = config.mediaplayer.defaultDir.getValue()
-               self.filelist = FileList(defaultDir, matchingPattern = "(?i)^.*\.(mp2|mp3|ogg|ts|wav|wave|m3u|pls|e2pls|mpg|vob|avi|divx|mkv|mp4|m4a|dat|flac|mov)", useServiceRef = True, additionalExtensions = "4098:m3u 4098:e2pls 4098:pls")
+               self.filelist = FileList(defaultDir, matchingPattern = "(?i)^.*\.(mp2|mp3|ogg|ts|wav|wave|m3u|pls|e2pls|mpg|vob|avi|divx|m4v|mkv|mp4|m4a|dat|flac|mov)", useServiceRef = True, additionalExtensions = "4098:m3u 4098:e2pls 4098:pls")
                self["filelist"] = self.filelist
 
                self.playlist = MyPlayList()
@@ -212,7 +212,7 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB
                self.isAudioCD = False
                self.AudioCD_albuminfo = {}
                self.cdAudioTrackFiles = []
-               self.applySettings()
+               self.onShown.append(self.applySettings)
 
                self.playlistIOInternal = PlaylistIOInternal()
                list = self.playlistIOInternal.open(resolveFilename(SCOPE_CONFIG, "playlist.e2pls"))
@@ -241,7 +241,10 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB
                for x in self.playlist.list:
                        self.playlistIOInternal.addService(ServiceReference(x[0]))
                if self.savePlaylistOnExit:
-                       self.playlistIOInternal.save(resolveFilename(SCOPE_CONFIG, "playlist.e2pls"))
+                       try:
+                               self.playlistIOInternal.save(resolveFilename(SCOPE_CONFIG, "playlist.e2pls"))
+                       except IOError:
+                               print "couldn't save playlist.e2pls"
                if config.mediaplayer.saveDirOnExit.getValue():
                        config.mediaplayer.defaultDir.setValue(self.filelist.getCurrentDirectory())
                        config.mediaplayer.defaultDir.save()
@@ -264,23 +267,23 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB
 
        def __evUpdatedInfo(self):
                currPlay = self.session.nav.getCurrentService()
-               currenttitle = currPlay.info().getInfo(iServiceInformation.sCurrentTitle)
-               totaltitles = currPlay.info().getInfo(iServiceInformation.sTotalTitles)
-               sTitle = currPlay.info().getInfoString(iServiceInformation.sTitle)
-               print "[__evUpdatedInfo] title %d of %d (%s)" % (currenttitle, totaltitles, sTitle)
+               sTagTrackNumber = currPlay.info().getInfo(iServiceInformation.sTagTrackNumber)
+               sTagTrackCount = currPlay.info().getInfo(iServiceInformation.sTagTrackCount)
+               sTagTitle = currPlay.info().getInfoString(iServiceInformation.sTagTitle)
+               print "[__evUpdatedInfo] title %d of %d (%s)" % (sTagTrackNumber, sTagTrackCount, sTagTitle)
                self.readTitleInformation()
 
        def __evAudioDecodeError(self):
                currPlay = self.session.nav.getCurrentService()
-               sAudioType = currPlay.info().getInfoString(iServiceInformation.sUser+10)
-               print "[__evAudioDecodeError] audio-codec %s can't be decoded by hardware" % (sAudioType)
-               self.session.open(MessageBox, _("This Dreambox can't decode %s streams!") % sAudioType, type = MessageBox.TYPE_INFO,timeout = 20 )
+               sTagAudioCodec = currPlay.info().getInfoString(iServiceInformation.sTagAudioCodec)
+               print "[__evAudioDecodeError] audio-codec %s can't be decoded by hardware" % (sTagAudioCodec)
+               self.session.open(MessageBox, _("This Dreambox can't decode %s streams!") % sTagAudioCodec, type = MessageBox.TYPE_INFO,timeout = 20 )
 
        def __evVideoDecodeError(self):
                currPlay = self.session.nav.getCurrentService()
-               sVideoType = currPlay.info().getInfoString(iServiceInformation.sVideoType)
-               print "[__evVideoDecodeError] video-codec %s can't be decoded by hardware" % (sVideoType)
-               self.session.open(MessageBox, _("This Dreambox can't decode %s streams!") % sVideoType, type = MessageBox.TYPE_INFO,timeout = 20 )
+               sTagVideoCodec = currPlay.info().getInfoString(iServiceInformation.sTagVideoCodec)
+               print "[__evVideoDecodeError] video-codec %s can't be decoded by hardware" % (sTagVideoCodec)
+               self.session.open(MessageBox, _("This Dreambox can't decode %s streams!") % sTagVideoCodec, type = MessageBox.TYPE_INFO,timeout = 20 )
 
        def __evPluginError(self):
                currPlay = self.session.nav.getCurrentService()
@@ -295,11 +298,11 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB
        def readTitleInformation(self):
                currPlay = self.session.nav.getCurrentService()
                if currPlay is not None:
-                       sTitle = currPlay.info().getInfoString(iServiceInformation.sTitle)
-                       sAlbum = currPlay.info().getInfoString(iServiceInformation.sAlbum)
-                       sGenre = currPlay.info().getInfoString(iServiceInformation.sGenre)
-                       sArtist = currPlay.info().getInfoString(iServiceInformation.sArtist)
-                       sYear = currPlay.info().getInfoString(iServiceInformation.sTimeCreate)
+                       sTitle = currPlay.info().getInfoString(iServiceInformation.sTagTitle)
+                       sAlbum = currPlay.info().getInfoString(iServiceInformation.sTagAlbum)
+                       sGenre = currPlay.info().getInfoString(iServiceInformation.sTagGenre)
+                       sArtist = currPlay.info().getInfoString(iServiceInformation.sTagArtist)
+                       sYear = currPlay.info().getInfoString(iServiceInformation.sTagDate)
 
                        if sTitle == "":
                                if not self.isAudioCD:
@@ -901,7 +904,7 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB
                
        def subtitleSelection(self):
                from Screens.Subtitles import Subtitles
-               self.session.open(Subtitles)
+               self.session.open(Subtitles, self)
        
        def hotplugCB(self, dev, media_state):
                if dev == harddiskmanager.getCD():
@@ -922,12 +925,17 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB
                                        self.clear_playlist()
 
 class MediaPlayerLCDScreen(Screen):
-       skin = """
-       <screen position="0,0" size="132,64" title="LCD Text">
+       skin = (
+       """<screen name="MediaPlayerLCDScreen" position="0,0" size="132,64" id="1">
                <widget name="text1" position="4,0" size="132,35" font="Regular;16"/>
                <widget name="text3" position="4,36" size="132,14" font="Regular;10"/>
                <widget name="text4" position="4,49" size="132,14" font="Regular;10"/>
-       </screen>"""
+       </screen>""",
+       """<screen name="MediaPlayerLCDScreen" position="0,0" size="96,64" id="2">
+               <widget name="text1" position="0,0" size="96,35" font="Regular;14"/>
+               <widget name="text3" position="0,36" size="96,14" font="Regular;10"/>
+               <widget name="text4" position="0,49" size="96,14" font="Regular;10"/>
+       </screen>""")
 
        def __init__(self, session, parent):
                Screen.__init__(self, session)