示例#1
0
 def __init__(self, session, player_callback):
     Screen.__init__(self, session)
     self.skinName = ["ArchivCZSKMoviePlayer", "MoviePlayer"]
     InfoBarBase.__init__(self)
     InfoBarShowHide.__init__(self)
     InfoBarSeek.__init__(self)
     # disable slowmotion/fastforward
     self.seekFwd = self.seekFwdManual
     self.seekBack = self.seekBackManual
     initSubsSettings()
     SubsSupport.__init__(self,
                          defaultPath=config_archivczsk.tmpPath.value,
                          forceDefaultPath=True,
                          searchSupport=True,
                          embeddedSupport=True,
                          preferEmbedded=True)
     SubsSupportStatus.__init__(self)
     InfoBarAudioSelectionNoSubtitles.__init__(self)
     InfoBarNotifications.__init__(self)
     InfoBarSubservicesSupport.__init__(self)
     InfoBarAspectChange.__init__(self)
     self.postAspectChange.append(self.__aspect_changed)
     HelpableScreen.__init__(self)
     self.status_dialog = self.session.instantiateDialog(StatusScreen)
     self.player_callback = player_callback
     self.__timer = eTimer()
     self.__timer_conn = eConnectCallback(self.__timer.timeout,
                                          self.__pts_available)
     self.__subtitles_url = None
     self.__resume_time_sec = None
     self["actions"] = HelpableActionMap(
         self, "ArchivCZSKMoviePlayerActions", {
             "showPlaylist": (boundFunction(self.player_callback, (
                 "playlist",
                 "show",
             )), _("Show playlist")),
             "nextEntry": (boundFunction(self.player_callback, (
                 "playlist",
                 "next",
             )), _("Play next entry in playlist")),
             "prevEntry": (boundFunction(self.player_callback, (
                 "playlist",
                 "prev",
             )), _("Play previous entry in playlist")),
             "cancel": (boundFunction(self.player_callback,
                                      ("exit", )), _("Exit player")),
         }, -2)
     self.__event_tracker = ServiceEventTracker(
         screen=self,
         eventmap={
             iPlayableService.evStart: self.__service_started,
         })
     self.onClose.append(self.__on_close)
示例#2
0
文件: player.py 项目: mx3L/archivczsk
 def __init__(self, session, player_callback):
     Screen.__init__(self, session)
     self.skinName = ["ArchivCZSKMoviePlayer", "MoviePlayer"]
     InfoBarBase.__init__(self)
     InfoBarShowHide.__init__(self)
     InfoBarSeek.__init__(self)
     # disable slowmotion/fastforward
     self.seekFwd = self.seekFwdManual
     self.seekBack = self.seekBackManual
     initSubsSettings()
     SubsSupport.__init__(self, 
             defaultPath = config_archivczsk.tmpPath.value,
             forceDefaultPath = True,
             searchSupport = True)
     SubsSupportStatus.__init__(self)
     InfoBarAudioSelectionNoSubtitles.__init__(self)
     InfoBarNotifications.__init__(self)
     InfoBarSubservicesSupport.__init__(self)
     InfoBarAspectChange.__init__(self)
     self.postAspectChange.append(self.__aspect_changed)
     HelpableScreen.__init__(self)
     self.status_dialog = self.session.instantiateDialog(StatusScreen)
     self.player_callback = player_callback
     self.__timer = eTimer()
     self.__timer_conn = eConnectCallback(self.__timer.timeout, self.__pts_available)
     self.__subtitles_url = None
     self.__resume_time_sec = None
     self["actions"] = HelpableActionMap(self, "ArchivCZSKMoviePlayerActions",
             {"showPlaylist": (boundFunction(self.player_callback, ("playlist", "show",)),
                 _("Show playlist")),
                 "nextEntry":(boundFunction(self.player_callback, ("playlist", "next",)),
                     _("Play next entry in playlist")),
                 "prevEntry":(boundFunction(self.player_callback, ("playlist", "prev",)),
                     _("Play previous entry in playlist")),
                 "cancel":(boundFunction(self.player_callback, ("exit",)),
                     _("Exit player")),
             }, -2)
     self.__event_tracker = ServiceEventTracker(screen=self, eventmap=
     {
         iPlayableService.evStart: self.__service_started,
     })
     self.onClose.append(self.__on_close)
示例#3
0
	def __init__(self, session, sref, playlist, playlistName, playlistCB, subtitles=None,
				autoPlay=True, showProtocol=False, onStartShow=False, repeat=False):
		BaseArchivCZSKScreen.__init__(self, session)
		self.onPlayService = []
		self.settings = config.plugins.archivCZSK.videoPlayer
		self.sref = sref

		# # set default/non-default skin according to SD/HD mode
		if self.settings.useDefaultSkin.getValue():
			self.setSkinName("MoviePlayer")
		else:
			HD = getDesktop(0).size().width() == 1280
			if HD:
				self.setSkin("ArchivCZSKMoviePlayer_HD")
			else:
				self.setSkinName("MoviePlayer")


		# # init custom infobar (added info about download speed, buffer level..)
		ArchivCZSKMoviePlayerInfobar.__init__(self)


		# # custom actions for MP
		self["actions"] = HelpableActionMap(self, "ArchivCZSKMoviePlayerActions",
        	{
         	"leavePlayer": (self.leavePlayer, _("leave player?")),
         	"toggleShow": (self.toggleShow, _("show/hide infobar")),
         	"audioSelection":(self.audioSelection, _("show audio selection menu")),
         	"refreshSubs":(self.refreshSubs, _("refreshing subtitles position")),
         	"subsDelayInc":(self.subsDelayInc, _("increasing subtitles delay")),
         	"subsDelayDec":(self.subsDelayDec, _("decreasing subtitles delay"))
          	}, -3)

		InfoBarBase.__init__(self, steal_current_service=True)
		# init of all inherited screens
		for x in HelpableScreen, InfoBarShowHide, \
			    InfoBarSeek, InfoBarAudioSelection, InfoBarNotifications, \
				InfoBarServiceNotifications, HelpableScreen, InfoBarPVRState, \
				InfoBarAspectChange, InfoBarServiceErrorPopupSupport:
				x.__init__(self)

		# init subtitles
		initSubsSettings()
		SubsSupport.__init__(self, subsPath=subtitles, defaultPath=config.plugins.archivCZSK.subtitlesPath.getValue(), forceDefaultPath=True, searchSupport=True)

		# playlist support
		InfoBarPlaylist.__init__(self, playlist, playlistCB, playlistName,
								 autoPlay=autoPlay, onStartShow=onStartShow, repeat=repeat, showProtocol=showProtocol)

		# to get real start of service, and for queries for video length/position
		self.video = Video(session)

		# # bindend some video events to functions
		self.__event_tracker = ServiceEventTracker(screen=self, eventmap=
		{
			iPlayableService.evStart: self.__serviceStarted,
			iPlayableService.evUpdatedEventInfo: self.__evUpdatedEventInfo,
			iPlayableService.evUser + 10: self.__evAudioDecodeError,
			iPlayableService.evUser + 11: self.__evVideoDecodeError,
			iPlayableService.evUser + 12: self.__evPluginError,
		})
		self.statusDialog = session.instantiateDialog(StatusScreen)
		self.onClose.append(self.statusDialog.doClose)
		self.isStream = self.sref.getPath().find('://') != -1
		self.returning = False
示例#4
0
    def __init__(self,
                 session,
                 openmovie,
                 opensubtitle,
                 rootID,
                 LastPlayedService,
                 URLlinkName='',
                 movieTitle='',
                 LastPosition=0):

        self.session = session
        self.statusScreen = self.session.instantiateDialog(StatusScreen)

        # #end subsupports stuff

        self.conditionalNotVisible = []
        self.URLlinkName = URLlinkName
        self.frameon = 1 / 24
        self.seeksubtitle = 0
        self.resume_point = 0
        self.nrsubtitle = 0
        self.statesubtitle = self.HIDDENSUBTITLE
        self.subtitles_enabled = False
        self.selected_subtitle = False
        self.stateplay = ''
        self.stateinfo = self.VISIBLE
        self.openmovie = openmovie

        if movieTitle == '':
            self.movieTitle = getNameWithoutExtension(
                path.basename(self.openmovie))
            #printDEBUG(self.movieTitle)
        else:
            self.movieTitle = movieTitle

        self.opensubtitle = ''
        self.rootID = int(rootID)
        self.LastPlayedService = LastPlayedService
        self.subtitle = []
        self.fontpos = 540
        self.fontsize = 60
        self.aspectratiomode = '0'
        self.SubtitleLineHeight = 66
        self.osdPosX = 0
        self.osdPosY = 0
        self.fonttype_nr = 0
        self.fontcolor_nr = 0
        self.fontbackground_nr = 0
        self.fontBackgroundState = 1
        self.loadfont()
        self.loadcolor()
        self.loadBackgroundColor()
        self.loadconfig()

        if self.opensubtitle == '':
            self.enablesubtitle = False
        else:
            self.enablesubtitle = True

        isHD = False
        isWideScreen = False
        isDolby = False
        self.skin = """
<screen name="AdvancedFreePlayer" position="0,0" size="1280,720" zPosition="-2" title="InfoBar" backgroundColor="transparent" flags="wfNoBorder">
    <!-- SubTitles -->
    <widget name="afpSubtitles" position="0,0" size="1,1" valign="center" halign="center" font="Regular;60" backgroundColor="#ff000000" transparent="0" />
  </screen>"""
        Screen.__init__(self, session)
        self['afpSubtitles'] = Label()

        self['actions'] = ActionMap(['AdvancedFreePlayer'], {  # "ToggleSubtitles": self.ToggleSubtitles,
            'ToggleInfobar': self.ToggleInfobar,
            'HelpScreen': self.HelpScreen,
            'SelectAspect': self.aspectChange,
            'ExitPlayer': self.ExitPlayer,
            'MoveSubsUp': self.MoveSubsUp,
            'MoveSubsDown': self.MoveSubsDown,
            'SetSmallerFont': self.SetSmallerFont,
            'SetBiggerFont': self.SetBiggerFont,
            'pause': self.pause,
            'play': self.play,
            'FastF30s': self.FastF30s,
            'FastF120s': self.FastF120s,
            'FastF300s': self.FastF300s,
            'BackF30s': self.BackF30s,
            'BackF120s': self.BackF120s,
            'BackF300s': self.BackF300s,
            'toggleFontBackground': self.toggleFontBackground,
            'SeekUpSubtitles': self.subsDelayInc,
            'SeekDownSubtitles': self.subsDelayDec,
            'togglePause': self.togglePause,
            'ToggleFont': self.ToggleFont,
            'refreshSubs': self.refreshSubs,
            'SelectAudio': self.SelectAudio,
            'SelectSubtitles': self.SelectSubtitles,
            }, -2)
        self.onShown.append(self.__LayoutFinish)
        InfoBarBase.__init__(self,
                             steal_current_service=True)  # #subsupport....
        if subs == True:  # #susbsupport
            initSubsSettings()
        SubsSupport.__init__(self, embeddedSupport=True, searchSupport=True)
        self.subs = subs
        InfoBarSeek.__init__(
            self, actionmap='AdvancedFreePlayerSeekActions')  # #subsupport
        self.onClose.append(self.__onClose)
        if self.LastPlayedService is None:
            self.LastPlayedService = self.session.nav.getCurrentlyPlayingServiceReference(
            )
        self.session.nav.stopService()
        self.__event_tracker = ServiceEventTracker(
            screen=self,
            eventmap={iPlayableService.evStart: self.resumeLastPlayback}
        )  # iPlayableService.evSeekableStatusChanged: self.__seekableStatusChanged,
示例#5
0
	def __init__(self, session, sref, playlist, playlistName, playlistCB, subtitles=None,
				autoPlay=True, showProtocol=False, onStartShow=False, repeat=False):
		BaseArchivCZSKScreen.__init__(self, session)
		self.onPlayService = []
		self.settings = config.plugins.archivCZSK.videoPlayer
		self.sref = sref

		# # set default/non-default skin according to SD/HD mode
		if self.settings.useDefaultSkin.getValue():
			self.setSkinName("MoviePlayer")
		else:
			HD = getDesktop(0).size().width() == 1280
			if HD:
				self.setSkin("ArchivCZSKMoviePlayer_HD")
			else:
				self.setSkinName("MoviePlayer")


		# # init custom infobar (added info about download speed, buffer level..)
		ArchivCZSKMoviePlayerInfobar.__init__(self)


		# # custom actions for MP
		self["actions"] = HelpableActionMap(self, "ArchivCZSKMoviePlayerActions",
        	{
         	"leavePlayer": (self.leavePlayer, _("leave player?")),
         	"toggleShow": (self.toggleShow, _("show/hide infobar")),
         	"audioSelection":(self.audioSelection, _("show audio selection menu")),
         	"refreshSubs":(self.refreshSubs, _("refreshing subtitles position")),
         	"subsDelayInc":(self.subsDelayInc, _("increasing subtitles delay")),
         	"subsDelayDec":(self.subsDelayDec, _("decreasing subtitles delay"))
          	}, -3)

		InfoBarBase.__init__(self, steal_current_service=True)
		# init of all inherited screens
		for x in HelpableScreen, InfoBarShowHide, \
			    InfoBarSeek, InfoBarAudioSelection, InfoBarNotifications, \
				InfoBarServiceNotifications, HelpableScreen, InfoBarPVRState, \
				InfoBarAspectChange, InfoBarServiceErrorPopupSupport:
				x.__init__(self)

		# init subtitles
		initSubsSettings()
		SubsSupport.__init__(self, subsPath=subtitles, defaultPath=config.plugins.archivCZSK.subtitlesPath.getValue(), forceDefaultPath=True, searchSupport=True)

		# playlist support
		InfoBarPlaylist.__init__(self, playlist, playlistCB, playlistName,
								 autoPlay=autoPlay, onStartShow=onStartShow, repeat=repeat, showProtocol=showProtocol)

		# to get real start of service, and for queries for video length/position
		self.video = Video(session)

		# # bindend some video events to functions
		self.__event_tracker = ServiceEventTracker(screen=self, eventmap=
		{
			iPlayableService.evStart: self.__serviceStarted,
			iPlayableService.evUpdatedEventInfo: self.__evUpdatedEventInfo,
			iPlayableService.evUser + 10: self.__evAudioDecodeError,
			iPlayableService.evUser + 11: self.__evVideoDecodeError,
			iPlayableService.evUser + 12: self.__evPluginError,
		})
		self.statusDialog = session.instantiateDialog(StatusScreen)
		self.onClose.append(self.statusDialog.doClose)
		self.isStream = self.sref.getPath().find('://') != -1
		self.returning = False
示例#6
0
    def __init__(self, session, openmovie, opensubtitle, rootID, LastPlayedService, URLlinkName='', movieTitle='', LastPosition = 0):

        self.session = session
        self.statusScreen = self.session.instantiateDialog(StatusScreen)

                # #end subsupports stuff

        self.conditionalNotVisible = []
        self.URLlinkName = URLlinkName
        self.frameon = 1 / 24
        self.seeksubtitle = 0
        self.resume_point = 0
        self.nrsubtitle = 0
        self.statesubtitle = self.HIDDENSUBTITLE
        self.subtitles_enabled = False
        self.selected_subtitle = False
        self.stateplay = ''
        self.stateinfo = self.VISIBLE
        self.openmovie = openmovie
        
        if movieTitle == '':
            self.movieTitle = getNameWithoutExtension(path.basename(self.openmovie))
            #printDEBUG(self.movieTitle)
        else:
            self.movieTitle = movieTitle
            
        self.opensubtitle = ''
        self.rootID = int(rootID)
        self.LastPlayedService = LastPlayedService
        self.subtitle = []
        self.fontpos = 540
        self.fontsize = 60
        self.aspectratiomode = '0'
        self.SubtitleLineHeight = 66
        self.osdPosX = 0
        self.osdPosY = 0
        self.fonttype_nr = 0
        self.fontcolor_nr = 0
        self.fontbackground_nr = 0
        self.fontBackgroundState = 1
        self.loadfont()
        self.loadcolor()
        self.loadBackgroundColor()
        self.loadconfig()

        if self.opensubtitle == '':
            self.enablesubtitle = False
        else:
            self.enablesubtitle = True

        isHD = False
        isWideScreen = False
        isDolby = False
        self.skin = """
<screen name="AdvancedFreePlayer" position="0,0" size="1280,720" zPosition="-2" title="InfoBar" backgroundColor="transparent" flags="wfNoBorder">
    <!-- SubTitles -->
    <widget name="afpSubtitles" position="0,0" size="1,1" valign="center" halign="center" font="Regular;60" backgroundColor="#ff000000" transparent="0" />
  </screen>"""
        Screen.__init__(self, session)
        self['afpSubtitles'] = Label()

        self['actions'] = ActionMap(['AdvancedFreePlayer'], {  # "ToggleSubtitles": self.ToggleSubtitles,
            'ToggleInfobar': self.ToggleInfobar,
            'HelpScreen': self.HelpScreen,
            'SelectAspect': self.aspectChange,
            'ExitPlayer': self.ExitPlayer,
            'MoveSubsUp': self.MoveSubsUp,
            'MoveSubsDown': self.MoveSubsDown,
            'SetSmallerFont': self.SetSmallerFont,
            'SetBiggerFont': self.SetBiggerFont,
            'pause': self.pause,
            'play': self.play,
            'FastF30s': self.FastF30s,
            'FastF120s': self.FastF120s,
            'FastF300s': self.FastF300s,
            'BackF30s': self.BackF30s,
            'BackF120s': self.BackF120s,
            'BackF300s': self.BackF300s,
            'toggleFontBackground': self.toggleFontBackground,
            'SeekUpSubtitles': self.subsDelayInc,
            'SeekDownSubtitles': self.subsDelayDec,
            'togglePause': self.togglePause,
            'ToggleFont': self.ToggleFont,
            'refreshSubs': self.refreshSubs,
            'SelectAudio': self.SelectAudio,
            'SelectSubtitles': self.SelectSubtitles,
            }, -2)
        self.onShown.append(self.__LayoutFinish)
        InfoBarBase.__init__(self, steal_current_service=True)  # #subsupport....
        if subs == True:  # #susbsupport
            initSubsSettings()
        SubsSupport.__init__(self, embeddedSupport=True, searchSupport=True)
        self.subs = subs
        InfoBarSeek.__init__(self, actionmap='AdvancedFreePlayerSeekActions')  # #subsupport
        self.onClose.append(self.__onClose)
        if self.LastPlayedService is None:
            self.LastPlayedService = self.session.nav.getCurrentlyPlayingServiceReference()
        self.session.nav.stopService()
        self.__event_tracker = ServiceEventTracker(screen=self, eventmap={iPlayableService.evStart: self.resumeLastPlayback})  # iPlayableService.evSeekableStatusChanged: self.__seekableStatusChanged,