1
0
Fork 0
mirror of https://github.com/evilhero/mylar synced 2024-12-27 18:16:52 +00:00

hopefully fix for status' not changing properly after Refresh as well as continually downloading same issues marked as downloaded

This commit is contained in:
evilhero 2012-10-21 11:30:26 -04:00
parent 85667e2590
commit 86c46134bd
3 changed files with 38 additions and 14 deletions

View file

@ -282,10 +282,10 @@ def addComictoDB(comicid,mismatch=None):
#---END.NEW. #---END.NEW.
# check if the issue already exists # check if the issue already exists
iss_exists = myDB.select('SELECT * from issues WHERE IssueID=?', [issid]) iss_exists = myDB.action('SELECT * from issues WHERE IssueID=?', [issid]).fetchone()
# Only change the status & add DateAdded if the issue is not already in the database # Only change the status & add DateAdded if the issue is already in the database
if not len(iss_exists): if iss_exists is None:
newValueDict['DateAdded'] = helpers.today() newValueDict['DateAdded'] = helpers.today()
controlValueDict = {"IssueID": issid} controlValueDict = {"IssueID": issid}
@ -303,6 +303,10 @@ def addComictoDB(comicid,mismatch=None):
else: else:
newValueDict['Status'] = "Skipped" newValueDict['Status'] = "Skipped"
if iss_exists:
#print ("Existing status : " + str(iss_exists['Status']))
newValueDict['Status'] = iss_exists['Status']
myDB.upsert("issues", newValueDict, controlValueDict) myDB.upsert("issues", newValueDict, controlValueDict)
n+=1 n+=1
@ -567,6 +571,11 @@ def GCDimport(gcomicid):
else: else:
newValueDict['Status'] = "Skipped" newValueDict['Status'] = "Skipped"
if iss_exists:
#print ("Existing status : " + str(iss_exists['Status']))
newValueDict['Status'] = iss_exists['Status']
myDB.upsert("issues", newValueDict, controlValueDict) myDB.upsert("issues", newValueDict, controlValueDict)
bb+=1 bb+=1

View file

@ -49,23 +49,33 @@ def latest_update(ComicID, LatestIssue, LatestDate):
def upcoming_update(ComicID, ComicName, IssueNumber, IssueDate): def upcoming_update(ComicID, ComicName, IssueNumber, IssueDate):
# here we add to upcoming table... # here we add to upcoming table...
myDB = db.DBConnection() myDB = db.DBConnection()
controlValue = {"ComicID": ComicID} controlValue = {"ComicID": ComicID}
newValue = {"ComicName": str(ComicName), newValue = {"ComicName": str(ComicName),
"IssueNumber": str(IssueNumber), "IssueNumber": str(IssueNumber),
"IssueDate": str(IssueDate)} "IssueDate": str(IssueDate)}
issuechk = myDB.action("SELECT * FROM issues WHERE ComicID=? AND Issue_Number=?", [ComicID, IssueNumber]).fetchone()
if issuechk is None: pass
else:
#print ("checking..." + str(issuechk['ComicName']) + " Issue: " + str(issuechk['Issue_Number']))
#print ("existing status: " + str(issuechk['Status']))
control = {"IssueID": issuechk['IssueID']}
if mylar.AUTOWANT_UPCOMING: if mylar.AUTOWANT_UPCOMING:
newValue['Status'] = "Wanted" newValue['Status'] = "Wanted"
values = { "Status": "Wanted"}
if issuechk['Status'] == "Snatched":
values = { "Status": "Snatched"}
newValue['Status'] = "Snatched"
elif issuechk['Status'] == "Downloaded":
values = { "Status": "Downloaded"}
newValue['Status'] = "Downloaded"
else: else:
values = { "Status": "Skipped"}
newValue['Status'] = "Skipped" newValue['Status'] = "Skipped"
myDB.upsert("upcoming", newValue, controlValue) myDB.upsert("upcoming", newValue, controlValue)
issuechk = myDB.action("SELECT * FROM issues WHERE ComicID=? AND Issue_Number=?", [ComicID, IssueNumber]).fetchone()
if issuechk is None:
pass
#print ("not released yet...")
else:
control = {"IssueID": issuechk['IssueID']}
if mylar.AUTOWANT_UPCOMING: values = {"Status": "Wanted"}
else: values = {"Status": "Skipped"}
myDB.upsert("issues", values, control) myDB.upsert("issues", values, control)
@ -199,6 +209,8 @@ def forceRescan(ComicID):
else: else:
if old_status == "Wanted": if old_status == "Wanted":
issStatus = "Wanted" issStatus = "Wanted"
elif old_status == "Downloaded":
issStatus = "Downloaded"
else: else:
issStatus = "Skipped" issStatus = "Skipped"
elif haveissue == "yes": elif haveissue == "yes":

View file

@ -348,9 +348,12 @@ class WebInterface(object):
mvcontroldict = {"IssueID": myissue['IssueID']} mvcontroldict = {"IssueID": myissue['IssueID']}
mvvalues = {"ComicID": myissue['ComicID'], mvvalues = {"ComicID": myissue['ComicID'],
"Status": "Wanted"} "Status": "Wanted"}
myDB.upsert("issues", mvvalues, mvcontroldict) myDB.upsert("issues", mvvalues, mvcontroldict)
#remove old entry from upcoming so it won't try to continually download again.
deleteit = myDB.action("DELETE from upcoming WHERE ComicName=? AND IssueNumber=?", [mvup['ComicName'],mvup['IssueNumber']])
return serve_template(templatename="upcoming.html", title="Upcoming", upcoming=upcoming, issues=issues) return serve_template(templatename="upcoming.html", title="Upcoming", upcoming=upcoming, issues=issues)
upcoming.exposed = True upcoming.exposed = True