allow gstreamer to signalize missing plugins to the gui (requires reconfiguring enigm...
[enigma2.git] / lib / python / Plugins / Extensions / DVDPlayer / plugin.py
index 0d1f65fb8eaf4846b2e55caf226b1bd88f47f3a8..b201d2c6df682a8a2e006e4dec01bdce6965525d 100644 (file)
@@ -12,6 +12,7 @@ from Components.MenuList import MenuList
 from Components.ServiceEventTracker import ServiceEventTracker, InfoBarBase
 from Components.config import config
 from Tools.Directories import pathExists, fileExists
+from Components.Harddisk import harddiskmanager
 
 import servicedvd # load c++ part of dvd player plugin
 
@@ -275,13 +276,13 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP
                                iPlayableService.evUser+12: self.__menuClosed
                        })
 
-               self["DVDPlayerDirectionActions"] = HelpableActionMap(self, "DirectionActions",
+               self["DVDPlayerDirectionActions"] = ActionMap(["DirectionActions"],
                        {
                                #MENU KEY DOWN ACTIONS
-                               "left": (self.keyLeft, _("DVD left key")),
-                               "right": (self.keyRight, _("DVD right key")),
-                               "up": (self.keyUp, _("DVD up key")),
-                               "down": (self.keyDown, _("DVD down key")),
+                               "left": self.keyLeft,
+                               "right": self.keyRight,
+                               "up": self.keyUp,
+                               "down": self.keyDown,
 
                                #MENU KEY REPEATED ACTIONS
                                "leftRepeated": self.doNothing,
@@ -294,13 +295,13 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP
                                "rightUp": self.doNothing,
                                "upUp": self.doNothing,
                                "downUp": self.doNothing,
-                       }, -2)
+                       })
 
-               self["OkCancelActions"] = HelpableActionMap(self, "OkCancelActions",
+               self["OkCancelActions"] = ActionMap(["OkCancelActions"],
                        {
-                               "ok": (self.keyOk, _("DVD ENTER key")),
+                               "ok": self.keyOk,
                                "cancel": self.keyCancel,
-                       }, -2)
+                       })
 
                self["DVDPlayerPlaybackActions"] = HelpableActionMap(self, "DVDPlayerActions",
                        {
@@ -315,7 +316,7 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP
                                "dvdAudioMenu": (self.enterDVDAudioMenu, _("(show optional DVD audio menu)")),
                                "nextAudioTrack": (self.nextAudioTrack, _("switch to the next audio track")),
                                "nextSubtitleTrack": (self.nextSubtitleTrack, _("switch to the next subtitle language")),
-                               "seekBeginning": (self.seekBeginning, _("Jump to video title 1 (play movie from start)")),
+                               "seekBeginning": self.seekBeginning,
                        }, -2)
                        
                self["NumberActions"] = NumberActionMap( [ "NumberActions"],
@@ -338,9 +339,9 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP
                                self.dvd_device = dvd_device
                                self.physicalDVD = True
                else:
-                       if fileExists("/dev/cdroms/cdrom0"):
-                               print "physical dvd found (/dev/cdroms/cdrom0)"
-                               self.dvd_device = "/dev/cdroms/cdrom0"
+                       if fileExists(harddiskmanager.getCD()):
+                               print "physical dvd found:", harddiskmanager.getCD()
+                               self.dvd_device = harddiskmanager.getCD()
                                self.physicalDVD = True
                        else:
                                self.dvd_device = None
@@ -429,22 +430,24 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP
        def __osdAudioInfoAvail(self):
                audioTuple = self.service.info().getInfoObject(iServiceInformation.sUser+6)
                print "AudioInfoAvail ", repr(audioTuple)
-               audioString = "%d: %s (%s)" % (audioTuple[0],audioTuple[1],audioTuple[2])
-               self["audioLabel"].setText(audioString)
-               if audioTuple != self.last_audioTuple and not self.in_menu:
-                       self.doShow()
-               self.last_audioTuple = audioTuple
+               if audioTuple:
+                       audioString = "%d: %s (%s)" % (audioTuple[0],audioTuple[1],audioTuple[2])
+                       self["audioLabel"].setText(audioString)
+                       if audioTuple != self.last_audioTuple and not self.in_menu:
+                               self.doShow()
+                       self.last_audioTuple = audioTuple
 
        def __osdSubtitleInfoAvail(self):
                subtitleTuple = self.service.info().getInfoObject(iServiceInformation.sUser+7)
                print "SubtitleInfoAvail ", repr(subtitleTuple)
-               subtitleString = ""
-               if subtitleTuple[0] is not 0:
-                       subtitleString = "%d: %s" % (subtitleTuple[0],subtitleTuple[1])
-               self["subtitleLabel"].setText(subtitleString)
-               if subtitleTuple != self.last_subtitleTuple and not self.in_menu:
-                       self.doShow()
-               self.last_subtitleTuple = subtitleTuple
+               if subtitleTuple:
+                       subtitleString = ""
+                       if subtitleTuple[0] is not 0:
+                               subtitleString = "%d: %s" % (subtitleTuple[0],subtitleTuple[1])
+                       self["subtitleLabel"].setText(subtitleString)
+                       if subtitleTuple != self.last_subtitleTuple and not self.in_menu:
+                               self.doShow()
+                       self.last_subtitleTuple = subtitleTuple
 
        def __chapterUpdated(self):
                self.currentChapter = self.service.info().getInfo(iServiceInformation.sCurrentChapter)
@@ -539,7 +542,7 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP
 
        def showFileBrowser(self):
                if self.physicalDVD and len(self.dvd_filelist) == 0:
-                       if self.dvd_device == "/dev/cdroms/cdrom0":
+                       if self.dvd_device == harddiskmanager.getCD():
                                self.session.openWithCallback(self.DVDdriveCB, MessageBox, text=_("Do you want to play DVD in drive?"), timeout=5 )
                        else:
                                self.DVDdriveCB(True)