本文整理汇总了Python中sickbeard.helpers.get_xml_text函数的典型用法代码示例。如果您正苦于以下问题:Python get_xml_text函数的具体用法?Python get_xml_text怎么用?Python get_xml_text使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_xml_text函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: _get_title_and_url
def _get_title_and_url(self, item):
title, url = None, None
self.cache._remove_namespace(item)
title = helpers.get_xml_text(item.find('title'))
attempt_list = [lambda: helpers.get_xml_text(item.find('magnetURI')),
lambda: item.find('enclosure').get('url'),
lambda: helpers.get_xml_text(item.find('link'))]
for cur_attempt in attempt_list:
try:
url = cur_attempt()
except:
continue
if title and url:
return (title, url)
return (title, url)
开发者ID:albcool,项目名称:SickBeard-TVRage,代码行数:25,代码来源:rsstorrent.py
示例2: _get_title_and_url
def _get_title_and_url(self, item):
"""
Retrieves the title and URL data from the item XML node.
Overridden here so that we can have a preference for magnets.
item: An xml.dom.minidom.Node representing the <item> tag of the RSS feed
Returns: A tuple containing two strings representing title and URL respectively
"""
title = helpers.get_xml_text(item.getElementsByTagName("title")[0])
url = None
try:
if sickbeard.PREFER_MAGNETS:
try:
url = helpers.get_xml_text(item.getElementsByTagName("magnetURI")[0])
torrent_hash = self.getHashFromMagnet(url)
if not torrent_hash:
logger.log(
u'magnetURI "%s" found for "%s", but it has no valid hash - ignoring' % (url, title),
logger.WARNING,
)
url = None
except Exception:
pass
if url is None:
url = helpers.get_xml_text(item.getElementsByTagName("link")[0])
if url:
url = url.replace("&", "&")
except IndexError:
url = None
return (title, url)
开发者ID:phlunk3,项目名称:Sick-Beard,代码行数:31,代码来源:generic.py
示例3: _get_title_and_url
def _get_title_and_url(self, item):
title = helpers.get_xml_text(item.find('title'))
# logger.log('publichd got title' + title)
url = None
if sickbeard.PREFER_MAGNETS:
magnetURI = helpers.get_xml_text(item.find('{http://xmlns.ezrss.it/0.1/}torrent/{http://xmlns.ezrss.it/0.1/}magnetURI'))
# logger.log('publichd got magnetURI' + magnetURI)
if magnetURI:
url = magnetURI
if not url:
enclos = item.find('enclosure')
if enclos is not None:
url = enclos.get('url')
# logger.log('publichd got enclosure url ' + url)
if url:
url = url.replace('&', '&')
if title.startswith('[TORRENT] '):
title = title[10:]
# these guys also get creative with the torrent names, adding crud at the
# end like "[PublicHD]", "[P2PDL]" etc. which confuses sb. Best to
# just remove it if present
crudAtEndMatch = re.match(r'(.*) \[\w+\]$', title)
if crudAtEndMatch:
title = crudAtEndMatch.group(1)
return (title, url)
开发者ID:AbhieSpeaks,项目名称:Sick-Beard,代码行数:29,代码来源:publichd.py
示例4: _doSearch
def _doSearch(self, searchString, show=None, season=None, french=None):
results = []
searchUrl = self.url+'rdirect.php?type=search&'+searchString.replace('!','')
logger.log(u"Search URL: " + searchUrl, logger.DEBUG)
data = self.getURL(searchUrl)
if "bad key" in str(data).lower() :
logger.log(u"GKS key invalid, check your config", logger.ERROR)
return []
parsedXML = parseString(data)
channel = parsedXML.getElementsByTagName('channel')[0]
description = channel.getElementsByTagName('description')[0]
description_text = helpers.get_xml_text(description).lower()
if "user can't be found" in description_text:
logger.log(u"GKS invalid digest, check your config", logger.ERROR)
return []
elif "invalid hash" in description_text:
logger.log(u"GKS invalid hash, check your config", logger.ERROR)
return []
else :
items = channel.getElementsByTagName('item')
for item in items:
title = helpers.get_xml_text(item.getElementsByTagName('title')[0])
if "aucun resultat" in title.lower() :
logger.log(u"No results found in " + searchUrl, logger.DEBUG)
return []
count=1
if season:
count=0
if show:
if show.audio_lang=='fr' or french:
for frword in['french', 'truefrench', 'multi']:
if frword in title.lower():
count+=1
else:
count +=1
else:
count +=1
if count==0:
continue
else :
downloadURL = helpers.get_xml_text(item.getElementsByTagName('link')[0])
quality = Quality.nameQuality(title)
if quality==Quality.UNKNOWN and title:
if '720p' not in title.lower() and '1080p' not in title.lower():
quality=Quality.SDTV
if show and french==None:
results.append( GksSearchResult( self.opener, title, downloadURL, quality, str(show.audio_lang) ) )
elif show and french:
results.append( GksSearchResult( self.opener, title, downloadURL, quality, 'fr' ) )
else:
results.append( GksSearchResult( self.opener, title, downloadURL, quality ) )
return results
开发者ID:Arakmar,项目名称:Sick-Beard,代码行数:55,代码来源:gks.py
示例5: _parseItem
def _parseItem(self, item):
title = helpers.get_xml_text(item.getElementsByTagName('title')[0])
url = helpers.get_xml_text(item.getElementsByTagName('link')[0])
if not title or not url:
logger.log("The XML returned from the FreshOnTV RSS feed is incomplete, this result is unusable", logger.ERROR)
return
logger.log("Adding item from RSS to cache: " + title, logger.DEBUG)
self._addCacheEntry(title, url,
quality=common.Quality.nameQuality(title))
开发者ID:andrei1089,项目名称:Sick-Beard,代码行数:11,代码来源:freshontv.py
示例6: _get_title_and_url
def _get_title_and_url(self, item):
"""
Retrieves the title and URL data from the item XML node
item: An xml.dom.minidom.Node representing the <item> tag of the RSS feed
Returns: A tuple containing two strings representing title and URL respectively
"""
title = helpers.get_xml_text(item.getElementsByTagName('title')[0])
url = helpers.get_xml_text(item.getElementsByTagName('link')[0])
if url:
url = url.replace('&','&')
return (title, url)
开发者ID:flash2011,项目名称:Sick-Beard,代码行数:14,代码来源:generic.py
示例7: _get_title_and_url
def _get_title_and_url(self, item):
title = helpers.get_xml_text(item.getElementsByTagName('title')[0])
url = item.getElementsByTagName('enclosure')[0].getAttribute('url').replace('&','&')
if title.startswith('[TORRENT] '):
title = title[10:]
return (title, url)
开发者ID:Vinkiejj,项目名称:Sick-Beard,代码行数:7,代码来源:publichd.py
示例8: _get_title_and_url
def _get_title_and_url(self, item):
(title, url) = generic.TorrentProvider._get_title_and_url(self, item)
if url and url.startswith(('http://twitter.com/', 'https://twitter.com/')):
# this feed came from twitter
#
# we need to extract the filename and url from the twitter message (the url we have currently is just that of the twitter message,
# which is of little use to us).
# The message looks something like this:
# eztv_it: History Ch The Universe Season 4 08of12 Space Wars XviD AC3 [MVGroup org] - http://t.co/mGTrhB4a
#
# Start by splitting the (real) url from the filename
title, url = title.rsplit(' - http', 1)
url = 'http' + url
# Then strip off the leading eztv_it:
if title.startswith('eztv_it:'):
title = title[8:]
# For safety we remove any whitespace too.
title = title.strip()
logger.log(u"Extracted the name %s and url %s from the twitter link"%(title, url), logger.DEBUG)
else:
# this feed came from ezrss
torrent_node = item.getElementsByTagName('torrent')[0]
filename_node = torrent_node.getElementsByTagName('fileName')[0]
filename = get_xml_text(filename_node)
new_title = self._extract_name_from_filename(filename)
if new_title:
title = new_title
logger.log(u"Extracted the name "+title+" from the torrent link", logger.DEBUG)
return (title, url)
开发者ID:wesleyvl007,项目名称:Sick-Beard,代码行数:35,代码来源:ezrss.py
示例9: _get_title_and_url
def _get_title_and_url(self, item):
#(title, url) = generic.TorrentProvider._get_title_and_url(self, item)
title = helpers.get_xml_text(item.getElementsByTagName('title')[0])
url = None
# if we have a preference for magnets, go straight for the throat...
try:
url = helpers.get_xml_text(item.getElementsByTagName('magnetURI')[0])
except Exception:
pass
if url is None:
url = item.getElementsByTagName('enclosure')[0].getAttribute('url').replace('&','&')
return (title, url)
开发者ID:Guilde,项目名称:Sick-Beard,代码行数:16,代码来源:kat.py
示例10: _get_title_and_url
def _get_title_and_url(self, item):
(title, url) = generic.TorrentProvider._get_title_and_url(self, item)
filename = helpers.get_xml_text(item.find('{http://xmlns.ezrss.it/0.1/}torrent/{http://xmlns.ezrss.it/0.1/}fileName'))
magnet = helpers.get_xml_text(item.find('{http://xmlns.ezrss.it/0.1/}torrent/{http://xmlns.ezrss.it/0.1/}magnetURI'))
if filename:
new_title = self._extract_name_from_filename(filename)
if new_title:
title = new_title
logger.log(u"Extracted the name " + title + " from the torrent link", logger.DEBUG)
if self.useMagnet() and magnet:
url = magnet
return (title, url)
开发者ID:Zelgadis87,项目名称:Sick-Beard,代码行数:16,代码来源:ezrss.py
示例11: findPropers
def findPropers(self, search_date=None):
search_terms = ['.proper.', '.repack.']
cache_results = self.cache.listPropers(search_date)
results = [classes.Proper(x['name'], x['url'], datetime.datetime.fromtimestamp(x['time'])) for x in cache_results]
for term in search_terms:
for item in self._doSearch({'q': term}, max_age=4):
(title, url) = self._get_title_and_url(item)
description_node = item.find('pubDate')
description_text = helpers.get_xml_text(description_node)
try:
# we could probably do dateStr = descriptionStr but we want date in this format
date_text = re.search('(\w{3}, \d{1,2} \w{3} \d{4} \d\d:\d\d:\d\d) [\+\-]\d{4}', description_text).group(1)
except:
date_text = None
if not date_text:
logger.log(u"Unable to figure out the date for entry " + title + ", skipping it")
continue
else:
result_date = email.utils.parsedate(date_text)
if result_date:
result_date = datetime.datetime(*result_date[0:6])
if not search_date or result_date > search_date:
search_result = classes.Proper(title, url, result_date)
results.append(search_result)
return results
开发者ID:vertigo235,项目名称:Sick-Beard-XEM,代码行数:35,代码来源:newznab.py
示例12: _parseItem
def _parseItem(self, item):
title = helpers.get_xml_text(item.getElementsByTagName('title')[0])
url = helpers.get_xml_text(item.getElementsByTagName('link')[0])
self._checkItemAuth(title, url)
if not title or not url:
logger.log(u"The XML returned from the "+self.provider.name+" feed is incomplete, this result is unusable", logger.ERROR)
return
url = self._translateLinkURL(url)
logger.log(u"Adding item from RSS to cache: "+title, logger.DEBUG)
self._addCacheEntry(title, url)
开发者ID:wody,项目名称:Sick-Beard,代码行数:16,代码来源:tvcache.py
示例13: _get_title_and_url
def _get_title_and_url(self, item):
(title, url) = generic.TorrentProvider._get_title_and_url(self, item)
try:
# ezrss feed will have a 'torrent' node
torrent_node = item.getElementsByTagName('torrent')[0]
filename_node = torrent_node.getElementsByTagName('fileName')[0]
filename = get_xml_text(filename_node)
new_title = self._extract_name_from_filename(filename)
if new_title:
title = new_title
logger.log(u"Extracted the name "+title+" from the torrent link", logger.DEBUG)
except IndexError:
# we'll get an IndexError above when there's no 'torrent' node,
# which likely means that this isn't in the special ezrss format.
# So assume we're working with with a standard rss feed.
logger.log(u"IndexError while parsing the ezrss feed, maybe it's just standard RSS? Trying that ...", logger.DEBUG)
(title, url) = generic.TorrentProvider._get_title_and_url(self, item)
# feedburner adds "[eztv] " to the start of all titles, so trim it off
if title and title[:7] == "[eztv] ":
title = title[7:]
logger.log(u"Trimmed [eztv] from title to get %s" % title, logger.DEBUG)
# ditto VTV:
if title and title[:6] == "[VTV] ":
title = title[6:]
logger.log(u"Trimmed [VTV] from title to get %s" % title, logger.DEBUG)
return (title, url)
开发者ID:eagleamon,项目名称:Sick-Beard,代码行数:32,代码来源:ezrss.py
示例14: getQuality
def getQuality(self, item):
attributes = item.report[0]
attr_dict = {}
for attribute in attributes.getElementsByTagName('report:attribute'):
cur_attr = attribute.getAttribute('type')
cur_attr_value = helpers.get_xml_text(attribute)
if cur_attr not in attr_dict:
attr_dict[cur_attr] = [cur_attr_value]
else:
attr_dict[cur_attr].append(cur_attr_value)
logger.log("Finding quality of item based on attributes " + str(attr_dict), logger.DEBUG)
if self._is_SDTV(attr_dict):
quality = Quality.SDTV
elif self._is_SDDVD(attr_dict):
quality = Quality.SDDVD
elif self._is_HDTV(attr_dict):
quality = Quality.HDTV
elif self._is_WEBDL(attr_dict):
quality = Quality.HDWEBDL
elif self._is_720pBluRay(attr_dict):
quality = Quality.HDBLURAY
elif self._is_1080pBluRay(attr_dict):
quality = Quality.FULLHDBLURAY
else:
quality = Quality.UNKNOWN
logger.log("Resulting quality: " + str(quality), logger.DEBUG)
return quality
开发者ID:jvdpoll,项目名称:SickBeard-TVRage,代码行数:32,代码来源:newzbin.py
示例15: _get_title_and_url
def _get_title_and_url(self, item):
description_node = item.getElementsByTagName("description")[0]
title = get_xml_text(description_node).replace("_", ".").split(" (")[0]
url = item.getElementsByTagName("enclosure")[0].getAttribute("url")
return (title, url)
开发者ID:Xupack,项目名称:Sickbeard-MrOrange,代码行数:7,代码来源:dtt.py
示例16: _get_title_and_url
def _get_title_and_url(self, item):
# (title, url) = generic.TorrentProvider._get_title_and_url(self, item)
title = helpers.get_xml_text(item.getElementsByTagName("title")[0])
url = item.getElementsByTagName("enclosure")[0].getAttribute("url").replace("&", "&")
return (title, url)
开发者ID:RamenNinja,项目名称:Sick-Beard,代码行数:7,代码来源:dailytvtorrents.py
示例17: getQuality
def getQuality(self, item):
filename = helpers.get_xml_text(
item.find('{http://xmlns.ezrss.it/0.1/}torrent/{http://xmlns.ezrss.it/0.1/}fileName'))
quality = Quality.nameQuality(filename)
return quality
开发者ID:coach0742,项目名称:SickBeard-TVRage,代码行数:7,代码来源:ezrss.py
示例18: _get_title_and_url
def _get_title_and_url(self, item):
#(title, url) = generic.TorrentProvider._get_title_and_url(self, item)
title = helpers.get_xml_text(item.getElementsByTagName('title')[0])
url = item.getElementsByTagName('enclosure')[0].getAttribute('url').replace('&','&')
return (title, url)
开发者ID:Halopend,项目名称:Sick-Beard,代码行数:7,代码来源:kat.py
示例19: _parseItem
def _parseItem(self, item):
title = helpers.get_xml_text(item.find('title'))
url = helpers.get_xml_text(item.find('link'))
self._checkItemAuth(title, url)
if title and url:
title = self._translateTitle(title)
url = self._translateLinkURL(url)
logger.log(u"Adding item from RSS to cache: " + title, logger.DEBUG)
self._addCacheEntry(title, url)
else:
logger.log(u"The XML returned from the " + self.provider.name + " feed is incomplete, this result is unusable", logger.DEBUG)
return
开发者ID:ikkemaniac,项目名称:Sick-Beard,代码行数:17,代码来源:tvcache.py
示例20: _get_title_and_url
def _get_title_and_url(self, item):
"""
Retrieves the title and URL data from the item XML node
item: An elementtree.ElementTree element representing the <item> tag of the RSS feed
Returns: A tuple containing two strings representing title and URL respectively
"""
title = helpers.get_xml_text(item.find('title'))
if title:
title = title.replace(' ', '.')
url = helpers.get_xml_text(item.find('link'))
if url:
url = url.replace('&', '&')
return (title, url)
开发者ID:albcool,项目名称:SickBeard-TVRage,代码行数:17,代码来源:generic.py
注:本文中的sickbeard.helpers.get_xml_text函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论