mirror of
https://github.com/SickGear/SickGear.git
synced 2025-01-08 11:03:38 +00:00
Change recent search to use centralised title and URL parser for newznab.
This commit is contained in:
parent
77209d019a
commit
02e24c6f8f
2 changed files with 6 additions and 11 deletions
|
@ -1,6 +1,7 @@
|
||||||
### 0.13.0 (2016-xx-xx xx:xx:xx UTC)
|
### 0.13.0 (2016-xx-xx xx:xx:xx UTC)
|
||||||
|
|
||||||
* Change don't fetch caps for disabled nzb providers
|
* Change don't fetch caps for disabled nzb providers
|
||||||
|
* Change recent search to use centralised title and URL parser for newznab
|
||||||
|
|
||||||
|
|
||||||
[develop changelog]
|
[develop changelog]
|
||||||
|
|
|
@ -414,14 +414,13 @@ class NewznabProvider(generic.NZBProvider):
|
||||||
def _title_and_url(self, item):
|
def _title_and_url(self, item):
|
||||||
title, url = None, None
|
title, url = None, None
|
||||||
try:
|
try:
|
||||||
title = item.findtext('title')
|
title = ('%s' % item.findtext('title')).strip()
|
||||||
url = item.findtext('link')
|
for pattern, repl in ((r'\s+', '.'), (r'(?i)-Obfuscated$', '')):
|
||||||
|
title = re.sub(pattern, repl, title)
|
||||||
|
url = str(item.findtext('link')).replace('&', '&')
|
||||||
except (StandardError, Exception):
|
except (StandardError, Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
title = title and re.sub(r'\s+', '.', '%s' % title)
|
|
||||||
url = url and str(url).replace('&', '&')
|
|
||||||
|
|
||||||
return title, url
|
return title, url
|
||||||
|
|
||||||
def get_show(self, item, **kwargs):
|
def get_show(self, item, **kwargs):
|
||||||
|
@ -859,19 +858,14 @@ class NewznabCache(tvcache.TVCache):
|
||||||
# overwrite method with that parses the rageid from the newznab feed
|
# overwrite method with that parses the rageid from the newznab feed
|
||||||
def _parseItem(self, ns, item):
|
def _parseItem(self, ns, item):
|
||||||
|
|
||||||
title = item.findtext('title')
|
title, url = self._title_and_url(item)
|
||||||
url = item.findtext('link')
|
|
||||||
|
|
||||||
ids = self.parse_ids(item, ns)
|
ids = self.parse_ids(item, ns)
|
||||||
|
|
||||||
self._checkItemAuth(title, url)
|
|
||||||
|
|
||||||
if not title or not url:
|
if not title or not url:
|
||||||
logger.log('The data returned from the %s feed is incomplete, this result is unusable'
|
logger.log('The data returned from the %s feed is incomplete, this result is unusable'
|
||||||
% self.provider.name, logger.DEBUG)
|
% self.provider.name, logger.DEBUG)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
url = self._translateLinkURL(url)
|
|
||||||
|
|
||||||
logger.log('Attempting to add item from RSS to cache: %s' % title, logger.DEBUG)
|
logger.log('Attempting to add item from RSS to cache: %s' % title, logger.DEBUG)
|
||||||
return self.add_cache_entry(title, url, id_dict=ids)
|
return self.add_cache_entry(title, url, id_dict=ids)
|
||||||
|
|
Loading…
Reference in a new issue