mirror of https://github.com/evilhero/mylar
FIX:(#312) Transition from Downloaded to Archive doesn't update count (long-time outstanding bug + more verbosity now), FIX:(#316) Negative issue numbers accounted for and working, FIX:(#323) Sending to SABnzbd using nzbx.co wasn't working
This commit is contained in:
parent
30a385227d
commit
59072add8a
|
@ -88,7 +88,6 @@ def getComic(comicid,type,issueid=None):
|
|||
issue['issuechoice'] = ndic
|
||||
issue['firstdate'] = firstdate
|
||||
|
||||
print ("issuechoice completed: " + str(issue))
|
||||
return issue
|
||||
|
||||
elif type == 'comic':
|
||||
|
|
|
@ -490,8 +490,16 @@ def addComictoDB(comicid,mismatch=None,pullupd=None,imported=None,ogcname=None):
|
|||
updater.no_searchresults(comicid)
|
||||
return
|
||||
else:
|
||||
logger.error(str(issnum) + "this has an alpha-numeric in the issue # which I cannot account for.")
|
||||
return
|
||||
try:
|
||||
x = float(issnum)
|
||||
#validity check
|
||||
if x < 0:
|
||||
logger.info("I've encountered a negative issue #: " + str(issnum) + ". Trying to accomodate.")
|
||||
int_issnum = str(issnum)
|
||||
else: raise ValueError
|
||||
except ValueError, e:
|
||||
logger.error(str(issnum) + "this has an alpha-numeric in the issue # which I cannot account for.")
|
||||
return
|
||||
#get the latest issue / date using the date.
|
||||
if firstval['Issue_Date'] > latestdate:
|
||||
latestiss = str(issnum)
|
||||
|
|
|
@ -640,7 +640,7 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
|
|||
logger.fdebug("watch comicversion is " + str(ComicVersion))
|
||||
fndcomicversion = str(splitit[n])
|
||||
logger.fdebug("version found: " + str(fndcomicversion))
|
||||
if ComicVersion is not "None":
|
||||
if ComicVersion != "None" and ComicVersion is not None:
|
||||
F_ComicVersion = re.sub("[^0-9]", "", fndcomicversion)
|
||||
D_ComicVersion = re.sub("[^0-9]", "", ComicVersion)
|
||||
if int(F_ComicVersion) == int(D_ComicVersion):
|
||||
|
@ -779,9 +779,8 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
|
|||
except OSError.e:
|
||||
if e.errno != errno.EEXIST:
|
||||
raise
|
||||
|
||||
logger.fdebug("link to retrieve via api:" + str(helpers.apiremove(linkapi,'$')))
|
||||
|
||||
|
||||
#let's change all space to decimals for simplicity
|
||||
nzbname = re.sub(" ", ".", str(entry['title']))
|
||||
#gotta replace & or escape it
|
||||
|
@ -798,8 +797,8 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
|
|||
|
||||
#we need to change the nzbx string now to allow for the nzbname rename.
|
||||
if nzbprov == 'nzbx':
|
||||
nzbxlink_st = linkapi.find("*|*")
|
||||
linkapi = linkapi[:(nzbxlink_st + 3)] + str(nzbname)
|
||||
nzbxlink_st = linkapi.find("::::")
|
||||
linkapi = linkapi[:(nzbxlink_st + 4)] + str(nzbname)
|
||||
logger.fdebug("new linkapi (this should =nzbname) :" + str(linkapi))
|
||||
|
||||
# #test nzb.get
|
||||
|
|
|
@ -280,12 +280,6 @@ def forceRescan(ComicID,archive=None):
|
|||
issuedupechk = []
|
||||
issueexceptdupechk = []
|
||||
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 :)
|
||||
arcissues = myDB.select("SELECT * FROM issues WHERE ComicID=? and Status='Archived'", [ComicID])
|
||||
if len(arcissues) > 0:
|
||||
havefiles = len(arcissues)
|
||||
logger.fdebug("Adjusting have total because of this many archive files:" + str(len(arcissues)))
|
||||
while (fn < fccnt):
|
||||
haveissue = "no"
|
||||
issuedupe = "no"
|
||||
|
@ -530,21 +524,27 @@ def forceRescan(ComicID,archive=None):
|
|||
myDB.upsert("issues", newValueDict, controlValueDict)
|
||||
fn+=1
|
||||
|
||||
#let's update the total count of comics that was found.
|
||||
controlValueStat = {"ComicID": rescan['ComicID']}
|
||||
newValueStat = {"Have": havefiles
|
||||
}
|
||||
|
||||
myDB.upsert("comics", newValueStat, controlValueStat)
|
||||
logger.info(u"I've found " + str(havefiles) + " / " + str(rescan['Total']) + " issues." )
|
||||
logger.info("Total files located: " + str(havefiles))
|
||||
foundcount = havefiles
|
||||
arcfiles = 0
|
||||
# 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 :)
|
||||
arcissues = myDB.action("SELECT count(*) FROM issues WHERE ComicID=? and Status='Archived'", [ComicID]).fetchall()
|
||||
if int(arcissues[0][0]) > 0:
|
||||
arcfiles = arcissues[0][0]
|
||||
havefiles = havefiles + arcfiles
|
||||
logger.fdebug("Adjusting have total to " + str(havefiles) + " because of this many archive files:" + str(arcfiles))
|
||||
|
||||
|
||||
#now that we are finished...
|
||||
#adjust for issues that have been marked as Downloaded, but aren't found/don't exist.
|
||||
#do it here, because above loop only cycles though found comics using filechecker.
|
||||
downissues = myDB.action("SELECT * FROM issues WHERE ComicID=? and Status='Downloaded'", [ComicID]).fetchall()
|
||||
downissues = myDB.select("SELECT * FROM issues WHERE ComicID=? and Status='Downloaded'", [ComicID])
|
||||
if downissues is None:
|
||||
pass
|
||||
else:
|
||||
archivedissues = 0 #set this to 0 so it tallies correctly.
|
||||
for down in downissues:
|
||||
#print "downlocation:" + str(down['Location'])
|
||||
#remove special characters from
|
||||
|
@ -557,6 +557,7 @@ def forceRescan(ComicID,archive=None):
|
|||
controlValue = {"IssueID": down['IssueID']}
|
||||
newValue = {"Status": "Archived"}
|
||||
myDB.upsert("issues", newValue, controlValue)
|
||||
archivedissues+=1
|
||||
pass
|
||||
else:
|
||||
comicpath = os.path.join(rescan['ComicLocation'], down['Location'])
|
||||
|
@ -567,6 +568,19 @@ def forceRescan(ComicID,archive=None):
|
|||
#print "Changing status from Downloaded to Archived - cannot locate file"
|
||||
controlValue = {"IssueID": down['IssueID']}
|
||||
newValue = {"Status": "Archived"}
|
||||
myDB.upsert("issues", newValue, controlValue)
|
||||
myDB.upsert("issues", newValue, controlValue)
|
||||
archivedissues+=1
|
||||
totalarc = arcfiles + archivedissues
|
||||
havefiles = havefiles + totalarc
|
||||
logger.fdebug("I've changed the status of " + str(archivedissues) + " issues to a status of Archived, as I now cannot locate them in the series directory.")
|
||||
|
||||
|
||||
#let's update the total count of comics that was found.
|
||||
controlValueStat = {"ComicID": rescan['ComicID']}
|
||||
newValueStat = {"Have": havefiles
|
||||
}
|
||||
|
||||
myDB.upsert("comics", newValueStat, controlValueStat)
|
||||
logger.info(u"I've physically found " + str(foundcount) + " issues, and accounted for " + str(totalarc) + " in an Archived state. Total Issue Count: " + str(havefiles) + " / " + str(rescan['Total']))
|
||||
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue