本文整理汇总了Python中entities.CListItem.CListItem.merge方法的典型用法代码示例。如果您正苦于以下问题:Python CListItem.merge方法的具体用法?Python CListItem.merge怎么用?Python CListItem.merge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类entities.CListItem.CListItem
的用法示例。
在下文中一共展示了CListItem.merge方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __findRTMP
# 需要导入模块: from entities.CListItem import CListItem [as 别名]
# 或者: from entities.CListItem.CListItem import merge [as 别名]
def __findRTMP(self, data, pageUrl, lItem):
rtmp = findRTMP(pageUrl, data)
if rtmp:
item = CListItem()
item['title'] = 'RTMP* - ' + rtmp[1]
item['type'] = 'video'
item['url'] = rtmp[0] + ' playPath=' + rtmp[1] + ' swfUrl=' + rtmp[2] +' swfVfy=1 live=true pageUrl=' + pageUrl
item.merge(lItem)
return item
return None
示例2: __findRTMP
# 需要导入模块: from entities.CListItem import CListItem [as 别名]
# 或者: from entities.CListItem.CListItem import merge [as 别名]
def __findRTMP(self, data, pageUrl, lItem):
rtmp = findRTMP(pageUrl, data)
if rtmp:
item = CListItem()
item["title"] = "RTMP* - " + rtmp[1]
item["type"] = "video"
item["url"] = (
rtmp[0] + " playPath=" + rtmp[1] + " swfUrl=" + rtmp[2] + " swfVfy=1 live=true pageUrl=" + pageUrl
)
item.merge(lItem)
return item
return None
示例3: __parseHtml
# 需要导入模块: from entities.CListItem import CListItem [as 别名]
# 或者: from entities.CListItem.CListItem import merge [as 别名]
def __parseHtml(self, url, data, rules, skills, definedIn, lItem):
common.log('_parseHtml called' + url)
items = []
for item_rule in rules:
common.log('rule: ' + item_rule.infos)
#print('>>>>item_rule: ',item_rule)
#print("MMMMMMMM",mydump(item_rule))
# Zmiana MN
if not hasattr(item_rule, 'precheck') or (item_rule.precheck in data):
revid = re.compile(item_rule.infos, re.IGNORECASE + re.DOTALL + re.MULTILINE + re.UNICODE)
for reinfos in revid.findall(data):
tmp = CListItem()
if lItem['referer']:
tmp['referer'] = lItem['referer']
if item_rule.order.find('|') != -1:
infos_names = item_rule.order.split('|')
infos_values = list(reinfos)
i = 0
for name in infos_names:
tmp[name] = infos_values[i]
i = i+1
else:
tmp[item_rule.order] = reinfos
for info in item_rule.info_list:
info_value = tmp[info.name]
if info_value:
if info.build.find('%s') != -1:
tmpVal = info.build % info_value
tmp[info.name] = tmpVal
continue
if info.build.find('%s') != -1:
if info.src.__contains__('+'):
tmpArr = info.src.split('+')
src = ''
for t in tmpArr:
t = t.strip()
if t.find('\'') != -1:
src = src + t.strip('\'')
else:
src = src + tmp[t]
elif info.src.__contains__('||'):
variables = info.src.split('||')
src = firstNonEmpty(tmp, variables)
else:
src = tmp[info.src]
if src and info.convert != []:
tmp['referer'] = url
src = self.__parseCommands(tmp, src, info.convert)
if isinstance(src, dict):
for dKey in src:
tmp[dKey] = src[dKey]
src = src.values()[0]
info_value = info.build % (src)
else:
info_value = info.build
tmp[info.name] = info_value
if tmp['url']:
tmp['url'] = item_rule.url_build % (tmp['url'])
else:
tmp['url'] = url
tmp.merge(lItem)
if item_rule.skill.find('append') != -1:
tmp['url'] = url + tmp['url']
if item_rule.skill.find('space') != -1:
tmp['title'] = ' %s ' % tmp['title'].strip()
if skills.find('videoTitle') > -1:
tmp['videoTitle'] = tmp['title']
tmp['definedIn'] = definedIn
items.append(tmp)
return items
示例4: __parseCfg
# 需要导入模块: from entities.CListItem import CListItem [as 别名]
# 或者: from entities.CListItem.CListItem import merge [as 别名]
def __parseCfg(self, cfgFile, data, lItem):
tmpList = CList()
data = data.replace('\r\n', '\n').split('\n')
items = []
tmp = None
hasOwnCfg = False
for m in data:
if m and m[0] != '#':
index = m.find('=')
if index != -1:
key = lower(m[:index]).strip()
value = m[index+1:]
index = value.find('|')
if value[:index] == 'sports.devil.locale':
value = common.translate(int(value[index+1:]))
elif value[:index] == 'sports.devil.image':
value = os.path.join(common.Paths.imgDir, value[index+1:])
if key == 'start':
tmpList.start = value
elif key == 'section':
tmpList.section = value
elif key == 'sort':
tmpList.sort = value
elif key == 'skill':
tmpList.skill = value
elif key == 'catcher':
tmpList.catcher = value
elif key == 'item_infos':
rule_tmp = CRuleItem()
hasOwnCfg = False
rule_tmp.infos = value
elif key == 'item_order':
rule_tmp.order = value
elif key == 'item_skill':
rule_tmp.skill = value
elif key == 'item_curr':
rule_tmp.curr = value
elif key == 'item_precheck':
rule_tmp.precheck = value
elif key.startswith('item_info'):
tmpkey = key[len('item_info'):]
if tmpkey == '_name':
info_tmp = CItemInfo()
info_tmp.name = value
if value == 'cfg':
hasOwnCfg = True
elif tmpkey == '_from':
info_tmp.src = value
elif tmpkey == '':
info_tmp.rule = value
elif tmpkey == '_default':
info_tmp.default = value
elif tmpkey == '_convert':
info_tmp.convert.append(value)
elif tmpkey == '_build':
info_tmp.build = value
rule_tmp.info_list.append(info_tmp)
elif key == 'item_url_build':
rule_tmp.url_build = value
if tmpList.catcher != '':
refInf = CItemInfo()
refInf.name = 'referer'
refInf.build = value
rule_tmp.info_list.append(refInf)
if not hasOwnCfg:
refInf = CItemInfo()
refInf.name = 'catcher'
refInf.build = tmpList.catcher
rule_tmp.info_list.append(refInf)
tmpList.rules.append(rule_tmp)
# static menu items (without regex)
elif key == 'title':
tmp = CListItem()
tmp['title'] = value
if tmpList.skill.find('videoTitle') > -1:
tmp['videoTitle'] = value
elif key == 'url':
tmp['url'] = value
if lItem:
tmp.merge(lItem)
if tmpList.catcher != '':
tmp['referer'] = value
if not hasOwnCfg:
#.........这里部分代码省略.........
示例5: __loadRemote
# 需要导入模块: from entities.CListItem import CListItem [as 别名]
# 或者: from entities.CListItem.CListItem import merge [as 别名]
#.........这里部分代码省略.........
# find rtmp stream
#common.log('Find rtmp stream')
if count == 0:
item = self.__findRTMP(data, startUrl, lItem)
if item:
items = []
items.append(item)
count = 1
# find embedding javascripts
#common.log('Find embedding javascripts')
if count == 0:
item = findJS(data)
if item:
firstJS = item[0]
streamId = firstJS[0]
jsUrl = firstJS[1]
streamerName = getHostName(jsUrl)
jsSource = getHTML(jsUrl, None, startUrl, True, False)
phpUrl = findPHP(jsSource, streamId)
if phpUrl:
data = getHTML(phpUrl, None, startUrl, True, True)
item = self.__findRTMP(data, phpUrl, lItem)
if item:
if streamerName:
item['title'] = item['title'].replace('RTMP', streamerName)
items = []
items.append(item)
count = 1
else:
red = phpUrl
common.log(' -> Redirect: ' + red)
inputList.curr_url = red
common.log(str(len(inputList.items)) + ' items ' + inputList.cfg + ' -> ' + red)
startUrl = red
if lItem['referer']:
lItem['referer'] = red
continue
# find vcods
#common.log('find vcods')
if count == 0:
vcods = findVCods(data)
if vcods:
sUrl = vcods[0]
cod1 = vcods[1]
cod2 = vcods[2]
swfUrl = vcods[3]
unixTS = str(dt.getUnixTimestamp())
sUrl = sUrl + '?callback=jQuery1707757964063647694_1347894980192&v_cod1=' + cod1 + '&v_cod2=' + cod2 + '&_=' + unixTS
tmpData = getHTML(sUrl, None, urllib.unquote_plus(startUrl), True, False)
if tmpData and tmpData.find("Bad Request") == -1:
newReg = '"result1":"([^\"]+)","result2":"([^\"]+)"'
link = regexUtils.findall(tmpData, newReg)
if link:
_file = link[0][0]
rtmp = link[0][1].replace('\\','')
#.replace('/redirect','/vod')
item = CListItem()
item['title'] = getHostName(sUrl) + '* - ' + _file
item['type'] = 'video'
item['url'] = rtmp + ' playPath=' + _file + ' swfUrl=' + swfUrl +' swfVfy=1 live=true pageUrl=' + startUrl
item.merge(lItem)
items.append(item)
count = 1
# find redirects
#common.log('find redirects')
if count == 0:
red = self.__findRedirect(startUrl, inputList.curr_url)
if startUrl == red:
common.log(' -> No redirect found')
else:
red = HTMLParser.HTMLParser().unescape(red)
red = urllib.unquote(red)
common.log(' -> Redirect: ' + red)
inputList.curr_url = red
common.log(str(len(inputList.items)) + ' items ' + inputList.cfg + ' -> ' + red)
startUrl = red
if lItem['referer']:
lItem['referer'] = red
i = 0
i += 1
if count != 0:
inputList.items = inputList.items + items
except IOError:
if common.enable_debug:
traceback.print_exc(file = sys.stdout)
return False
return True
示例6: __parseHtml
# 需要导入模块: from entities.CListItem import CListItem [as 别名]
# 或者: from entities.CListItem.CListItem import merge [as 别名]
def __parseHtml(self, url, data, rules, definedIn, lItem):
items = []
for item_rule in rules:
revid = re.compile(item_rule.infos, re.IGNORECASE + re.DOTALL + re.MULTILINE)
for reinfos in revid.findall(data):
tmp = CListItem()
if item_rule.order.find('|') != -1:
tmp.infos_names = item_rule.order.split('|')
tmp.infos_values = list(reinfos)
else:
tmp[item_rule.order] = reinfos
for info in item_rule.info_list:
info_value = tmp[info.name]
if info_value:
if info.build.find('%s') != -1:
tmpVal = enc.smart_unicode(info.build % enc.smart_unicode(info_value))
tmp[info.name] = tmpVal
continue
if info.build.find('%s') != -1:
if info.src.__contains__('+'):
tmpArr = info.src.split('+')
src = ''
for t in tmpArr:
t = t.strip()
if t.find('\'') != -1:
src = src + t.strip('\'')
else:
src = src + enc.smart_unicode(tmp[t])
elif info.src.__contains__('||'):
variables = info.src.split('||')
src = firstNonEmpty(tmp, variables)
else:
src = tmp[info.src]
if src and info.convert != []:
src = self.__parseCommands(tmp, src, info.convert)
if isinstance(src, dict):
for dKey in src:
tmp[dKey] = src[dKey]
src = src.values()[0]
info_value = info.build % (enc.smart_unicode(src))
else:
info_value = info.build
tmp[info.name] = info_value
tmp['url'] = enc.smart_unicode(item_rule.url_build % (enc.smart_unicode(tmp['url'])))
tmp.merge(lItem)
if item_rule.skill.find('append') != -1:
tmp['url'] = url + tmp['url']
if item_rule.skill.find('space') != -1:
tmp['title'] = ' %s ' % tmp['title'].strip()
tmp['definedIn'] = definedIn
items.append(tmp)
return items
示例7: __parseHtml
# 需要导入模块: from entities.CListItem import CListItem [as 别名]
# 或者: from entities.CListItem.CListItem import merge [as 别名]
def __parseHtml(self, url, data, rules, skills, definedIn, lItem):
# common.log('_parseHtml called')
items = []
for item_rule in rules:
# common.log('rule: ' + item_rule.infos)
if not hasattr(item_rule, "precheck") or (item_rule.precheck in data):
revid = re.compile(item_rule.infos, re.IGNORECASE + re.DOTALL + re.MULTILINE)
for reinfos in revid.findall(data):
tmp = CListItem()
if lItem["referer"]:
tmp["referer"] = lItem["referer"]
if item_rule.order.find("|") != -1:
infos_names = item_rule.order.split("|")
infos_values = list(reinfos)
i = 0
for name in infos_names:
tmp[name] = infos_values[i]
i = i + 1
else:
tmp[item_rule.order] = reinfos
for info in item_rule.info_list:
info_value = tmp[info.name]
if info_value:
if info.build.find("%s") != -1:
tmpVal = enc.smart_unicode(info.build % enc.smart_unicode(info_value))
tmp[info.name] = tmpVal
continue
if info.build.find("%s") != -1:
if info.src.__contains__("+"):
tmpArr = info.src.split("+")
src = ""
for t in tmpArr:
t = t.strip()
if t.find("'") != -1:
src = src + t.strip("'")
else:
src = src + enc.smart_unicode(tmp[t])
elif info.src.__contains__("||"):
variables = info.src.split("||")
src = firstNonEmpty(tmp, variables)
else:
src = tmp[info.src]
if src and info.convert != []:
src = self.__parseCommands(tmp, src, info.convert)
if isinstance(src, dict):
for dKey in src:
tmp[dKey] = src[dKey]
src = src.values()[0]
info_value = info.build % (enc.smart_unicode(src))
else:
info_value = info.build
tmp[info.name] = info_value
tmp["url"] = enc.smart_unicode(item_rule.url_build % (enc.smart_unicode(tmp["url"])))
tmp.merge(lItem)
if item_rule.skill.find("append") != -1:
tmp["url"] = url + tmp["url"]
if item_rule.skill.find("space") != -1:
tmp["title"] = " %s " % tmp["title"].strip()
if skills.find("videoTitle") > -1:
tmp["videoTitle"] = tmp["title"]
tmp["definedIn"] = definedIn
items.append(tmp)
return items
示例8: __parseCfg
# 需要导入模块: from entities.CListItem import CListItem [as 别名]
# 或者: from entities.CListItem.CListItem import merge [as 别名]
def __parseCfg(self, cfgFile, data, lItem):
tmpList = CList()
data = data.replace("\r\n", "\n").split("\n")
items = []
tmp = None
hasOwnCfg = False
for m in data:
if m and m[0] != "#":
index = m.find("=")
if index != -1:
key = lower(m[:index]).strip()
value = m[index + 1 :]
index = value.find("|")
if value[:index] == "sports.devil.locale":
value = common.translate(int(value[index + 1 :]))
elif value[:index] == "sports.devil.image":
value = os.path.join(common.Paths.imgDir, value[index + 1 :])
if key == "start":
tmpList.start = value
elif key == "section":
tmpList.section = value
elif key == "sort":
tmpList.sort = value
elif key == "skill":
tmpList.skill = value
elif key == "catcher":
tmpList.catcher = value
elif key == "item_infos":
rule_tmp = CRuleItem()
hasOwnCfg = False
rule_tmp.infos = value
elif key == "item_order":
rule_tmp.order = value
elif key == "item_skill":
rule_tmp.skill = value
elif key == "item_curr":
rule_tmp.curr = value
elif key == "item_precheck":
rule_tmp.precheck = value
elif key.startswith("item_info"):
tmpkey = key[len("item_info") :]
if tmpkey == "_name":
info_tmp = CItemInfo()
info_tmp.name = value
if value == "cfg":
hasOwnCfg = True
elif tmpkey == "_from":
info_tmp.src = value
elif tmpkey == "":
info_tmp.rule = value
elif tmpkey == "_default":
info_tmp.default = value
elif tmpkey == "_convert":
info_tmp.convert.append(value)
elif tmpkey == "_build":
info_tmp.build = value
rule_tmp.info_list.append(info_tmp)
elif key == "item_url_build":
rule_tmp.url_build = value
if tmpList.catcher != "":
refInf = CItemInfo()
refInf.name = "referer"
refInf.build = value
rule_tmp.info_list.append(refInf)
if not hasOwnCfg:
refInf = CItemInfo()
refInf.name = "catcher"
refInf.build = tmpList.catcher
rule_tmp.info_list.append(refInf)
tmpList.rules.append(rule_tmp)
# static menu items (without regex)
elif key == "title":
tmp = CListItem()
tmp["title"] = value
if tmpList.skill.find("videoTitle") > -1:
tmp["videoTitle"] = value
elif key == "url":
tmp["url"] = value
if lItem:
tmp.merge(lItem)
if tmpList.catcher != "":
tmp["referer"] = value
if not hasOwnCfg:
tmp["catcher"] = tmpList.catcher
#.........这里部分代码省略.........