1
0
Fork 0
mirror of https://github.com/evilhero/mylar synced 2025-02-02 12:31:44 +00:00

IMP: Experimental RSS search will now remove year requirements if series is the only series with that title, FIX: RSS Feeds for Experimental wasn't searching properly, FIX: Experimental sometimes wasn't able to download nzb (zero-byte returned)

This commit is contained in:
evilhero 2013-12-03 14:04:38 -05:00
parent f74809f094
commit 227547977e
2 changed files with 63 additions and 18 deletions

View file

@ -221,7 +221,7 @@ def nzbs(provider=None):
feeddata.append({ feeddata.append({
'Site': site, 'Site': site,
'Title': feed.entries[i].title, 'Title': feed.entries[i].title,
'Link': feed.entries[i].link, 'Link': tmpsz['url'], #feed.entries[i].link,
'Pubdate': feed.entries[i].updated, 'Pubdate': feed.entries[i].updated,
'Size': tmpsz['length'] 'Size': tmpsz['length']
}) })
@ -520,7 +520,7 @@ def torrentdbsearch(seriesname,issue,comicid=None,nzbprov=None):
return torinfo return torinfo
def nzbdbsearch(seriesname,issue,comicid=None,nzbprov=None): def nzbdbsearch(seriesname,issue,comicid=None,nzbprov=None,searchYear=None,ComicVersion=None):
myDB = db.DBConnection() myDB = db.DBConnection()
seriesname_alt = None seriesname_alt = None
if comicid is None or comicid == 'None': if comicid is None or comicid == 'None':
@ -535,10 +535,10 @@ def nzbdbsearch(seriesname,issue,comicid=None,nzbprov=None):
seriesname_alt = snm['AlternateSearch'] seriesname_alt = snm['AlternateSearch']
nsearch_seriesname = re.sub('[\'\!\@\#\$\%\:\;\/\\=\?\.\s]', '%',seriesname) nsearch_seriesname = re.sub('[\'\!\@\#\$\%\:\;\/\\=\?\.\-\s]', '%',seriesname)
formatrem_seriesname = re.sub('[\'\!\@\#\$\%\:\;\/\\=\?\.]', '',seriesname) formatrem_seriesname = re.sub('[\'\!\@\#\$\%\:\;\/\\=\?\.]', '',seriesname)
nsearch = nsearch_seriesname + "%" nsearch = '%' + nsearch_seriesname + "%"
nresults = myDB.action("SELECT * FROM rssdb WHERE Title like ? AND Site != 'CBT' AND Site != 'KAT'", [nsearch]) nresults = myDB.action("SELECT * FROM rssdb WHERE Title like ? AND Site=?", [nsearch,nzbprov])
if nresults is None: if nresults is None:
logger.fdebug('nzb search returned no results for ' + seriesname) logger.fdebug('nzb search returned no results for ' + seriesname)
if seriesname_alt is None: if seriesname_alt is None:
@ -550,7 +550,7 @@ def nzbdbsearch(seriesname,issue,comicid=None,nzbprov=None):
AS_Alternate = AlternateSearch AS_Alternate = AlternateSearch
for calt in chkthealt: for calt in chkthealt:
AS_Alternate = re.sub('##','',calt) AS_Alternate = re.sub('##','',calt)
nresults += myDB.action("SELECT * FROM rssdb WHERE Title like ? AND Site != 'CBT' AND Site != 'KAT'", [AS_Alternate]) nresults += myDB.action("SELECT * FROM rssdb WHERE Title like ? AND Site=?", [AS_Alternate,nzbprov])
if nresults is None: if nresults is None:
logger.fdebug('nzb alternate name search returned no results.') logger.fdebug('nzb alternate name search returned no results.')
return "no results" return "no results"
@ -558,16 +558,61 @@ def nzbdbsearch(seriesname,issue,comicid=None,nzbprov=None):
nzbtheinfo = [] nzbtheinfo = []
nzbinfo = {} nzbinfo = {}
for nzb in nresults: if nzbprov == 'experimental':
# no need to parse here, just compile and throw it back .... except_list=['releases', 'gold line', 'distribution', '0-day', '0 day']
nzbtheinfo.append({
'title': nzb['Title'], if ComicVersion:
'link': nzb['Link'], ComVersChk = re.sub("[^0-9]", "", ComicVersion)
'pubdate': nzb['Pubdate'], if ComVersChk == '':
'site': nzb['Site'], ComVersChk = 0
'length': nzb['Size'] else:
}) ComVersChk = 0
logger.fdebug("entered info for " + nzb['Title']) else:
ComVersChk = 0
for results in nresults:
title = results['Title']
#logger.fdebug("titlesplit: " + str(title.split("\"")))
splitTitle = title.split("\"")
noYear = 'False'
for subs in splitTitle:
#logger.fdebug(subs)
if len(subs) > 10 and not any(d in subs.lower() for d in except_list):
if ComVersChk == 0:
noYear = 'False'
if ComVersChk != 0 and searchYear not in subs:
noYear = 'True'
noYearline = subs
if searchYear in subs and noYear == 'True':
#this would occur on the next check in the line, if year exists and
#the noYear check in the first check came back valid append it
subs = noYearline + ' (' + searchYear + ')'
noYear = 'False'
if noYear == 'False':
nzbtheinfo.append({
'title': subs,
'link': re.sub('\/release\/', '/download/', results['Link']),
'pubdate': str(results['PubDate']),
'site': str(results['Site']),
'length': str(results['Size'])})
else:
for nzb in nresults:
# no need to parse here, just compile and throw it back ....
nzbtheinfo.append({
'title': nzb['Title'],
'link': nzb['Link'],
'pubdate': nzb['Pubdate'],
'site': nzb['Site'],
'length': nzb['Size']
})
logger.fdebug("entered info for " + nzb['Title'])
nzbinfo['entries'] = nzbtheinfo nzbinfo['entries'] = nzbtheinfo
return nzbinfo return nzbinfo

View file

@ -545,8 +545,8 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
if bb is not None: logger.fdebug("bb results: " + str(bb)) if bb is not None: logger.fdebug("bb results: " + str(bb))
else: else:
cmname = re.sub("%20", " ", str(comsrc)) cmname = re.sub("%20", " ", str(comsrc))
logger.fdebug("Sending request to RSS for " + str(findcomic) + " : " + str(mod_isssearch)) logger.fdebug("Sending request to RSS for " + str(findcomic) + " : " + str(mod_isssearch) + " (" + str(ComicYear) + ")")
bb = rsscheck.nzbdbsearch(findcomic,mod_isssearch,ComicID,nzbprov) bb = rsscheck.nzbdbsearch(findcomic,mod_isssearch,ComicID,nzbprov,ComicYear,ComicVersion)
rss = "yes" rss = "yes"
if bb is not None: logger.fdebug("bb results: " + str(bb)) if bb is not None: logger.fdebug("bb results: " + str(bb))
#this is the API calls #this is the API calls