1
0
Fork 0
mirror of https://github.com/evilhero/mylar synced 2024-12-26 01:26:50 +00:00

- Inject a function into Feedparser so that we can get the newznab:attr from the RSS feed. Now we can use it to get file sizes from the DOGNZB RSS. The complete list of possible attributes is available at http://newznab.readthedocs.org/en/latest/misc/api/#predefined-attributes , but it's a much smaller subset for comics and size is pretty much the only interesting one.

This commit is contained in:
Cybr Wizrd 2015-03-20 02:47:43 -04:00 committed by evilhero
parent 3ed8673152
commit ff0421d1ee

View file

@ -12,6 +12,23 @@ from StringIO import StringIO
import mylar import mylar
from mylar import db, logger, ftpsshup, helpers from mylar import db, logger, ftpsshup, helpers
def _start_newznab_attr(self, attrsD):
logger.fdebug('RSS newznab attributes', str(attrsD))
context = self._getContext()
context.setdefault('newznab', feedparser.FeedParserDict())
context['newznab'].setdefault('tags', feedparser.FeedParserDict())
name = attrsD.get('name')
value = attrsD.get('value')
if name == 'category':
context['newznab'].setdefault('categories', []).append(value)
else:
context['newznab'][name] = value
feedparser._FeedParserMixin._start_newznab_attr = _start_newznab_attr
def tehMain(forcerss=None): def tehMain(forcerss=None):
logger.info('RSS Feed Check was last run at : ' + str(mylar.RSS_LASTRUN)) logger.info('RSS Feed Check was last run at : ' + str(mylar.RSS_LASTRUN))
firstrun = "no" firstrun = "no"
@ -391,11 +408,9 @@ def nzbs(provider=None, forcerss=False):
if site == 'dognzb': if site == 'dognzb':
#because the rss of dog doesn't carry the enclosure item, we'll use the newznab size value #because the rss of dog doesn't carry the enclosure item, we'll use the newznab size value
tmpsz = 0 tmpsz = 0
#for attr in entry['newznab:attrib']: if 'newznab' in entry and 'size' in entry['newznab']:
# if attr('@name') == 'size': tmpsz = entry['newznab']['size']
# tmpsz = attr['@value']
# logger.fdebug('size retrieved as ' + str(tmpsz))
# break
feeddata.append({ feeddata.append({
'Site': site, 'Site': site,
'Title': entry.title, #ft['feed'].entries[i].title, 'Title': entry.title, #ft['feed'].entries[i].title,