Fix for index out of range on cvinfo files

If the cvinfo had information in an unsupported format, like just 4050-xxxxx then the regular expression sub would cause an end of index exception.

Now the regex just looks for 4050-xxxxx, and doesn't really care about the format.

https://github.com/evilhero/mylar/issues/1923
This commit is contained in:
Craig Hornsby 2018-04-18 08:41:42 -04:00 committed by evilhero
parent 6a2b12313e
commit 343c5a45b9
1 changed files with 5 additions and 3 deletions

View File

@ -252,9 +252,11 @@ def libraryScan(dir=None, append=False, ComicID=None, ComicName=None, cron=None,
urllink = f.readline()
if urllink:
cid = urllink.split('/')
if '4050-' in cid[-2]:
cvinfo_CID = re.sub('4050-', '', cid[-2]).strip()
cid = urllink.strip()
pattern = re.compile(r"^.*?\b(49|4050)-(?P<num>\d{2,})\b.*$", re.I)
match = pattern.match(cid)
if match:
cvinfo_CID = match.group("num")
logger.info('CVINFO file located within directory. Attaching everything in directory that is valid to ComicID: ' + str(cvinfo_CID))
#store the location of the cvinfo so it's applied to the correct directory (since we're scanning multile direcorties usually)
cvscanned_loc = os.path.dirname(comlocation)