当前位置: 首页>>代码示例>>Python>>正文


Python ParameterHandler.exist方法代码示例

本文整理汇总了Python中ParameterHandler.exist方法的典型用法代码示例。如果您正苦于以下问题:Python ParameterHandler.exist方法的具体用法?Python ParameterHandler.exist怎么用?Python ParameterHandler.exist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ParameterHandler的用法示例。


在下文中一共展示了ParameterHandler.exist方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __getHtmlContent

# 需要导入模块: import ParameterHandler [as 别名]
# 或者: from ParameterHandler import exist [as 别名]
def __getHtmlContent(sUrl = None, sSecurityValue=None):
    params = ParameterHandler()

    # Test if a url is available and set it
    if sUrl is None and not params.exist('siteUrl'):
        logger.info("There is no url we can request.")
        return False
    else:
        if sUrl is None:
            sUrl = params.getValue('siteUrl')

    # Test if a security value is available
    if sSecurityValue is None:
        if params.exist('securityCookie'):
            sSecurityValue = params.getValue('securityCookie')
        else :
            sSecurityValue = ''

    # Make the request
    oRequest = cRequestHandler(sUrl)
    #oRequest.addHeaderEntry('Cookie', sSecurityValue)
    #oRequest.addHeaderEntry('Accept', '*/*')
    #oRequest.addHeaderEntry('Host', 'g-stream.in')

    return oRequest.request()
开发者ID:choiipad,项目名称:plugin.video.xstream,代码行数:27,代码来源:gstream_in.py

示例2: parseMovieResultSite

# 需要导入模块: import ParameterHandler [as 别名]
# 或者: from ParameterHandler import exist [as 别名]
def parseMovieResultSite():
    oGui = cGui()
    params = ParameterHandler()
    if (params.exist('siteUrl')):
        siteUrl = params.getValue('siteUrl')
        normalySiteUrl = params.getValue('normalySiteUrl')
        iPage = params.getValue('iPage')
        __parseMovieResultSite(oGui, siteUrl, normalySiteUrl, iPage)
    oGui.setEndOfDirectory()
开发者ID:choiipad,项目名称:plugin.video.xstream,代码行数:11,代码来源:gstream_in.py

示例3: play

# 需要导入模块: import ParameterHandler [as 别名]
# 或者: from ParameterHandler import exist [as 别名]
def play():
    oInputParameterHandler = ParameterHandler()
    if (oInputParameterHandler.exist('sUrl') and oInputParameterHandler.exist('sTitle')):
        sUrl = oInputParameterHandler.getValue('sUrl')
        sTitle = oInputParameterHandler.getValue('sTitle')
        
        oRequest = cRequestHandler(sUrl)
        sHtmlContent = oRequest.request()

        sPattern = 'ake_playlist.php%3Fflv%3D(.*?)%26'

        oParser = cParser()
        aResult = oParser.parse(sHtmlContent, sPattern)
        if (aResult[0] == True):
            sStreamUrl = URL_GET_STREAM + str(aResult[1][0])           
            result = {}
            result['streamUrl'] = sStreamUrl
            result['resolved'] = True
            return result
    return False
开发者ID:Lokke,项目名称:plugin.video.xstream,代码行数:22,代码来源:bundesliga_de.py

示例4: getHosters

# 需要导入模块: import ParameterHandler [as 别名]
# 或者: from ParameterHandler import exist [as 别名]
def getHosters():
    hosters = []
    params = ParameterHandler()
    if (params.exist('movieUrl') and params.exist('sMovieTitle')):
        sSiteUrl = params.getValue('movieUrl')
        sMovieTitle = params.getValue('sMovieTitle')
        sHtmlContent = __getHtmlContent(sUrl = sSiteUrl)
        sPattern = 'id="ame_noshow_post.*?<a href="([^"]+)" title="[^"]+" target="_blank">([^<]+)</a>'
        aResult = cParser().parse(sHtmlContent, sPattern)
        if aResult[0] == True:
            aHosters = []
            for aEntry in aResult[1]:
                sUrl = aEntry[0]
                # extract hoster domainname            
                if 'g-stream.in/secure/' in sUrl :
                    sHoster = sUrl.split('secure/')[-1].split('/')[0].split('.')[-2]
                else:
                    sHoster = sUrl.split('//')[-1].split('/')[0].split('.')[-2]
                hoster = {}
                hoster['link'] = sUrl
                hoster['name'] = sHoster
                hosters.append(hoster)
    hosters.append('getHosterUrl')
    return hosters
开发者ID:choiipad,项目名称:plugin.video.xstream,代码行数:26,代码来源:gstream_in.py

示例5: listVideos

# 需要导入模块: import ParameterHandler [as 别名]
# 或者: from ParameterHandler import exist [as 别名]
def listVideos():
    oGui = cGui()

    oInputParameterHandler = ParameterHandler()
    if (oInputParameterHandler.exist('playlistId')):
        sPlaylistId = oInputParameterHandler.getValue('playlistId')

        if not oInputParameterHandler.exist('sUrl'):
            sUrl = URL_TV + str(sPlaylistId)
        else:
            sUrl = oInputParameterHandler.getValue('sUrl')
        

        if sPlaylistId == 'spieltag':
            oParser = cParser()
            if sUrl.find(URL_TV) != -1:
                sUrl = 'http://www.bundesliga.de/de/bundesliga-tv/index.php'
                oRequest = cRequestHandler(sUrl)
                sHtmlContent = oRequest.request()
                sPattern = '\'(/de/bundesliga-tv/navigation.php\?area=spieltag&saison=(\d+)[^\']+)\''
                aResult = oParser.parse(sHtmlContent, sPattern)
                sUrl = URL_MAIN + aResult[1][0][0]
                sSaison = aResult[1][0][1]
            else:
                sSaison = oParser.parse(sUrl, '&saison=(\d+)')[1][0]
            
            oRequest = cRequestHandler(sUrl)
            sHtmlContent = oRequest.request()
            
            sPattern = '<div class="matchDay matchDay[^<]*onclick="retrieveURL\(\'([^\']+)\'.*?>([^<]+)</div>'
            aResult = oParser.parse(sHtmlContent, sPattern)
            
            if (aResult[0] == True):                
                #ausgewählte Saison
                for aEntry in aResult[1]:
                    oGuiElement = cGuiElement()
                    oGuiElement.setSiteName(SITE_IDENTIFIER)
                    oGuiElement.setFunction('listVideos')
                    oGuiElement.setTitle(aEntry[1])

                    sUrl = URL_MAIN + str(aEntry[0])
                    oOutputParameterHandler = ParameterHandler()
                    oOutputParameterHandler.setParam('sUrl', sUrl)
                    oOutputParameterHandler.setParam('playlistId', 'spieltagEinzeln')
                    oGui.addFolder(oGuiElement, oOutputParameterHandler)
                
                #ältere Saison
                oGuiElement = cGuiElement()
                oGuiElement.setSiteName(SITE_IDENTIFIER)
                oGuiElement.setFunction('listVideos')
                lastSaison = str(int(sSaison) - 1)
                oGuiElement.setTitle('* Saison %s/%s *' % (lastSaison,sSaison))

                sUrl = sUrl.replace(sSaison, lastSaison)
                oOutputParameterHandler = ParameterHandler()
                oOutputParameterHandler.setParam('sUrl', sUrl)
                oOutputParameterHandler.setParam('playlistId', 'spieltag')
                oGui.addFolder(oGuiElement, oOutputParameterHandler)

            
        elif sPlaylistId == 'vereine':
            sPattern = '<div class="teamWappen" onclick="retrieveURL\(\'([^\']+)\'.*?<img src="([^"]+)" title="Videos des ([^"]+)" /></div>'
            oRequest = cRequestHandler(sUrl)
            sHtmlContent = oRequest.request()
           
            oParser = cParser()
            aResult = oParser.parse(sHtmlContent, sPattern)
            
            if (aResult[0] == True):
                for aEntry in aResult[1]:
                    oGuiElement = cGuiElement()
                    oGuiElement.setSiteName(SITE_IDENTIFIER)
                    oGuiElement.setFunction('listVideos')
                    oGuiElement.setTitle((aEntry[2]))
                    sThumbnail = URL_MAIN + str(aEntry[1])
                    oGuiElement.setThumbnail(sThumbnail)

                    sUrl = URL_MAIN + str(aEntry[0])
                    oOutputParameterHandler = ParameterHandler()
                    oOutputParameterHandler.setParam('sUrl', sUrl)
                    oOutputParameterHandler.setParam('playlistId', 'verein')
                    oGui.addFolder(oGuiElement, oOutputParameterHandler)
        else:
            sPattern = '<div class="zeile">.*?<img src="([^"]+)" id="bild" class="previewImg".*?<a href="javascript:showVideoSnippet\(\'([^\']+)\'\).*?title="([^"]+)".*?<div class="describe">(.*?)</div>'    
            oRequest = cRequestHandler(sUrl)
            sHtmlContent = oRequest.request()
            
            oParser = cParser()
            aResult = oParser.parse(sHtmlContent, sPattern)
            if (aResult[0] == True):
                for aEntry in aResult[1]:
                    sThumbnail = URL_MAIN + str(aEntry[0])
                    sUrl = URL_MAIN + str(aEntry[1])
                    sTitle = cUtil().unescape(str(aEntry[2]).decode('utf-8')).encode('utf-8') 
                    sDescription = cUtil().unescape(str(aEntry[3]).decode('utf-8')).encode('utf-8')
                    oGuiElement = cGuiElement()
                    oGuiElement.setSiteName(SITE_IDENTIFIER)
                    oGuiElement.setFunction('play')
                    oGuiElement.setTitle(sTitle)
                    oGuiElement.setDescription(sDescription)
#.........这里部分代码省略.........
开发者ID:Lokke,项目名称:plugin.video.xstream,代码行数:103,代码来源:bundesliga_de.py


注:本文中的ParameterHandler.exist方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。