예제 #1
0
파일: plugin.py 프로젝트: OpenDMM/enigma2
	def __init__(self, session, dvd_device = None, dvd_filelist = [ ], args = None):
		Screen.__init__(self, session)
		InfoBarBase.__init__(self)
		InfoBarCueSheetSupport.__init__(self, actionmap = "MediaPlayerCueSheetActions")
		InfoBarShowHide.__init__(self)
		InfoBarAudioSelection.__init__(self)
		InfoBarSubtitleSupport.__init__(self)
		InfoBarExtensions.__init__(self)
		InfoBarPlugins.__init__(self)
		InfoBarNotifications.__init__(self)
		HelpableScreen.__init__(self)
		self.save_infobar_seek_config()
		self.change_infobar_seek_config()
		InfoBarSeek.__init__(self)
		InfoBarPVRState.__init__(self)
		self.dvdScreen = self.session.instantiateDialog(DVDOverlay)

		self.oldService = self.session.nav.getCurrentlyPlayingServiceReference()
		self.session.nav.stopService()
		self["audioLabel"] = Label("n/a")
		self["subtitleLabel"] = Label("")
		self["angleLabel"] = Label("")
		self["chapterLabel"] = Label("")
		self["anglePix"] = Pixmap()
		self["anglePix"].hide()
		self.last_audioString = None
		self.last_subtitleString = None
		self.last_angleTuple = None
		self.totalChapters = 0
		self.currentChapter = 0
		self.totalTitles = 0
		self.currentTitle = 0
		self._subs_enabled = False

		self.__event_tracker = ServiceEventTracker(screen=self, eventmap=
			{
				iPlayableService.evEnd: self.__serviceStopped,
				iPlayableService.evStopped: self.__serviceStopped,
				iPlayableService.evAudioListChanged: self.__osdAudioInfoAvail,
				iPlayableService.evSubtitleListChanged: self.__osdSubtitleInfoAvail,
				iPlayableService.evUser+1: self.__statePlay,
				iPlayableService.evUser+2: self.__statePause,
				iPlayableService.evUser+3: self.__osdFFwdInfoAvail,
				iPlayableService.evUser+4: self.__osdFBwdInfoAvail,
				iPlayableService.evUser+5: self.__osdStringAvail,
				iPlayableService.evUser+6: self.__osdAngleInfoAvail,
				iPlayableService.evUser+7: self.__chapterUpdated,
				iPlayableService.evUser+8: self.__titleUpdated,
				iPlayableService.evUser+9: self.__menuOpened,
				iPlayableService.evUser+10: self.__menuClosed
			})

		self["DVDPlayerDirectionActions"] = ActionMap(["DirectionActions"],
			{
				#MENU KEY DOWN ACTIONS
				"left": self.keyLeft,
				"right": self.keyRight,
				"up": self.keyUp,
				"down": self.keyDown,

				#MENU KEY REPEATED ACTIONS
				"leftRepeated": self.doNothing,
				"rightRepeated": self.doNothing,
				"upRepeated": self.doNothing,
				"downRepeated": self.doNothing,

				#MENU KEY UP ACTIONS
				"leftUp": self.doNothing,
				"rightUp": self.doNothing,
				"upUp": self.doNothing,
				"downUp": self.doNothing,
			})

		self["OkCancelActions"] = ActionMap(["OkCancelActions"],
			{
				"ok": self.keyOk,
				"cancel": self.keyCancel,
			})

		self["DVDPlayerPlaybackActions"] = HelpableActionMap(self, "DVDPlayerActions",
			{
				#PLAYER ACTIONS
				"dvdMenu": (self.enterDVDMenu, _("show DVD main menu")),
				"toggleInfo": (self.toggleInfo, _("toggle time, chapter, audio, subtitle info")),
				"nextChapter": (self.nextChapter, _("forward to the next chapter")),
				"prevChapter": (self.prevChapter, _("rewind to the previous chapter")),
				"nextTitle": (self.nextTitle, _("jump forward to the next title")),
				"prevTitle": (self.prevTitle, _("jump back to the previous title")),
				"tv": (self.askLeavePlayer, _("exit DVD player or return to file browser")),
				"dvdAudioMenu": (self.enterDVDAudioMenu, _("(show optional DVD audio menu)")),
				"AudioSelection": (self.enterAudioSelection, _("Select audio track")),
				"nextAudioTrack": (self.nextAudioTrack, _("switch to the next audio track")),
				"nextSubtitleTrack": (self.nextSubtitleTrack, _("switch to the next subtitle language")),
				"nextAngle": (self.nextAngle, _("switch to the next angle")),
				"seekBeginning": self.seekBeginning,
			}, -2)

		self["NumberActions"] = NumberActionMap( [ "NumberActions"],
			{
				"1": self.keyNumberGlobal,
				"2": self.keyNumberGlobal,
				"3": self.keyNumberGlobal,
				"4": self.keyNumberGlobal,
				"5": self.keyNumberGlobal,
				"6": self.keyNumberGlobal,
				"7": self.keyNumberGlobal,
				"8": self.keyNumberGlobal,
				"9": self.keyNumberGlobal,
				"0": self.keyNumberGlobal,
			})

		self.onClose.append(self.__onClose)

		from Plugins.SystemPlugins.Hotplug.plugin import hotplugNotifier
		hotplugNotifier.append(self.hotplugCB)

		self.autoplay = dvd_device or dvd_filelist

		if dvd_device:
			self.physicalDVD = True
		else:
			self.scanHotplug()

		self.dvd_filelist = dvd_filelist
		self.onFirstExecBegin.append(self.opened)
		self.service = None
		self.in_menu = False
예제 #2
0
    def __init__(self, session, dvd_device=None, dvd_filelist=[], args=None):
        Screen.__init__(self, session)
        InfoBarBase.__init__(self)
        InfoBarCueSheetSupport.__init__(self,
                                        actionmap="MediaPlayerCueSheetActions")
        InfoBarShowHide.__init__(self)
        InfoBarAudioSelection.__init__(self)
        InfoBarSubtitleSupport.__init__(self)
        self.subtitle_window.real_hide = self.subtitle_window.hide
        self.subtitle_window.hide = self.SubtitleWindowFakeHide
        InfoBarExtensions.__init__(self)
        InfoBarPlugins.__init__(self)
        InfoBarNotifications.__init__(self)
        HelpableScreen.__init__(self)
        self.save_infobar_seek_config()
        self.change_infobar_seek_config()
        InfoBarSeek.__init__(self)
        InfoBarPVRState.__init__(self)
        self.dvdScreen = self.session.instantiateDialog(DVDOverlay)

        self.oldService = self.session.nav.getCurrentlyPlayingServiceReference(
        )
        self.session.nav.stopService()
        self["audioLabel"] = Label("n/a")
        self["subtitleLabel"] = Label("")
        self["angleLabel"] = Label("")
        self["chapterLabel"] = Label("")
        self["anglePix"] = Pixmap()
        self["anglePix"].hide()
        self.last_audioString = None
        self.last_subtitleString = None
        self.last_angleTuple = None
        self.totalChapters = 0
        self.currentChapter = 0
        self.totalTitles = 0
        self.currentTitle = 0
        self._subs_enabled = False

        self.__event_tracker = ServiceEventTracker(
            screen=self,
            eventmap={
                iPlayableService.evEnd: self.__serviceStopped,
                iPlayableService.evStopped: self.__serviceStopped,
                iPlayableService.evAudioListChanged: self.__osdAudioInfoAvail,
                iPlayableService.evSubtitleListChanged:
                self.__osdSubtitleInfoAvail,
                iPlayableService.evUser + 1: self.__statePlay,
                iPlayableService.evUser + 2: self.__statePause,
                iPlayableService.evUser + 3: self.__osdFFwdInfoAvail,
                iPlayableService.evUser + 4: self.__osdFBwdInfoAvail,
                iPlayableService.evUser + 5: self.__osdStringAvail,
                iPlayableService.evUser + 6: self.__osdAngleInfoAvail,
                iPlayableService.evUser + 7: self.__chapterUpdated,
                iPlayableService.evUser + 8: self.__titleUpdated,
                iPlayableService.evUser + 9: self.__menuOpened,
                iPlayableService.evUser + 10: self.__menuClosed
            })

        self["DVDPlayerDirectionActions"] = ActionMap(
            ["DirectionActions"],
            {
                #MENU KEY DOWN ACTIONS
                "left": self.keyLeft,
                "right": self.keyRight,
                "up": self.keyUp,
                "down": self.keyDown,

                #MENU KEY REPEATED ACTIONS
                "leftRepeated": self.doNothing,
                "rightRepeated": self.doNothing,
                "upRepeated": self.doNothing,
                "downRepeated": self.doNothing,

                #MENU KEY UP ACTIONS
                "leftUp": self.doNothing,
                "rightUp": self.doNothing,
                "upUp": self.doNothing,
                "downUp": self.doNothing,
            })

        self["OkCancelActions"] = ActionMap(["OkCancelActions"], {
            "ok": self.keyOk,
            "cancel": self.keyCancel,
        })

        self["DVDPlayerPlaybackActions"] = HelpableActionMap(
            self,
            "DVDPlayerActions",
            {
                #PLAYER ACTIONS
                "dvdMenu": (self.enterDVDMenu, _("show DVD main menu")),
                "toggleInfo":
                (self.toggleInfo,
                 _("toggle time, chapter, audio, subtitle info")),
                "nextChapter":
                (self.nextChapter, _("forward to the next chapter")),
                "prevChapter":
                (self.prevChapter, _("rewind to the previous chapter")),
                "nextTitle":
                (self.nextTitle, _("jump forward to the next title")),
                "prevTitle":
                (self.prevTitle, _("jump back to the previous title")),
                "tv": (self.askLeavePlayer,
                       _("exit DVD player or return to file browser")),
                "dvdAudioMenu":
                (self.enterDVDAudioMenu, _("(show optional DVD audio menu)")),
                "AudioSelection":
                (self.enterAudioSelection, _("Select audio track")),
                "nextAudioTrack":
                (self.nextAudioTrack, _("switch to the next audio track")),
                "nextSubtitleTrack":
                (self.nextSubtitleTrack,
                 _("switch to the next subtitle language")),
                "nextAngle": (self.nextAngle, _("switch to the next angle")),
                "seekBeginning":
                self.seekBeginning,
            },
            -2)

        self["NumberActions"] = NumberActionMap(
            ["NumberActions"], {
                "1": self.keyNumberGlobal,
                "2": self.keyNumberGlobal,
                "3": self.keyNumberGlobal,
                "4": self.keyNumberGlobal,
                "5": self.keyNumberGlobal,
                "6": self.keyNumberGlobal,
                "7": self.keyNumberGlobal,
                "8": self.keyNumberGlobal,
                "9": self.keyNumberGlobal,
                "0": self.keyNumberGlobal,
            })

        self.onClose.append(self.__onClose)

        from Plugins.SystemPlugins.Hotplug.plugin import hotplugNotifier
        hotplugNotifier.append(self.hotplugCB)

        self.autoplay = dvd_device or dvd_filelist

        if dvd_device:
            self.physicalDVD = True
        else:
            self.scanHotplug()

        self.dvd_filelist = dvd_filelist
        self.onFirstExecBegin.append(self.opened)
        self.service = None
        self.in_menu = False
예제 #3
0
    def __init__(self,
                 session,
                 service,
                 restoreService=True,
                 infoCallback=None,
                 getNextService=None,
                 getPrevService=None,
                 stopCallback=None,
                 pauseCallback=None,
                 streamMode=False,
                 askBeforeLeaving=True):
        Screen.__init__(self, session)
        InfoBarBase.__init__(self)
        InfoBarSeek.__init__(self)
        InfoBarShowHide.__init__(self)
        InfoBarAudioSelection.__init__(self)
        InfoBarSubtitleSupport.__init__(self)
        InfoBarCueSheetSupport.__init__(self)
        InfoBarServiceErrorPopupSupport.__init__(self)
        InfoBarExtensions.__init__(self)
        InfoBarPlugins.__init__(self)
        InfoBarNotifications.__init__(self)
        #TODO FIX THIS HACK
        # currently we just want to be able to resume playback (if supported by e2),
        # for now we don't care about cutting or jumpmarks or anything like that...
        del self["CueSheetActions"]

        self.session = session
        self.service = service
        self.infoCallback = infoCallback
        self.getNextServiceCB = getNextService
        self.getPrevServiceCB = getPrevService
        self.stopCB = stopCallback
        self.pauseCB = pauseCallback
        self.callback = None
        self.screen_timeout = 5000
        self.nextservice = None
        self.is_closing = False

        if not restoreService:  # lastservice is handled by PlayerBase which is inherited by InfoBarSeek
            # take care... when a zap timer want to zap to a service the player is closed and lastservice is changed in onClose callback of PlayerBase!
            self.lastservice = None

        self.streamMode = streamMode

        self["actions"] = ActionMap(
            [
                "OkCancelActions", "InfobarSeekActions", "MediaPlayerActions",
                "MovieSelectionActions"
            ], {
                "cancel": self.leavePlayer,
                "stop": self.leavePlayer,
                "playpauseService": self.playpause,
                "previous": self.playPrev,
                "next": self.playNext,
                "showEventInfo": self.showVideoInfo,
            }, -2)

        self.returning = False
        self._askBeforeLeaving = askBeforeLeaving

        self.onFirstExecBegin.append(self.play)
        self.onClose.append(self.__onClose)