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

FIX: Fix for file-checker not being able to scan filenames that had a numeric in the series title, and no year (issue / volume) was present

This commit is contained in:
evilhero 2015-04-27 21:59:10 -04:00
parent 2b98184718
commit ec1941a78b

View file

@ -227,6 +227,7 @@ def listFiles(dir,watchcomic,Publisher,AlternateSearch=None,manual=None,sarc=Non
if watchname.lower() not in subthis.lower(): if watchname.lower() not in subthis.lower():
logger.fdebug('[FILECHECKER] ' + watchname + ' this is a false match to ' + subthis + ' - Ignoring this result.') logger.fdebug('[FILECHECKER] ' + watchname + ' this is a false match to ' + subthis + ' - Ignoring this result.')
continue continue
ogsubthis = subthis
subthis = subthis[len(watchname):] #remove watchcomic subthis = subthis[len(watchname):] #remove watchcomic
#we need to now check the remainder of the string for digits assuming it's a possible year #we need to now check the remainder of the string for digits assuming it's a possible year
logger.fdebug('[FILECHECKER] new subname: ' + subthis) logger.fdebug('[FILECHECKER] new subname: ' + subthis)
@ -243,7 +244,27 @@ def listFiles(dir,watchcomic,Publisher,AlternateSearch=None,manual=None,sarc=Non
logger.fdebug('[FILECHECKER] new subname reversed: ' + subname) logger.fdebug('[FILECHECKER] new subname reversed: ' + subname)
break break
else: else:
year = None
for i in subthis.split():
if ('20' in i or '19' in i):
if i.isdigit():
year = i[:4]
else:
findyr20 = i.find('20')
if findyr20:
styear = i[findyr20:4].strip()
findyr19 = i.find('19')
if findyr19:
styear = i[findyr19:4].strip()
if styear.isdigit() and len(styear) == 4:
year = styear
logger.fdebug('[FILECHECKER] stf is : ' + str(styear))
if year:
subname = re.sub('(.*)[\s+|_+](19\d{2}|20\d{2})(.*)', '\\1 \\2 (\\3)', subthis) subname = re.sub('(.*)[\s+|_+](19\d{2}|20\d{2})(.*)', '\\1 \\2 (\\3)', subthis)
else:
#unable to find year in filename
logger.fdebug('[FILECHECKER] Unable to detect year within filename. Continuing as is and assuming this is a volume 1 and will work itself out later.')
subname = ogsubthis
subnm = re.findall('[^()]+', subname) subnm = re.findall('[^()]+', subname)
else: else:
@ -735,16 +756,19 @@ def listFiles(dir,watchcomic,Publisher,AlternateSearch=None,manual=None,sarc=Non
# logger.fdebug('[FILECHECKER] ("removed title from name - is now : " + str(justthedigits)) # logger.fdebug('[FILECHECKER] ("removed title from name - is now : " + str(justthedigits))
justthedigits = justthedigits_1.split(' ', 1)[0] justthedigits = justthedigits_1.split(' ', 1)[0]
digitsvalid = "false" digitsvalid = "false"
if not justthedigits.isdigit():
logger.fdebug('[FILECHECKER] Invalid character found in filename after item removal - cannot find issue # with this present. Temporarily removing it from the comparison to be able to proceed.')
justthedigits = justthedigits_1.split(' ', 1)[1]
if justthedigits.isdigit():
digitsvalid = "true"
if not digitsvalid:
for jdc in list(justthedigits): for jdc in list(justthedigits):
#logger.fdebug('[FILECHECKER] ('jdc:' + str(jdc))
if not jdc.isdigit(): if not jdc.isdigit():
#logger.fdebug('[FILECHECKER] ('alpha')
jdc_start = justthedigits.find(jdc) jdc_start = justthedigits.find(jdc)
alpha_isschk = justthedigits[jdc_start:] alpha_isschk = justthedigits[jdc_start:]
#logger.fdebug('[FILECHECKER] ('alpha_isschk:' + str(alpha_isschk))
for issexcept in issue_exceptions: for issexcept in issue_exceptions:
if issexcept.lower() in alpha_isschk.lower() and len(alpha_isschk) <= len(issexcept): if issexcept.lower() in alpha_isschk.lower() and len(alpha_isschk) <= len(issexcept):
logger.fdebug('[FILECHECKER] ALPHANUMERIC EXCEPTION : [' + justthedigits + ']') logger.fdebug('[FILECHECKER] ALPHANUMERIC EXCEPTION : [' + justthedigits + ']')