Ejemplo n.º 1
0
    def __init__(self,
                 session,
                 url,
                 pathForRecordings,
                 movieTitle,
                 activMoviePlayer,
                 requestedBuffSize,
                 playerAdditionalParams={}):
        self.session = session
        Screen.__init__(self, session)
        self.onStartCalled = False

        self.recordingPath = pathForRecordings
        self.filePath = pathForRecordings + '/.iptv_buffering.flv'
        self.url = url
        self.movieTitle = movieTitle

        self.currentService = self.session.nav.getCurrentlyPlayingServiceReference(
        )
        self.activMoviePlayer = activMoviePlayer

        self.onClose.append(self.__onClose)
        #self.onLayoutFinish.append(self.doStart)
        self.onShow.append(self.onWindowShow)
        #self.onHide.append(self.onWindowHide)

        self["actions"] = ActionMap(
            ["WizardActions", "MoviePlayerActions"], {
                "ok": self.ok_pressed,
                "back": self.back_pressed,
                "leavePlayer": self.back_pressed,
            }, -1)

        self["console"] = Label()
        self["percentage"] = Label()

        self["icon"] = SimpleAnimatedCover()
        # prepare icon frames path
        frames = []
        for idx in range(1, self.NUM_OF_ICON_FRAMES + 1):
            frames.append(
                resolveFilename(
                    SCOPE_PLUGINS,
                    'Extensions/IPTVPlayer/icons/buffering/buffering_%d.png' %
                    idx))
        self["icon"].loadFrames(frames)

        self.inMoviePlayer = False
        self.canRunMoviePlayer = False  # used in function updateDisplay, so must be first initialized
        #main Timer
        self.mainTimer = eTimer()
        self.mainTimerEnabled = False
        self.mainTimer_conn = eConnectCallback(self.mainTimer.timeout,
                                               self.updateDisplay)
        self.mainTimerInterval = 1000  # by default 1s

        self.requestedBuffSize = requestedBuffSize
        self.playerAdditionalParams = playerAdditionalParams
Ejemplo n.º 2
0
    def __init__(self, session, url, pathForRecordings, pictureTitle):
        self.session = session
        Screen.__init__(self, session)
        self.onStartCalled = False
        
        self.recordingPath = pathForRecordings
        try:
            self.filePath = os.path.join(pathForRecordings, '.iptv_buffering.jpg')
        except:
            self.filePath = ''
            printExc()
            
        self.url           = url
        self.pictureTitle  = pictureTitle
        self.audioUrl      = strwithmeta(url).meta.get("iptv_audio_url", '')
       
        self["actions"] = ActionMap(['IPTVAlternateVideoPlayer', 'MoviePlayerActions', 'MediaPlayerActions', 'WizardActions', 'DirectionActions'],
        {
            'leavePlayer'  : self.key_exit,
            'play'         : self.key_play,
            'pause'        : self.key_pause,
            'exit'         : self.key_exit,
            'back'         : self.key_exit,
            'ok'           : self.key_ok,
        }, -1)     

        self["status"]  = Label()
        self["console"] = Label()
        self["icon"]    = SimpleAnimatedCover()
        self["picture"] = Cover()

        # prepare icon frames path
        frames = []
        for idx in range(1,self.NUM_OF_ICON_FRAMES+1): frames.append( GetIconDir('/buffering/buffering_%d.png' % idx) )
        self["icon"].loadFrames(frames) 
        
        #main Timer
        self.mainTimer = eTimer()
        self.mainTimerEnabled = False
        self.mainTimer_conn = eConnectCallback(self.mainTimer.timeout, self.updateDisplay)
        self.mainTimerInterval = 100 # by default 0,1s
        # download
        self.downloader = DownloaderCreator(self.url)
        
        self.onClose.append(self.__onClose)
        self.onLayoutFinish.append(self.doStart)
        
        self.autoRefresh = False
        self.refreshPostfixes = ['_0', '_1']
        self.refreshCount = 0
        self.refreshing = False
        
        if len(self.audioUrl) and len(config.plugins.iptvplayer.gstplayerpath.value):
            self.audioPlayer = IPTVSimpleAudioPlayer()
        else: self.audioPlayer  = None
Ejemplo n.º 3
0
    def __init__(self,
                 session,
                 url,
                 pathForBuffering,
                 pathForDownloading,
                 movieTitle,
                 activMoviePlayer,
                 requestedBuffSize,
                 playerAdditionalParams={},
                 downloadManager=None,
                 fileExtension=''):
        self.session = session
        Screen.__init__(self, session)
        self.onStartCalled = False

        self.downloadingPath = pathForDownloading
        self.bufferingPath = pathForBuffering
        self.filePath = pathForBuffering + '/.iptv_buffering.flv'
        self.url = url
        self.movieTitle = movieTitle
        self.downloadManager = downloadManager
        self.fileExtension = fileExtension

        self.currentService = self.session.nav.getCurrentlyPlayingServiceReference(
        )
        self.activMoviePlayer = activMoviePlayer

        self.onClose.append(self.__onClose)
        #self.onLayoutFinish.append(self.doStart)
        self.onShow.append(self.onWindowShow)
        #self.onHide.append(self.onWindowHide)

        self["actions"] = ActionMap(
            [
                "IPTVAlternateVideoPlayer", "WizardActions",
                "MoviePlayerActions"
            ], {
                "ok": self.ok_pressed,
                "back": self.back_pressed,
                "leavePlayer": self.back_pressed,
                "record": self.record_pressed,
            }, -1)

        self["console"] = Label()
        self["percentage"] = Label()
        self["addinfo"] = Label()
        self['ok_button'] = Cover3()
        self['rec_button'] = Cover3()
        self['exit_button'] = Cover3()

        self["icon"] = SimpleAnimatedCover()
        # prepare icon frames path
        frames = []
        for idx in range(1, self.NUM_OF_ICON_FRAMES + 1):
            frames.append(
                resolveFilename(
                    SCOPE_PLUGINS,
                    'Extensions/IPTVPlayer/icons/buffering/buffering_%d.png' %
                    idx))
        self["icon"].loadFrames(frames)

        self.inMoviePlayer = False
        self.canRunMoviePlayer = False  # used in function updateDisplay, so must be first initialized
        #main Timer
        self.mainTimer = eTimer()
        self.mainTimerEnabled = False
        self.mainTimer_conn = eConnectCallback(self.mainTimer.timeout,
                                               self.updateDisplay)
        self.mainTimerInterval = 1000  # by default 1s

        self.requestedBuffSize = requestedBuffSize
        self.playerAdditionalParams = playerAdditionalParams

        self.clipLength = None
        self.lastPosition = None
        self.lastSize = 0

        # Some MP4 files are not prepared for streaming
        # MOOV atom is needed to start playback
        # if it is located at the end of file, then
        # will try to download it separately to start playback
        # without downloading the whole file
        self.clouldBeMP4 = False
        self.isMOOVAtomAtTheBeginning = None
        self.checkMOOVAtom = True
        self.maxMOOVAtomSize = 10 * 1024 * 1024  # 10 MB max moov atom size
        self.moovAtomOffset = 0
        self.moovAtomSize = 0

        self.MOOV_STS = enum(UNKNOWN=0,
                             WAITING=1,
                             DOWNLOADING=2,
                             DOWNLOADED=3,
                             ERROR=4)
        self.moovAtomStatus = self.MOOV_STS.UNKNOWN
        self.moovAtomDownloader = None
        self.moovAtomPath = pathForBuffering + '/.iptv_buffering_moov.flv'
        self.closeRequestedByUser = None

        printDBG(">> activMoviePlayer[%s]" % self.activMoviePlayer)