FIX:(#2405) When searching annuals would incorrectly grab the wrong issue under certain conditions, FIX: fixed the issue number detection when parsing nzb results due to the use of decimal places as spacers being used by some providers

This commit is contained in:
evilhero 2020-01-20 13:40:38 -05:00
parent 6ffb938735
commit 931cbed1c6
No known key found for this signature in database
GPG Key ID: 3E12C51E39D91142
2 changed files with 13 additions and 8 deletions

View File

@ -272,6 +272,11 @@ class FileChecker(object):
logger.fdebug('[SARC] Removed Reading Order sequence from subname. Now set to : %s' % modfilename)
#make sure all the brackets are properly spaced apart
if modfilename.find('\s') == -1:
#if no spaces exist, assume decimals being used as spacers (ie. nzb name)
modspacer = '.'
else:
modspacer = ' '
m = re.findall('[^()]+', modfilename)
cnt = 1
#2019-12-24----fixed to accomodate naming convention like Amazing Mary Jane (2019) 002.cbr, and to account for brackets properly
@ -279,10 +284,10 @@ class FileChecker(object):
while cnt < len(m):
#logger.fdebug('[m=%s] modfilename.find: %s' % (m[cnt], modfilename[modfilename.find('('+m[cnt]+')')+len(m[cnt])+2]))
#logger.fdebug('mod_1: %s' % modfilename.find('('+m[cnt]+')'))
if modfilename[modfilename.find('('+m[cnt]+')')-1] != ' ' and modfilename.find('('+m[cnt]+')') != -1:
if modfilename[modfilename.find('('+m[cnt]+')')-1] != modspacer and modfilename.find('('+m[cnt]+')') != -1:
#logger.fdebug('before_space: %s' % modfilename[modfilename.find('('+m[cnt]+')')-1])
#logger.fdebug('after_space: %s' % modfilename[modfilename.find('('+m[cnt]+')')+len(m[cnt])+2])
modfilename = '%s%s%s' % (modfilename[:modfilename.find('('+m[cnt]+')')], ' ', modfilename[modfilename.find('('+m[cnt]+')'):])
modfilename = '%s%s%s' % (modfilename[:modfilename.find('('+m[cnt]+')')], modspacer, modfilename[modfilename.find('('+m[cnt]+')'):])
cnt+=1
except Exception as e:
#logger.warn('[ERROR] %s' % e)

View File

@ -1109,7 +1109,7 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, Publisher, IssueDa
logger.fdebug('Cleaned up title to : %s' % cleantitle)
#send it to the parser here.
p_comic = filechecker.FileChecker(file=ComicTitle)
p_comic = filechecker.FileChecker(file=ComicTitle, watchcomic=ComicName)
parsed_comic = p_comic.listFiles()
logger.fdebug('parsed_info: %s' % parsed_comic)
@ -1376,18 +1376,18 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, Publisher, IssueDa
intIss = 1000
else:
intIss = 9999999999
if parsed_comic['issue_number'] is not None:
logger.fdebug("issue we found for is : %s" % parsed_comic['issue_number'])
comintIss = helpers.issuedigits(parsed_comic['issue_number'])
if filecomic['justthedigits'] is not None:
logger.fdebug("issue we found for is : %s" % filecomic['justthedigits'])
comintIss = helpers.issuedigits(filecomic['justthedigits'])
logger.fdebug("integer value of issue we have found : %s" % comintIss)
else:
comintIss = 11111111111
#do this so that we don't touch the actual value but just use it for comparisons
if parsed_comic['issue_number'] is None:
if filecomic['justthedigits'] is None:
pc_in = None
else:
pc_in = helpers.issuedigits(parsed_comic['issue_number'])
pc_in = helpers.issuedigits(filecomic['justthedigits'])
#issue comparison now as well
if int(intIss) == int(comintIss) or all([cmloopit == 4, findcomiciss is None, pc_in is None]) or all([cmloopit == 4, findcomiciss is None, pc_in == 1]):
nowrite = False