Ejemplo n.º 1
0
    def __init__(self, session, services):
        Screen.__init__(self, session)

        self.skinName = ["MovieRetitle", "Setup"]
        self.list = []
        ConfigListScreenExt.__init__(self, self.list, session)

        self["Path"] = Label(
            _("Location:"
              ))  # + ' ' + os.path.dirname(os.path.splitext(path)[0]))
        self["HelpWindow"] = Pixmap()
        self.onLayoutFinish.append(self.setCustomTitle)

        self["key_green"] = StaticText(_("Save"))
        self["key_red"] = StaticText(_("Cancel"))
        self["actions"] = ActionMap(["SetupActions"], {
            "ok": self.keyGo,
            "save": self.keyGo,
            "cancel": self.keyCancel,
        }, -2)

        self["VirtualKB"] = ActionMap(["VirtualKeyboardActions"], {
            "showVirtualKeyboard": self.KeyText,
        }, -2)
        self["VirtualKB"].setEnabled(False)
        self["HelpWindow"] = Pixmap()
        self["VKeyIcon"] = Pixmap()
        self["VKeyIcon"].hide()
        self["footnote"] = StaticText()
        self["description"] = StaticText()

        self.serviceHandler = ServiceCenter.getInstance()

        if isinstance(services, list):
            self.services = services
        else:
            self.services = [services]

        self.buildSetup(self.services.pop())
	def __init__(self, session, services):
		Screen.__init__(self, session)

		self.skinName = ["MovieRetitle", "Setup"]
		self.list = [ ]
		ConfigListScreenExt.__init__(self, self.list, session)

		self["Path"] = Label(_("Location:"))# + ' ' + os.path.dirname(os.path.splitext(path)[0]))
		self["HelpWindow"] = Pixmap()
		self.onLayoutFinish.append(self.setCustomTitle)

		self["key_green"] = StaticText(_("Save"))
		self["key_red"] = StaticText(_("Cancel"))
		self["actions"] = ActionMap(["SetupActions"],
		{
			"ok": self.keyGo,
			"save": self.keyGo,
			"cancel": self.keyCancel,
		}, -2)

		self["VirtualKB"] = ActionMap(["VirtualKeyboardActions"],
		{
			"showVirtualKeyboard": self.KeyText,
		}, -2)
		self["VirtualKB"].setEnabled(False)
		self["HelpWindow"] = Pixmap()
		self["VKeyIcon"] = Pixmap()
		self["VKeyIcon"].hide()
		self["footnote"] = StaticText()
		self["description"] = StaticText()

		self.serviceHandler = ServiceCenter.getInstance()

		if isinstance(services, list):
			self.services = services
		else:
			self.services = [services]

		self.buildSetup(self.services.pop())
	def __init__(self, session, playlist, playall=None, lastservice=None):
		
		# The CutList must be initialized very first  
		CutList.__init__(self)
		Screen.__init__(self, session)
		HelpableScreen.__init__(self)
		InfoBarSupport.__init__(self)
		
		# Skin
		self.skinName = "EMCMediaCenter"
		skin = None
		CoolWide = getDesktop(0).size().width()
		if CoolWide == 720:
			skin = "/usr/lib/enigma2/python/Plugins/Extensions/EnhancedMovieCenter/CoolSkin/EMCMediaCenter_720.xml"
		elif CoolWide == 1024:
			skin = "/usr/lib/enigma2/python/Plugins/Extensions/EnhancedMovieCenter/CoolSkin/EMCMediaCenter_1024.xml"
		elif CoolWide == 1280:
			skin = "/usr/lib/enigma2/python/Plugins/Extensions/EnhancedMovieCenter/CoolSkin/EMCMediaCenter_1280.xml"
		if skin:
			Cool = open(skin)
			self.skin = Cool.read()
			Cool.close()

		self.serviceHandler = ServiceCenter.getInstance()

		# EMC Source
		self["Service"] = EMCCurrentService(session.nav, self)
		
		# Events
		self.__event_tracker = ServiceEventTracker(screen=self, eventmap=
			{
		# Disabled for tests
		# If we enable them, the sound will be delayed for about 2 seconds ?
				iPlayableService.evStart: self.__serviceStarted,
				iPlayableService.evStopped: self.__serviceStopped,
				#iPlayableService.evEnd: self.__evEnd,
				#iPlayableService.evEOF: self.__evEOF,
				#iPlayableService.evUser: self.__timeUpdated,
				#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.__osdAudioInfoAvail,
				iPlayableService.evUser+7: self.__osdSubtitleInfoAvail,
				iPlayableService.evUser+8: self.__chapterUpdated,
				iPlayableService.evUser+9: self.__titleUpdated,
				iPlayableService.evUser+11: self.__menuOpened,
				iPlayableService.evUser+12: self.__menuClosed,
				iPlayableService.evUser+13: self.__osdAngleInfoAvail
			})
			
			# Keymap
	#		self["SeekActions"] = HelpableActionMap(self, "InfobarSeekActions", 							-1 higher priority
	#		self["MovieListActions"] = HelpableActionMap(self, "InfobarMovieListActions", 		0
	#		self["ShowHideActions"] = ActionMap( ["InfobarShowHideActions"] ,  								0
	#		self["EPGActions"] = HelpableActionMap(self, "InfobarEPGActions",									0
	#		self["CueSheetActions"] = HelpableActionMap(self, actionmap,											1 lower priority
	#		self["InstantExtensionsActions"] = HelpableActionMap(self, "InfobarExtensions", 	1 lower priority
	#		self["NumberActions"] = NumberActionMap( [ "NumberActions"],											0 Set by EMC to 2 very lower priority 
	#		self["TeletextActions"] = HelpableActionMap(self, "InfobarTeletextActions",				0 Set by EMC to 2 very lower priority 
	#		self["MenuActions"] = HelpableActionMap(self, "InfobarMenuActions",  							0 Set by EMC to 2 very lower priority 
		if config.EMC.movie_exit.value:
			self["actions"] = HelpableActionMap(self, "CoolPlayerActions",
				{
					"leavePlayer":	(self.leavePlayer, 		_("Stop playback")),
				}) # default priority
		else:
			self["actions"] = HelpableActionMap(self, "CoolPlayerActions2",
				{
					"leavePlayer":	(self.leavePlayer, 		_("Stop playback")),
				}) # default priority
		
		self["DVDPlayerPlaybackActions"] = HelpableActionMap(self, "EMCDVDPlayerActions",
			{
				"dvdMenu": (self.enterDVDMenu, _("show DVD main menu")),
				#"showInfo": (self.showInfo, _("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")),
				"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")),
				"nextAngle": (self.nextAngle, _("switch to the next angle")),
			}, 1) # lower priority
		# Only enabled if playing a dvd
		self["DVDPlayerPlaybackActions"].setEnabled(False)
		
		self["DVDMenuActions"] = ActionMap(["WizardActions"],
			{
				"left": self.keyLeft,
				"right": self.keyRight,
				"up": self.keyUp,
				"down": self.keyDown,
				"ok": self.keyOk,
				"back": self.keyBack,
			}, 2) # lower priority
		# Only enabled during DVD Menu
		self["DVDMenuActions"].setEnabled(False)
		
		self["GeneralPlayerPlaybackActions"] = HelpableActionMap(self, "EMCGeneralPlayerActions",
			{
				"showExtensions": (self.openExtensions, _("view extensions...")),
				"EMCGreen":	(self.CoolAVSwitch,			_("Format AVSwitch")),
				"seekFwd": (self.seekFwd, _("Seek forward")),
				"seekBack": (self.seekBack, _("Seek backward")),
				"movieInfo": (self.infoMovie, _("Movie information")),
			}, 2) # lower priority
		
		self["MenuActions"].prio = 2
		if "TeletextActions" in self:
			self["TeletextActions"].prio = 2
		self["NumberActions"].prio = 2
		
		# Cover Anzeige
		self["Cover"] = Pixmap()
		
		# DVD Player
		self["audioLabel"] = Label("")
		self["subtitleLabel"] = Label("")
		self["angleLabel"] = Label("")
		self["chapterLabel"] = Label("")
		self["anglePix"] = Pixmap()
		self["anglePix"].hide()
		self.last_audioTuple = None
		self.last_subtitleTuple = None
		self.last_angleTuple = None
		self.totalChapters = 0
		self.currentChapter = 0
		self.totalTitles = 0
		self.currentTitle = 0
		self.in_menu = None
		self.dvdScreen = None
		
		# Further initialization
		self.firstStart = True
		self.stopped = False
		self.closedByDelete = False
		self.closeAll = False
		
		self.lastservice = lastservice or self.session.nav.getCurrentlyPlayingServiceReference()
		self.playlist = playlist
		self.playall = playall
		self.playcount = -1
		self.service = None
		
		self.picload = ePicLoad()
		self.picload.PictureData.get().append(self.showCoverCallback)
		
		# Record events
		try:
			NavigationInstance.instance.RecordTimer.on_state_change.append(self.recEvent)
		except Exception, e:
			emcDebugOut("[EMCMediaCenter] Record observer add exception:\n" + str(e))
    def __init__(self, session, playlist, playall=None, lastservice=None):

        # The CutList must be initialized very first
        CutList.__init__(self)
        Screen.__init__(self, session)
        HelpableScreen.__init__(self)
        InfoBarSupport.__init__(self)

        # Skin
        self.skinName = "EMCMediaCenter"
        skin = None
        CoolWide = getDesktop(0).size().width()
        if CoolWide == 720:
            skin = "/usr/lib/enigma2/python/Plugins/Extensions/EnhancedMovieCenter/CoolSkin/EMCMediaCenter_720.xml"
        elif CoolWide == 1024:
            skin = "/usr/lib/enigma2/python/Plugins/Extensions/EnhancedMovieCenter/CoolSkin/EMCMediaCenter_1024.xml"
        elif CoolWide == 1280:
            skin = "/usr/lib/enigma2/python/Plugins/Extensions/EnhancedMovieCenter/CoolSkin/EMCMediaCenter_1280.xml"
        if skin:
            Cool = open(skin)
            self.skin = Cool.read()
            Cool.close()

        self.serviceHandler = ServiceCenter.getInstance()

        # EMC Source
        self["Service"] = EMCCurrentService(session.nav, self)

        # Events
        self.__event_tracker = ServiceEventTracker(
            screen=self,
            eventmap={
                # Disabled for tests
                # If we enable them, the sound will be delayed for about 2 seconds ?
                iPlayableService.evStart:
                self.__serviceStarted,
                iPlayableService.evStopped:
                self.__serviceStopped,
                #iPlayableService.evEnd: self.__evEnd,
                #iPlayableService.evEOF: self.__evEOF,
                #iPlayableService.evUser: self.__timeUpdated,
                #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.__osdAudioInfoAvail,
                iPlayableService.evUser + 7:
                self.__osdSubtitleInfoAvail,
                iPlayableService.evUser + 8:
                self.__chapterUpdated,
                iPlayableService.evUser + 9:
                self.__titleUpdated,
                iPlayableService.evUser + 11:
                self.__menuOpened,
                iPlayableService.evUser + 12:
                self.__menuClosed,
                iPlayableService.evUser + 13:
                self.__osdAngleInfoAvail
            })

        # Keymap
        #		self["SeekActions"] = HelpableActionMap(self, "InfobarSeekActions", 							-1 higher priority
        #		self["MovieListActions"] = HelpableActionMap(self, "InfobarMovieListActions", 		0
        #		self["ShowHideActions"] = ActionMap( ["InfobarShowHideActions"] ,  								0
        #		self["EPGActions"] = HelpableActionMap(self, "InfobarEPGActions",									0
        #		self["CueSheetActions"] = HelpableActionMap(self, actionmap,											1 lower priority
        #		self["InstantExtensionsActions"] = HelpableActionMap(self, "InfobarExtensions", 	1 lower priority
        #		self["NumberActions"] = NumberActionMap( [ "NumberActions"],											0 Set by EMC to 2 very lower priority
        #		self["TeletextActions"] = HelpableActionMap(self, "InfobarTeletextActions",				0 Set by EMC to 2 very lower priority
        #		self["MenuActions"] = HelpableActionMap(self, "InfobarMenuActions",  							0 Set by EMC to 2 very lower priority
        if config.EMC.movie_exit.value:
            self["actions"] = HelpableActionMap(self, "CoolPlayerActions", {
                "leavePlayer": (self.leavePlayer, _("Stop playback")),
            })  # default priority
        else:
            self["actions"] = HelpableActionMap(self, "CoolPlayerActions2", {
                "leavePlayer": (self.leavePlayer, _("Stop playback")),
            })  # default priority

        self["DVDPlayerPlaybackActions"] = HelpableActionMap(
            self,
            "EMCDVDPlayerActions",
            {
                "dvdMenu": (self.enterDVDMenu, _("show DVD main menu")),
                #"showInfo": (self.showInfo, _("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")),
                "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")),
                "nextAngle": (self.nextAngle, _("switch to the next angle")),
            },
            1)  # lower priority
        # Only enabled if playing a dvd
        self["DVDPlayerPlaybackActions"].setEnabled(False)

        self["DVDMenuActions"] = ActionMap(
            ["WizardActions"], {
                "left": self.keyLeft,
                "right": self.keyRight,
                "up": self.keyUp,
                "down": self.keyDown,
                "ok": self.keyOk,
                "back": self.keyBack,
            }, 2)  # lower priority
        # Only enabled during DVD Menu
        self["DVDMenuActions"].setEnabled(False)

        self["GeneralPlayerPlaybackActions"] = HelpableActionMap(
            self, "EMCGeneralPlayerActions", {
                "showExtensions":
                (self.openExtensions, _("view extensions...")),
                "EMCGreen": (self.CoolAVSwitch, _("Format AVSwitch")),
                "seekFwd": (self.seekFwd, _("Seek forward")),
                "seekBack": (self.seekBack, _("Seek backward")),
                "movieInfo": (self.infoMovie, _("Movie information")),
            }, 2)  # lower priority

        self["MenuActions"].prio = 2
        if "TeletextActions" in self:
            self["TeletextActions"].prio = 2
        self["NumberActions"].prio = 2

        # Cover Anzeige
        self["Cover"] = Pixmap()

        # DVD Player
        self["audioLabel"] = Label("")
        self["subtitleLabel"] = Label("")
        self["angleLabel"] = Label("")
        self["chapterLabel"] = Label("")
        self["anglePix"] = Pixmap()
        self["anglePix"].hide()
        self.last_audioTuple = None
        self.last_subtitleTuple = None
        self.last_angleTuple = None
        self.totalChapters = 0
        self.currentChapter = 0
        self.totalTitles = 0
        self.currentTitle = 0
        self.in_menu = None
        self.dvdScreen = None

        # Further initialization
        self.firstStart = True
        self.stopped = False
        self.closedByDelete = False
        self.closeAll = False

        self.lastservice = lastservice or self.session.nav.getCurrentlyPlayingServiceReference(
        )
        self.playlist = playlist
        self.playall = playall
        self.playcount = -1
        self.service = None

        self.picload = ePicLoad()
        self.picload.PictureData.get().append(self.showCoverCallback)

        # Record events
        try:
            NavigationInstance.instance.RecordTimer.on_state_change.append(
                self.recEvent)
        except Exception, e:
            emcDebugOut("[EMCMediaCenter] Record observer add exception:\n" +
                        str(e))