mirror of https://github.com/evilhero/mylar
Consider Usenet Retention in searches
All providers should now consider usenet retention. I've tested newznab, nzbx and "experimental", nzb.su and dognzb are newznab based so should work but I can't test them.
This commit is contained in:
parent
8ce830d703
commit
12b195e2f9
|
@ -29,8 +29,10 @@ def Startit(searchName, searchIssue, searchYear):
|
|||
|
||||
if mylar.USE_MAXSIZE:
|
||||
size_constraints = size_constraints + "&maxsize=" + str(mylar.MAXSIZE)
|
||||
|
||||
feed = feedparser.parse("http://nzbindex.nl/rss/alt.binaries.comics.dcp/?sort=agedesc&" + str(size_constraints) + "&dq=%s&max=25&more=1" %joinSearch)
|
||||
if mylar.USENET_RETENTION != None:
|
||||
max_age = "&age=" + str(mylar.USENET_RETENTION)
|
||||
|
||||
feed = feedparser.parse("http://nzbindex.nl/rss/alt.binaries.comics.dcp/?sort=agedesc&" + str(size_constraints) + str(max_age) + "&dq=%s&max=25&more=1" %joinSearch)
|
||||
|
||||
totNum = len(feed.entries)
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import lib.simplejson as json
|
||||
import mylar
|
||||
from mylar import logger, helpers
|
||||
import urllib2
|
||||
import urllib2, datetime
|
||||
|
||||
|
||||
def searchit(cm):
|
||||
|
@ -39,18 +39,24 @@ def searchit(cm):
|
|||
url = item['nzb']
|
||||
title = item['name']
|
||||
size = item['size']
|
||||
|
||||
entries.append({
|
||||
'title': str(title),
|
||||
'link': str(url)
|
||||
})
|
||||
nzbdate = datetime.datetime.fromtimestamp(item['postdate'])
|
||||
nzbage = abs(( datetime.datetime.now()-nzbdate).days )
|
||||
if nzbage <= mylar.USENET_RETENTION:
|
||||
entries.append({
|
||||
'title': str(title),
|
||||
'link': str(url)
|
||||
})
|
||||
logger.fdebug('Found %s. Size: %s' % (title, helpers.bytes_to_mb(size)))
|
||||
else:
|
||||
logger.fdebug('%s outside usenet retention: %s days.' % (title, nzbage))
|
||||
#resultlist.append((title, size, url, provider))
|
||||
logger.fdebug('Found %s. Size: %s' % (title, helpers.bytes_to_mb(size)))
|
||||
|
||||
except Exception, e:
|
||||
logger.error(u"An unknown error occurred trying to parse the feed: %s" % e)
|
||||
|
||||
if len(entries) >= 1:
|
||||
mres['entries'] = entries
|
||||
else:
|
||||
mres = "no results"
|
||||
return mres
|
||||
|
||||
|
|
1762
mylar/search.py
1762
mylar/search.py
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue