1
0
Fork 0
mirror of https://github.com/evilhero/mylar synced 2025-03-12 23:13:09 +00:00

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

View file

@ -252,9 +252,11 @@ def libraryScan(dir=None, append=False, ComicID=None, ComicName=None, cron=None,
urllink = f.readline() urllink = f.readline()
if urllink: if urllink:
cid = urllink.split('/') cid = urllink.strip()
if '4050-' in cid[-2]: pattern = re.compile(r"^.*?\b(49|4050)-(?P<num>\d{2,})\b.*$", re.I)
cvinfo_CID = re.sub('4050-', '', cid[-2]).strip() 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)) 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) #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) cvscanned_loc = os.path.dirname(comlocation)