FIX:(#725) When using Experimental Search, if issue number is not seperate from title will create an int error, IMP: Abit more error logging in regards to ComicVine API usage

This commit is contained in:
evilhero 2014-06-09 14:34:53 -04:00
parent 89f2d3a5f6
commit 922d340576
4 changed files with 31 additions and 3 deletions

View File

@ -2,7 +2,11 @@ Mylar is an automated Comic Book (cbr/cbz) downloader program heavily-based on t
Yes, it does work, yes there are still bugs, and for that reson I still consider it the definition of an 'Alpha Release'.
This application requires a version of the 2.7.x Python branch for the best results. 3.x is not supported.
This application requires a version of the 2.7.x Python branch for the best results (3.x is not supported)
** NEW **
You will need to get your OWN ComicVine API Key for this application to fully work.
Failure to do that will result in limited (to None) ability to add/update/refresh series as well as other important functunality.
To start it, type in 'python Mylar.py' from within the root of the mylar directory. Adding a --help option to the command will give a list of available options.

View File

@ -131,8 +131,12 @@ def GetComicInfo(comicid,dom):
cntit = int(cntit)
#retrieve the first xml tag (<tag>data</tag>)
#that the parser finds with name tagName:
comic['ComicName'] = dom.getElementsByTagName('name')[trackcnt+1].firstChild.wholeText
comic['ComicName'] = comic['ComicName'].rstrip()
try:
comic['ComicName'] = dom.getElementsByTagName('name')[trackcnt+1].firstChild.wholeText
comic['ComicName'] = comic['ComicName'].rstrip()
except:
logger.error('There was a problem retrieving the given data from ComicVine. Ensure that www.comicvine.com is accessible AND that you have provided your OWN ComicVine API key.')
return
try:
comic['ComicYear'] = dom.getElementsByTagName('start_year')[0].firstChild.wholeText
except:

View File

@ -717,6 +717,14 @@ def issuedigits(issnum):
if str(issnum).isdigit():
int_issnum = int( issnum ) * 1000
else:
count = 0
for char in issnum:
if char.isalpha():
count += 1
if count > 5:
logger.error('This is not an issue number - not enough numerics to parse')
int_issnum = 999999999999999
return int_issnum
if 'au' in issnum.lower() and issnum[:1].isdigit():
int_issnum = (int(issnum[:-2]) * 1000) + ord('a') + ord('u')
elif 'ai' in issnum.lower() and issnum[:1].isdigit():

View File

@ -482,11 +482,17 @@ def addComictoDB(comicid,mismatch=None,pullupd=None,imported=None,ogcname=None,c
if CV_NoYearGiven == 'no':
#if set to 'no' then we haven't pulled down the issues, otherwise we did it already
issued = cv.getComic(comicid,'issue')
if issued is None:
logger.warn('Unable to retrieve data from ComicVine. Get your own API key already!')
return
logger.info('Sucessfully retrieved issue details for ' + comic['ComicName'] )
#move to own function so can call independently to only refresh issue data
#issued is from cv.getComic, comic['ComicName'] & comicid would both be already known to do independent call.
issuedata = updateissuedata(comicid, comic['ComicName'], issued, comicIssues, calledfrom, SeriesYear=SeriesYear)
if issuedata is None:
logger.warn('Unable to complete Refreshing / Adding issue data - this WILL create future problems if not addressed.')
return
if mylar.CVINFO or (mylar.CV_ONLY and mylar.CVINFO):
if not os.path.exists(os.path.join(comlocation,"cvinfo")) or mylar.CV_ONETIMER:
@ -1039,6 +1045,9 @@ def updateissuedata(comicid, comicname=None, issued=None, comicIssues=None, call
#chkType comes from the weeklypulllist - either 'annual' or not to distinguish annuals vs. issues
if comicIssues is None:
comic = cv.getComic(comicid,'comic')
if comic is None:
logger.warn('Error retrieving from ComicVine - either the site is down or you are not using your own CV API key')
return
if comicIssues is None:
comicIssues = comic['ComicIssues']
if SeriesYear is None:
@ -1047,6 +1056,9 @@ def updateissuedata(comicid, comicname=None, issued=None, comicIssues=None, call
comicname = comic['ComicName']
if issued is None:
issued = cv.getComic(comicid,'issue')
if issued is None:
logger.warn('Error retrieving from ComicVine - either the site is down or you are not using your own CV API key')
return
n = 0
iscnt = int(comicIssues)
issid = []