示例#1
0
    def InitialiseRTMP(self, soup):
        self.log(u"", xbmc.LOGDEBUG)

        try:
            flowPlayerScript = unicode(
                soup.find(u'div', {
                    u'id': u'flowPlayer'
                }).findNextSibling(u'script').text)

            rtmpStr = utils.findString(u"TV3Provider::InitialiseRTMP()",
                                       u"netConnectionUrl: \"(.+?)\"",
                                       flowPlayerScript)
            rootIndex = rtmpStr[8:].index(u'/') + 9
            app = rtmpStr[rootIndex:]
            swfUrl = self.GetSWFPlayer(flowPlayerScript)
            playPath = utils.findString(
                u"TV3Provider::InitialiseRTMP()",
                u"playlist:\s+\[\s+{\s+url:\s+\"(.+?)\"", flowPlayerScript)

            rtmpVar = rtmp.RTMP(rtmp=rtmpStr,
                                app=app,
                                swfVfy=swfUrl,
                                playPath=playPath)
            self.AddSocksToRTMP(rtmpVar)

            return rtmpVar
        except (Exception) as exception:
            if not isinstance(exception, LoggingException):
                exception = LoggingException.fromException(exception)

            # Error getting RTMP data
            exception.addLogMessage(self.language(30057))
            raise exception
示例#2
0
    def InitialiseRTMP(self, soup):
        self.log(u"", xbmc.LOGDEBUG)

        try:
            flowPlayerScript = unicode(soup.find(u'div', {u'id':u'flowPlayer'}).findNextSibling(u'script').text)

            rtmpStr = utils.findString( u"TV3Provider::InitialiseRTMP()", u"netConnectionUrl: \"(.+?)\"", flowPlayerScript)
            rootIndex = rtmpStr[8:].index(u'/') + 9
            app = rtmpStr[rootIndex:]
            swfUrl = self.GetSWFPlayer(flowPlayerScript)
            playPath = utils.findString( u"TV3Provider::InitialiseRTMP()", u"playlist:\s+\[\s+{\s+url:\s+\"(.+?)\"", flowPlayerScript)
        
            rtmpVar = rtmp.RTMP(rtmp = rtmpStr, app = app, swfVfy = swfUrl, playPath = playPath)
            self.AddSocksToRTMP(rtmpVar)

            return rtmpVar
        except (Exception) as exception:
            if not isinstance(exception, LoggingException):
                exception = LoggingException.fromException(exception)

            # Error getting RTMP data
            exception.addLogMessage(self.language(30057))
            raise exception
示例#3
0
    def GetSWFPlayer(self, flowPlayerScript):
        self.log(u"", xbmc.LOGDEBUG)
        
        try:
            swfPlayer = utils.findString( u"TV3Provider::GetSWFPlayer()", u"flowplayer\(\"flowPlayer\",\s+{src:\s+\"(.+?)\"", flowPlayerScript)
#            swfPlayer = soup.find('div', {'id':'flowPlayer'}).object['data']
            if swfPlayer is None:
                swfPlayer = swfDefault

            return swfPlayer
        
        except (Exception) as exception:
            if not isinstance(exception, LoggingException):
                exception = LoggingException.fromException(exception)
            
            # Unable to determine swfPlayer URL. Using default: %s
            exception.addLogMessage(self.language(30520) % swfDefault)
            exception.process(severity = xbmc.LOGWARNING)
            return swfDefault
示例#4
0
    def GetSWFPlayer(self, flowPlayerScript):
        self.log(u"", xbmc.LOGDEBUG)

        try:
            swfPlayer = utils.findString(
                u"TV3Provider::GetSWFPlayer()",
                u"flowplayer\(\"flowPlayer\",\s+{src:\s+\"(.+?)\"",
                flowPlayerScript)
            #            swfPlayer = soup.find('div', {'id':'flowPlayer'}).object['data']
            if swfPlayer is None:
                swfPlayer = swfDefault

            return swfPlayer

        except (Exception) as exception:
            if not isinstance(exception, LoggingException):
                exception = LoggingException.fromException(exception)

            # Unable to determine swfPlayer URL. Using default: %s
            exception.addLogMessage(self.language(30520) % swfDefault)
            exception.process(severity=xbmc.LOGWARNING)
            return swfDefault