Fix: decimal issues causing a whole whack of problems (filechecking, post-proc, searching), Imp: filechecker will now detect duplicate issues and ignore for overall count

This commit is contained in:
evilhero 2013-01-03 05:01:07 -05:00
parent 0035046379
commit 1d4da9281a
3 changed files with 47 additions and 10 deletions

View File

@ -129,8 +129,26 @@ class PostProcessor(object):
comicid = issuenzb['ComicID']
#log2screen = log2screen + "ComicID: " + comicid + "\n"
issuenum = issuenzb['Issue_Number']
issueno = str(issuenum).split('.')[0]
self._log("Issue Number: " + str(issueno), logger.DEBUG)
#issueno = str(issuenum).split('.')[0]
iss_find = issuenum.find('.')
iss_b4dec = issuenum[:iss_find]
iss_decval = issuenum[iss_find+1:]
if int(iss_decval) == 0:
iss = iss_b4dec
issdec = int(iss_decval)
issueno = str(iss)
self._log("Issue Number: " + str(issueno), logger.DEBUG)
else:
if len(iss_decval) == 1:
iss = iss_b4dec + "." + iss_decval
issdec = int(iss_decval) * 10
else:
iss = iss_b4dec + "." + iss_decval.rstrip('0')
issdec = int(iss_decval.rstrip('0')) * 10
issueno = iss_b4dec
self._log("Issue Number: " + str(iss), logger.DEBUG)
# issue zero-suppression here
if mylar.ZERO_LEVEL == "0":
zeroadd = ""
@ -139,11 +157,14 @@ class PostProcessor(object):
elif mylar.ZERO_LEVEL_N == "0x": zeroadd = "0"
elif mylar.ZERO_LEVEL_N == "00x": zeroadd = "00"
if str(len(issueno)) > 1:
if int(issueno) < 10:
self._log("issue detected less than 10", logger.DEBUG)
prettycomiss = str(zeroadd) + str(int(issueno))
if int(iss_decval) > 0:
issueno = str(iss)
prettycomiss = str(zeroadd) + str(iss)
else:
prettycomiss = str(zeroadd) + str(int(issueno))
self._log("Zero level supplement set to " + str(mylar.ZERO_LEVEL_N) + ". Issue will be set as : " + str(prettycomiss), logger.DEBUG)
elif int(issueno) >= 10 and int(issueno) < 100:
self._log("issue detected greater than 10, but less than 100", logger.DEBUG)
@ -151,10 +172,16 @@ class PostProcessor(object):
zeroadd = ""
else:
zeroadd = "0"
prettycomiss = str(zeroadd) + str(int(issueno))
if int(iss_decval) > 0:
issueno = str(iss)
prettycomiss = str(zeroadd) + str(iss)
else:
prettycomiss = str(zeroadd) + str(int(issueno))
self._log("Zero level supplement set to " + str(mylar.ZERO_LEVEL_N) + ".Issue will be set as : " + str(prettycomiss), logger.DEBUG)
else:
self._log("issue detected greater than 100", logger.DEBUG)
if int(iss_decval) > 0:
issueno = str(iss)
prettycomiss = str(issueno)
self._log("Zero level supplement set to " + str(mylar.ZERO_LEVEL_N) + ". Issue will be set as : " + str(prettycomiss), logger.DEBUG)
else:

View File

@ -425,11 +425,11 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
logger.fdebug("length match..proceeding")
n = 0
scount = 0
logger.fdebug("search-length: " + str(len(splitit)))
logger.fdebug("search-length: " + str(splitst))
logger.fdebug("Watchlist-length: " + str(len(watchcomic_split)))
while ( n <= len(splitit)-1 ):
while ( n <= (splitst)-1 ):
logger.fdebug("splitit: " + str(splitit[n]))
if n < len(splitit)-1 and n < len(watchcomic_split):
if n < (splitst) and n < len(watchcomic_split):
logger.fdebug(str(n) + " Comparing: " + str(watchcomic_split[n]) + " .to. " + str(splitit[n]))
if str(watchcomic_split[n].lower()) in str(splitit[n].lower()):
logger.fdebug("word matched on : " + str(splitit[n]))
@ -464,7 +464,7 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
#splitit has to splitit-1 because last position is issue.
wordcnt = int(scount)
logger.fdebug("scount:" + str(wordcnt))
totalcnt = int(len(splitit)-1)
totalcnt = int(splitst)
logger.fdebug("splitit-len:" + str(totalcnt))
spercent = (wordcnt/totalcnt) * 100
logger.fdebug("we got " + str(spercent) + " percent.")

View File

@ -193,6 +193,7 @@ def forceRescan(ComicID):
issnum = 1
fcnew = []
fn = 0
issuedupechk = []
reissues = myDB.action('SELECT * FROM issues WHERE ComicID=?', [ComicID]).fetchall()
# if filechecker returns 0 files (it doesn't find any), but some issues have a status of 'Archived'
# the loop below won't work...let's adjust :)
@ -202,6 +203,7 @@ def forceRescan(ComicID):
print "have count adjusted to:" + str(len(arcissues))
while (fn < fccnt):
haveissue = "no"
issuedupe = "no"
try:
tmpfc = fc['comiclist'][fn]
except IndexError:
@ -289,6 +291,11 @@ def forceRescan(ComicID):
if int(fcdigit) == int_iss:
#if issyear in fcnew[som+1]:
# print "matched on year:" + str(issyear)
#issuedupechk here.
if int(fcdigit) in issuedupechk:
logger.fdebug("duplicate issue detected - not counting this: " + str(tmpfc['ComicFilename']))
issuedupe = "yes"
break
logger.fdebug("matched...issue: " + str(rescan['ComicName']) + " --- " + str(int_iss))
havefiles+=1
haveissue = "yes"
@ -296,6 +303,9 @@ def forceRescan(ComicID):
issSize = str(tmpfc['ComicSize'])
logger.fdebug(".......filename: " + str(isslocation))
logger.fdebug(".......filesize: " + str(tmpfc['ComicSize']))
# to avoid duplicate issues which screws up the count...let's store the filename issues then
# compare earlier...
issuedupechk.append(int(fcdigit))
break
#else:
# if the issue # matches, but there is no year present - still match.
@ -307,7 +317,7 @@ def forceRescan(ComicID):
#we have the # of comics, now let's update the db.
#even if we couldn't find the physical issue, check the status.
#if Archived, increase the 'Have' count.
if haveissue == "no":
if haveissue == "no" and issuedupe == "no":
isslocation = "None"
if old_status == "Skipped":
if mylar.AUTOWANT_ALL: