本文整理汇总了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()
示例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()
示例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
示例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
示例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)
#.........这里部分代码省略.........