1
0
Fork 0
mirror of https://github.com/evilhero/mylar synced 2025-02-03 21:11:33 +00:00

FIX: When doing Check Files, if filename contained '.' as a space character it wouldn't count it

This commit is contained in:
evilhero 2013-03-01 20:46:49 -05:00
parent 1c1e4cb96e
commit 0af49f977b

View file

@ -263,16 +263,16 @@ def forceRescan(ComicID,archive=None):
# temploc = tmpfc['ComicFilename'].replace('_', ' ') # temploc = tmpfc['ComicFilename'].replace('_', ' ')
temploc = re.sub('[\#\']', '', temploc) temploc = re.sub('[\#\']', '', temploc)
#logger.fdebug("temploc: " + str(temploc)) logger.fdebug("temploc: " + str(temploc))
if 'annual' not in temploc: if 'annual' not in temploc:
#remove the extension here #remove the extension here
extensions = ('.cbr','.cbz') extensions = ('.cbr','.cbz')
if temploc.lower().endswith(extensions): if temploc.lower().endswith(extensions):
#print ("removed extension for issue:" + str(temploc)) #logger.fdebug("removed extension for issue:" + str(temploc))
temploc = temploc[:-4] temploc = temploc[:-4]
deccnt = str(temploc).count('.') deccnt = str(temploc).count('.')
if deccnt > 1: if deccnt > 1:
#print ("decimal counts are :" + str(deccnt)) #logger.fdebug("decimal counts are :" + str(deccnt))
#if the file is formatted with '.' in place of spaces we need to adjust. #if the file is formatted with '.' in place of spaces we need to adjust.
#before replacing - check to see if digits on either side of decimal and if yes, DON'T REMOVE #before replacing - check to see if digits on either side of decimal and if yes, DON'T REMOVE
occur=1 occur=1
@ -286,28 +286,28 @@ def forceRescan(ComicID,archive=None):
while start >=0 and n > 1: while start >=0 and n > 1:
start = temploc.find('.', start+len('.')) start = temploc.find('.', start+len('.'))
n-=1 n-=1
#print "occurance " + str(occur) + " of . at position: " + str(start) #logger.fdebug("occurance " + str(occur) + " of . at position: " + str(start))
if temploc[prevstart:start].isdigit(): if temploc[prevstart:start].isdigit():
if digitfound == "yes": if digitfound == "yes":
#print ("this is a decimal, assuming decimal issue.") #logger.fdebug("this is a decimal, assuming decimal issue.")
decimalfound = "yes" decimalfound = "yes"
reconst = "." + temploc[prevstart:start] + " " reconst = "." + temploc[prevstart:start] + " "
else: else:
#print ("digit detected.") #logger.fdebug("digit detected.")
digitfound = "yes" digitfound = "yes"
reconst = temploc[prevstart:start] reconst = temploc[prevstart:start]
else: else:
reconst = temploc[prevstart:start] + " " reconst = temploc[prevstart:start] + " "
#print "word: " + reconst #logger.fdebug("word: " + reconst)
tempreconstruct = tempreconstruct + reconst tempreconstruct = tempreconstruct + reconst
#print ("tempreconstruct is : " + tempreconstruct) #logger.fdebug("tempreconstruct is : " + tempreconstruct)
prevstart = (start+1) prevstart = (start+1)
occur+=1 occur+=1
#print "word: " + temploc[prevstart:] #logger.fdebug("word: " + temploc[prevstart:])
tempreconstruct = tempreconstruct + temploc[prevstart:] tempreconstruct = tempreconstruct + " " + temploc[prevstart:]
#print ("final filename to use is : " + str(tempreconstruct)) #logger.fdebug("final filename to use is : " + str(tempreconstruct))
temploc = tempreconstruct temploc = tempreconstruct
#print("checking " + str(temploc)) #logger.fdebug("checking " + str(temploc))
fcnew = shlex.split(str(temploc)) fcnew = shlex.split(str(temploc))
fcn = len(fcnew) fcn = len(fcnew)
n = 0 n = 0