mirror of
https://github.com/evilhero/mylar
synced 2024-12-25 17:16:51 +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:
parent
2b98184718
commit
ec1941a78b
1 changed files with 68 additions and 44 deletions
|
@ -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:
|
||||||
subname = re.sub('(.*)[\s+|_+](19\d{2}|20\d{2})(.*)', '\\1 \\2 (\\3)', subthis)
|
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)
|
||||||
|
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,53 +756,56 @@ 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"
|
||||||
|
|
||||||
for jdc in list(justthedigits):
|
|
||||||
#logger.fdebug('[FILECHECKER] ('jdc:' + str(jdc))
|
|
||||||
if not jdc.isdigit():
|
|
||||||
#logger.fdebug('[FILECHECKER] ('alpha')
|
|
||||||
jdc_start = justthedigits.find(jdc)
|
|
||||||
alpha_isschk = justthedigits[jdc_start:]
|
|
||||||
#logger.fdebug('[FILECHECKER] ('alpha_isschk:' + str(alpha_isschk))
|
|
||||||
for issexcept in issue_exceptions:
|
|
||||||
if issexcept.lower() in alpha_isschk.lower() and len(alpha_isschk) <= len(issexcept):
|
|
||||||
logger.fdebug('[FILECHECKER] ALPHANUMERIC EXCEPTION : [' + justthedigits + ']')
|
|
||||||
digitsvalid = "true"
|
|
||||||
break
|
|
||||||
if digitsvalid == "true": break
|
|
||||||
|
|
||||||
try:
|
if not justthedigits.isdigit():
|
||||||
tmpthedigits = justthedigits_1.split(' ', 1)[1]
|
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.')
|
||||||
logger.fdebug('[FILECHECKER] If the series has a decimal, this should be a number [' + tmpthedigits + ']')
|
justthedigits = justthedigits_1.split(' ', 1)[1]
|
||||||
if 'cbr' in tmpthedigits.lower() or 'cbz' in tmpthedigits.lower():
|
if justthedigits.isdigit():
|
||||||
tmpthedigits = tmpthedigits[:-3].strip()
|
|
||||||
logger.fdebug('[FILECHECKER] Removed extension - now we should just have a number [' + tmpthedigits + ']')
|
|
||||||
poss_alpha = tmpthedigits
|
|
||||||
if poss_alpha.isdigit():
|
|
||||||
digitsvalid = "true"
|
digitsvalid = "true"
|
||||||
if (justthedigits.lower() == 'annual' and 'annual' not in watchcomic.lower()) or (annual_comicid is not None):
|
|
||||||
logger.fdebug('[FILECHECKER] ANNUAL DETECTED [' + poss_alpha + ']')
|
if not digitsvalid:
|
||||||
justthedigits += ' ' + poss_alpha
|
for jdc in list(justthedigits):
|
||||||
|
if not jdc.isdigit():
|
||||||
|
jdc_start = justthedigits.find(jdc)
|
||||||
|
alpha_isschk = justthedigits[jdc_start:]
|
||||||
|
for issexcept in issue_exceptions:
|
||||||
|
if issexcept.lower() in alpha_isschk.lower() and len(alpha_isschk) <= len(issexcept):
|
||||||
|
logger.fdebug('[FILECHECKER] ALPHANUMERIC EXCEPTION : [' + justthedigits + ']')
|
||||||
|
digitsvalid = "true"
|
||||||
|
break
|
||||||
|
if digitsvalid == "true": break
|
||||||
|
|
||||||
|
try:
|
||||||
|
tmpthedigits = justthedigits_1.split(' ', 1)[1]
|
||||||
|
logger.fdebug('[FILECHECKER] If the series has a decimal, this should be a number [' + tmpthedigits + ']')
|
||||||
|
if 'cbr' in tmpthedigits.lower() or 'cbz' in tmpthedigits.lower():
|
||||||
|
tmpthedigits = tmpthedigits[:-3].strip()
|
||||||
|
logger.fdebug('[FILECHECKER] Removed extension - now we should just have a number [' + tmpthedigits + ']')
|
||||||
|
poss_alpha = tmpthedigits
|
||||||
|
if poss_alpha.isdigit():
|
||||||
|
digitsvalid = "true"
|
||||||
|
if (justthedigits.lower() == 'annual' and 'annual' not in watchcomic.lower()) or (annual_comicid is not None):
|
||||||
|
logger.fdebug('[FILECHECKER] ANNUAL DETECTED [' + poss_alpha + ']')
|
||||||
|
justthedigits += ' ' + poss_alpha
|
||||||
|
else:
|
||||||
|
justthedigits += '.' + poss_alpha
|
||||||
|
logger.fdebug('[FILECHECKER] DECIMAL ISSUE DETECTED [' + justthedigits + ']')
|
||||||
else:
|
else:
|
||||||
justthedigits += '.' + poss_alpha
|
for issexcept in issue_exceptions:
|
||||||
logger.fdebug('[FILECHECKER] DECIMAL ISSUE DETECTED [' + justthedigits + ']')
|
decimalexcept = False
|
||||||
else:
|
if '.' in issexcept:
|
||||||
for issexcept in issue_exceptions:
|
decimalexcept = True
|
||||||
decimalexcept = False
|
issexcept = issexcept[1:] #remove the '.' from comparison...
|
||||||
if '.' in issexcept:
|
if issexcept.lower() in poss_alpha.lower() and len(poss_alpha) <= len(issexcept):
|
||||||
decimalexcept = True
|
if decimalexcept:
|
||||||
issexcept = issexcept[1:] #remove the '.' from comparison...
|
issexcept = '.' + issexcept
|
||||||
if issexcept.lower() in poss_alpha.lower() and len(poss_alpha) <= len(issexcept):
|
justthedigits += issexcept #poss_alpha
|
||||||
if decimalexcept:
|
logger.fdebug('[FILECHECKER] ALPHANUMERIC EXCEPTION. COMBINING : [' + justthedigits + ']')
|
||||||
issexcept = '.' + issexcept
|
digitsvalid = "true"
|
||||||
justthedigits += issexcept #poss_alpha
|
break
|
||||||
logger.fdebug('[FILECHECKER] ALPHANUMERIC EXCEPTION. COMBINING : [' + justthedigits + ']')
|
except:
|
||||||
digitsvalid = "true"
|
tmpthedigits = None
|
||||||
break
|
|
||||||
except:
|
|
||||||
tmpthedigits = None
|
|
||||||
|
|
||||||
# justthedigits = justthedigits.split(' ', 1)[0]
|
# justthedigits = justthedigits.split(' ', 1)[0]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue