mirror of
https://github.com/evilhero/mylar
synced 2024-12-24 00:32:47 +00:00
FIX:(#310) Issue 1 not being pulled in when using CV-ONLY option, IMP: Added some basic informational logging for CV conversion
This commit is contained in:
parent
acc60d9ff7
commit
2c2405224a
3 changed files with 20 additions and 9 deletions
14
mylar/cv.py
14
mylar/cv.py
|
@ -23,7 +23,7 @@ import lib.feedparser
|
|||
import mylar
|
||||
from bs4 import BeautifulSoup as Soup
|
||||
|
||||
def pulldetails(comicid,type,issueid=None,offset=1):
|
||||
def pulldetails(comicid,type,issueid=None,offset=0):
|
||||
import urllib2
|
||||
|
||||
#import easy to use xml parser called minidom:
|
||||
|
@ -58,11 +58,11 @@ def pulldetails(comicid,type,issueid=None,offset=1):
|
|||
|
||||
def getComic(comicid,type,issueid=None):
|
||||
if type == 'issue':
|
||||
offset = 1
|
||||
offset = 0
|
||||
issue = {}
|
||||
comicResults = []
|
||||
#let's find out how many results we get from the query...
|
||||
searched = pulldetails(comicid,'issue',None,1)
|
||||
searched = pulldetails(comicid,'issue',None,0)
|
||||
if searched is None: return False
|
||||
totalResults = searched.getElementsByTagName('number_of_total_results')[0].firstChild.wholeText
|
||||
logger.fdebug("there are " + str(totalResults) + " search results...")
|
||||
|
@ -82,10 +82,10 @@ def getComic(comicid,type,issueid=None):
|
|||
return issue
|
||||
|
||||
elif type == 'comic':
|
||||
dom = pulldetails(comicid,'comic',None,1)
|
||||
dom = pulldetails(comicid,'comic',None,0)
|
||||
return GetComicInfo(comicid,dom)
|
||||
elif type == 'firstissue':
|
||||
dom = pulldetails(comicid,'firstissue',issueid,1)
|
||||
dom = pulldetails(comicid,'firstissue',issueid,0)
|
||||
return GetFirstIssue(issueid,dom)
|
||||
|
||||
def GetComicInfo(comicid,dom):
|
||||
|
@ -187,7 +187,7 @@ def GetIssuesInfo(comicid,dom,issue):
|
|||
cntiss = int(cntiss)
|
||||
n = cntiss-1
|
||||
else:
|
||||
n = int(len(subtracks))-1
|
||||
n = int(len(subtracks))
|
||||
# issue = {}
|
||||
issuechoice = []
|
||||
firstdate = '2099-00-00'
|
||||
|
@ -226,7 +226,7 @@ def GetIssuesInfo(comicid,dom,issue):
|
|||
if issue['CoverDate'] < firstdate and issue['CoverDate'] != '0000-00-00':
|
||||
firstdate = issue['CoverDate']
|
||||
n-=1
|
||||
print issuechoice
|
||||
|
||||
issue['issuechoice'] = issuechoice
|
||||
issue['firstdate'] = firstdate
|
||||
return issue
|
||||
|
|
|
@ -48,13 +48,19 @@ def dbUpdate():
|
|||
mylar.importer.addComictoDB(comicid,mismatch)
|
||||
else:
|
||||
if mylar.CV_ONETIMER == 1:
|
||||
logger.fdebug("CV_OneTimer option enabled...")
|
||||
|
||||
#in order to update to JUST CV_ONLY, we need to delete the issues for a given series so it's a clean refresh.
|
||||
logger.fdebug("Gathering the status of all issues for the series.")
|
||||
issues = myDB.select('SELECT * FROM issues WHERE ComicID=?', [comicid])
|
||||
#store the issues' status for a given comicid, after deleting and readding, flip the status back to what it is currently.
|
||||
logger.fdebug("Deleting all issue data.")
|
||||
myDB.select('DELETE FROM issues WHERE ComicID=?', [comicid])
|
||||
logger.fdebug("Refreshing the series and pulling in new data using only CV.")
|
||||
mylar.importer.addComictoDB(comicid,mismatch)
|
||||
issues_new = myDB.select('SELECT * FROM issues WHERE ComicID=?', [comicid])
|
||||
icount = 0
|
||||
logger.fdebug("Attempting to put the Status' back how they were.")
|
||||
for issue in issues:
|
||||
for issuenew in issues_new:
|
||||
if issuenew['IssueID'] == issue['IssueID'] and issuenew['Status'] != issue['Status']:
|
||||
|
@ -64,7 +70,7 @@ def dbUpdate():
|
|||
myDB.upsert("Issues", newVAL, ctrlVAL)
|
||||
icount+=1
|
||||
break
|
||||
logger.info("changed the status of " + str(icount) + " issues.")
|
||||
logger.info("In converting data to CV only, I changed the status of " + str(icount) + " issues.")
|
||||
mylar.CV_ONETIMER = 0
|
||||
else:
|
||||
mylar.importer.addComictoDB(comicid,mismatch)
|
||||
|
|
|
@ -385,12 +385,17 @@ class WebInterface(object):
|
|||
else: threading.Thread(target=importer.addComictoDB, args=[ComicID,mismatch]).start()
|
||||
else:
|
||||
if mylar.CV_ONETIMER == 1:
|
||||
logger.fdebug("CV_OneTimer option enabled...")
|
||||
#in order to update to JUST CV_ONLY, we need to delete the issues for a given series so it's a clea$
|
||||
logger.fdebug("Gathering the status of all issues for the series.")
|
||||
issues = myDB.select('SELECT * FROM issues WHERE ComicID=?', [ComicID])
|
||||
#store the issues' status for a given comicid, after deleting and readding, flip the status back to$
|
||||
logger.fdebug("Deleting all issue data.")
|
||||
myDB.select('DELETE FROM issues WHERE ComicID=?', [ComicID])
|
||||
logger.fdebug("Refreshing the series and pulling in new data using only CV.")
|
||||
mylar.importer.addComictoDB(ComicID,mismatch)
|
||||
issues_new = myDB.select('SELECT * FROM issues WHERE ComicID=?', [ComicID])
|
||||
logger.fdebug("Attempting to put the Status' back how they were.")
|
||||
icount = 0
|
||||
for issue in issues:
|
||||
for issuenew in issues_new:
|
||||
|
@ -401,7 +406,7 @@ class WebInterface(object):
|
|||
myDB.upsert("Issues", newVAL, ctrlVAL)
|
||||
icount+=1
|
||||
break
|
||||
logger.info("changed the status of " + str(icount) + " issues.")
|
||||
logger.info("In the process of converting the data to CV, I changed the status of " + str(icount) + " issues.")
|
||||
else:
|
||||
mylar.importer.addComictoDB(ComicID,mismatch)
|
||||
|
||||
|
|
Loading…
Reference in a new issue