mirror of https://github.com/evilhero/mylar
FIX:(#608) Anti-hammering code not disabled for local newznab IP (thnx IanHub), FIX: PostProcessing will now be able to handle .INH and .NOW issues, FIX: Search improvements for issues with decimals and non-numerics (ie. 18.INH), FIX: If annual present in series directory, but no annual data present for series, would error out
This commit is contained in:
parent
aad93a2314
commit
d146e0f0db
|
@ -464,12 +464,21 @@ class PostProcessor(object):
|
|||
#new CV API - removed all decimals...here we go AGAIN!
|
||||
issuenum = issuenzb['Issue_Number']
|
||||
issue_except = 'None'
|
||||
if 'au' in issuenum.lower():
|
||||
|
||||
if 'au' in issuenum.lower() and issuenum[:1].isdigit():
|
||||
issuenum = re.sub("[^0-9]", "", issuenum)
|
||||
issue_except = ' AU'
|
||||
elif 'ai' in issuenum.lower():
|
||||
elif 'ai' in issuenum.lower() and issuenum[:1].isdigit():
|
||||
issuenum = re.sub("[^0-9]", "", issuenum)
|
||||
issue_except = ' AI'
|
||||
elif 'inh' in issuenum.lower() and issuenum[:1].isdigit():
|
||||
issuenum = re.sub("[^0-9]", "", issuenum)
|
||||
issue_except = '.INH'
|
||||
elif 'now' in issuenum.lower() and issuenum[:1].isdigit():
|
||||
if '!' in issuenum: issuenum = re.sub('\!', '', issuenum)
|
||||
issuenum = re.sub("[^0-9]", "", issuenum)
|
||||
issue_except = '.NOW'
|
||||
|
||||
if '.' in issuenum:
|
||||
iss_find = issuenum.find('.')
|
||||
iss_b4dec = issuenum[:iss_find]
|
||||
|
@ -493,6 +502,7 @@ class PostProcessor(object):
|
|||
else:
|
||||
iss = issuenum
|
||||
issueno = str(iss)
|
||||
|
||||
# issue zero-suppression here
|
||||
if mylar.ZERO_LEVEL == "0":
|
||||
zeroadd = ""
|
||||
|
|
|
@ -673,9 +673,22 @@ def issuedigits(issnum):
|
|||
elif 'ai' in issnum.lower() and issnum[:1].isdigit():
|
||||
int_issnum = (int(issnum[:-2]) * 1000) + ord('a') + ord('i')
|
||||
elif 'inh' in issnum.lower():
|
||||
int_issnum = (int(issnum[:-4]) * 1000) + ord('i') + ord('n') + ord('h')
|
||||
remdec = issnum.find('.') #find the decimal position.
|
||||
if remdec == -1:
|
||||
#if no decimal, it's all one string
|
||||
#remove the last 3 characters from the issue # (INH)
|
||||
int_issnum = (int(issnum[:-3]) * 1000) + ord('i') + ord('n') + ord('h')
|
||||
else:
|
||||
int_issnum = (int(issnum[:-4]) * 1000) + ord('i') + ord('n') + ord('h')
|
||||
elif 'now' in issnum.lower():
|
||||
int_issnum = (int(issnum[:-4]) * 1000) + ord('n') + ord('o') + ord('w')
|
||||
if '!' in issnum: issnum = re.sub('\!', '', issnum)
|
||||
remdec = issnum.find('.') #find the decimal position.
|
||||
if remdec == -1:
|
||||
#if no decimal, it's all one string
|
||||
#remove the last 3 characters from the issue # (NOW)
|
||||
int_issnum = (int(issnum[:-3]) * 1000) + ord('n') + ord('o') + ord('w')
|
||||
else:
|
||||
int_issnum = (int(issnum[:-4]) * 1000) + ord('n') + ord('o') + ord('w')
|
||||
elif u'\xbd' in issnum:
|
||||
issnum = .5
|
||||
int_issnum = int(issnum) * 1000
|
||||
|
|
|
@ -124,6 +124,16 @@ def search_init(ComicName, IssueNumber, ComicYear, SeriesYear, IssueDate, IssueI
|
|||
nzbpr == 0
|
||||
findit = 'no'
|
||||
|
||||
#provider order sequencing here.
|
||||
#prov_order = []
|
||||
|
||||
#if len(mylar.PROVIDER_ORDER) > 0:
|
||||
# for pr_order in mylar.PROVIDER_ORDER:
|
||||
# prov_order.append(pr_order[1])
|
||||
# logger.fdebug('sequence is now to start with ' + pr_order[1] + ' at spot #' + str(pr_order[0]))
|
||||
|
||||
# end provider order sequencing
|
||||
|
||||
#fix for issue dates between Nov-Dec/Jan
|
||||
IssDt = str(IssueDate)[5:7]
|
||||
if IssDt == "12" or IssDt == "11" or IssDt == "01" or IssDt == "02":
|
||||
|
@ -530,7 +540,7 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
|
|||
# here we account for issue pattern variations
|
||||
if seperatealpha == "yes":
|
||||
isssearch = str(c_number) + "%20" + str(c_alpha)
|
||||
|
||||
|
||||
if cmloopit == 3:
|
||||
comsearch = comsrc + "%2000" + str(isssearch) + "%20" + str(filetype)
|
||||
issdig = '00'
|
||||
|
@ -543,7 +553,6 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
|
|||
|
||||
mod_isssearch = str(issdig) + str(isssearch)
|
||||
|
||||
|
||||
#--- this is basically for RSS Feeds ---
|
||||
logger.fdebug('RSS Check: ' + str(RSS))
|
||||
logger.fdebug('nzbprov: ' + str(nzbprov))
|
||||
|
@ -618,8 +627,15 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
|
|||
pause_the_search = 1 * 60
|
||||
|
||||
#bypass for local newznabs
|
||||
if nzbprov == 'newznab' and (host_newznab_fix[:3] == '10.' or host_newznab_fix[:4] == '172.' or host_newznab_fix[:4] == '192.' or 'localhost' in str(host_newznab_fix)):
|
||||
pass
|
||||
#remove the protocol string (http/https)
|
||||
if host_newznab_fix.startswith('http'):
|
||||
hnc = host_newznab_fix.replace('http://', '')
|
||||
elif host_newznab_fix.startswith('https'):
|
||||
hnc = host_newznab_fix.replace('https://', '')
|
||||
else:
|
||||
hnc = host_newznab_fix
|
||||
if nzbprov == 'newznab' and (hnc[:3] == '10.' or hnc[:4] == '172.' or hnc[:4] == '192.' or hnc.startswith('localhost')):
|
||||
pass
|
||||
else:
|
||||
logger.info("pausing for " + str(pause_the_search) + " seconds before continuing to avoid hammering")
|
||||
time.sleep(pause_the_search)
|
||||
|
@ -902,8 +918,18 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
|
|||
continue
|
||||
else:
|
||||
if a_issno == '' and alphas is not None:
|
||||
#print 'issno & alphas blank'
|
||||
#print 'splitit: ' + splitit[(len(splitit)-2)]
|
||||
#print 'splitit: ' + splitit[(len(splitit)-1)]
|
||||
#if there' a space between the issue & alpha, join them.
|
||||
comic_iss = splitit[(len(splitit)-2)] + splitit[(len(splitit)-1)]
|
||||
findstart = thisentry.find(splitit[(len(splitit)-1)])
|
||||
#print 'thisentry : ' + thisentry
|
||||
#print 'decimal location : ' + str(findstart)
|
||||
if thisentry[findstart-1] == '.':
|
||||
comic_iss = splitit[(len(splitit)-2)] + '.' + splitit[(len(splitit)-1)]
|
||||
else:
|
||||
comic_iss = splitit[(len(splitit)-2)] + splitit[(len(splitit)-1)]
|
||||
logger.fdebug('comic_iss is : ' + str(comic_iss))
|
||||
splitst = len(splitit) - 2
|
||||
else:
|
||||
comic_iss = tmpiss
|
||||
|
@ -1100,7 +1126,7 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
|
|||
nzbtemp = re.sub('torrent=', '', nzbtemp).rstrip()
|
||||
nzbid = re.sub('.torrent', '', nzbtemp).rstrip()
|
||||
elif nzbprov == 'KAT':
|
||||
url_parts = urllib.parse.urlparse(entry['link'])
|
||||
url_parts = urlparse.urlparse(entry['link'])
|
||||
path_parts = url_parts[2].rpartition('/')
|
||||
nzbtempid = pathparts[2]
|
||||
nzbid = re.sub('.torrent', '', nzbtempid).rstrip()
|
||||
|
|
|
@ -645,6 +645,7 @@ def forceRescan(ComicID,archive=None):
|
|||
fcnew = shlex.split(str(temploc))
|
||||
fcn = len(fcnew)
|
||||
n = 0
|
||||
reann = None
|
||||
while (n < anncnt):
|
||||
som = 0
|
||||
try:
|
||||
|
@ -705,7 +706,11 @@ def forceRescan(ComicID,archive=None):
|
|||
writeit = True
|
||||
if mylar.ANNUALS_ON:
|
||||
if 'annual' in temploc.lower():
|
||||
iss_id = reann['IssueID']
|
||||
if reann is None:
|
||||
logger.fdebug('Annual present in location, but series does not have any annuals attached to it - Ignoring')
|
||||
writeit = False
|
||||
else:
|
||||
iss_id = reann['IssueID']
|
||||
else:
|
||||
iss_id = reiss['IssueID']
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue