FIX: If Invalid entry in Upcoming, would error out (thnx breaker), IMP: Removed unecessary print and logging statements

This commit is contained in:
evilhero 2014-03-04 00:11:52 -05:00
parent 08f8b4e265
commit 050cafa4d8
4 changed files with 45 additions and 40 deletions

View File

@ -1351,6 +1351,7 @@ def dbcheck():
#let's delete errant comics that are stranded (ie. Comicname = Comic ID: )
c.execute("DELETE from COMICS WHERE ComicName='None' OR ComicName LIKE 'Comic ID%' OR ComicName is NULL")
c.execute("DELETE from ISSUES WHERE ComicName='None' OR ComicName LIKE 'Comic ID%' OR ComicName is NULL")
c.execute("DELETE from UPCOMING WHERE ComicName='None' OR ComicName is NULL or IssueNumber is NULL")
logger.info('Ensuring DB integrity - Removing all Erroneous Comics (ie. named None)')
logger.info('Correcting Null entries that make the main page break on startup.')

View File

@ -897,7 +897,7 @@ def LoadAlternateSearchNames(seriesname_alt, comicid):
Alternate_Names = {}
alt_count = 0
logger.fdebug('seriesname_alt:' + str(seriesname_alt))
#logger.fdebug('seriesname_alt:' + str(seriesname_alt))
if seriesname_alt is None or seriesname_alt == 'None':
logger.fdebug('no Alternate name given. Aborting search.')
return "no results"
@ -918,6 +918,6 @@ def LoadAlternateSearchNames(seriesname_alt, comicid):
Alternate_Names['AlternateName'] = AS_Alt
Alternate_Names['ComicID'] = comicid
Alternate_Names['Count'] = alt_count
logger.info('AlternateNames returned:' + str(Alternate_Names))
#logger.info('AlternateNames returned:' + str(Alternate_Names))
return Alternate_Names

View File

@ -964,45 +964,49 @@ class WebInterface(object):
def upcoming(self):
myDB = db.DBConnection()
#upcoming = myDB.select("SELECT * from issues WHERE ReleaseDate > date('now') order by ReleaseDate DESC")
upcomingdata = myDB.select("SELECT * from upcoming WHERE IssueID is NULL order by IssueDate DESC")
upcoming = []
for upc in upcomingdata:
if len(upc['IssueDate']) <= 7 :
#if it's less than or equal 7, then it's a future-pull so let's check the date and display
#tmpdate = datetime.datetime.com
tmpdatethis = upc['IssueDate']
if tmpdatethis[:2] == '20':
tmpdate = tmpdatethis #in correct format of yyyymm
upcomingdata = myDB.select("SELECT * from upcoming WHERE IssueID is NULL AND IssueNumber is not NULL AND ComicName is not NULL order by IssueDate DESC")
if upcomingdata is None:
logger.info('No upcoming data as of yet...')
else:
upcoming = []
for upc in upcomingdata:
if len(upc['IssueDate']) <= 7 :
#if it's less than or equal 7, then it's a future-pull so let's check the date and display
#tmpdate = datetime.datetime.com
tmpdatethis = upc['IssueDate']
if tmpdatethis[:2] == '20':
tmpdate = tmpdatethis #in correct format of yyyymm
else:
findst = tmpdatethis.find('-') #find the '-'
tmpdate = tmpdatethis[findst+1:] + tmpdatethis[:findst] #rebuild in format of yyyymm
timenow = datetime.datetime.now().strftime('%Y%m')
#logger.fdebug('comparing pubdate of: ' + str(tmpdate) + ' to now date of: ' + str(timenow))
if int(tmpdate) >= int(timenow):
if upc['Status'] == 'Wanted':
upcoming.append({"ComicName": upc['ComicName'],
"IssueNumber": upc['IssueNumber'],
"IssueDate": upc['IssueDate'],
"ComicID": upc['ComicID'],
"IssueID": upc['IssueID'],
"Status": upc['Status'],
"DisplayComicName": upc['DisplayComicName']})
else:
findst = tmpdatethis.find('-') #find the '-'
tmpdate = tmpdatethis[findst+1:] + tmpdatethis[:findst] #rebuild in format of yyyymm
timenow = datetime.datetime.now().strftime('%Y%m')
#logger.fdebug('comparing pubdate of: ' + str(tmpdate) + ' to now date of: ' + str(timenow))
if int(tmpdate) >= int(timenow):
if upc['Status'] == 'Wanted':
upcoming.append({"ComicName": upc['ComicName'],
"IssueNumber": upc['IssueNumber'],
"IssueDate": upc['IssueDate'],
"ComicID": upc['ComicID'],
"IssueID": upc['IssueID'],
"Status": upc['Status'],
"DisplayComicName": upc['DisplayComicName']})
else:
#if it's greater than 7 it's a full date, and shouldn't be displayed ;)
timenow = datetime.datetime.now().strftime('%Y%m%d') #convert to yyyymmdd
tmpdate = re.sub("[^0-9]", "", upc['IssueDate']) #convert date to numerics only (should be in yyyymmdd)
#if it's greater than 7 it's a full date, and shouldn't be displayed ;)
timenow = datetime.datetime.now().strftime('%Y%m%d') #convert to yyyymmdd
tmpdate = re.sub("[^0-9]", "", upc['IssueDate']) #convert date to numerics only (should be in yyyymmdd)
#logger.fdebug('comparing pubdate of: ' + str(tmpdate) + ' to now date of: ' + str(timenow))
#logger.fdebug('comparing pubdate of: ' + str(tmpdate) + ' to now date of: ' + str(timenow))
if int(tmpdate) >= int(timenow):
if upc['Status'] == 'Wanted':
upcoming.append({"ComicName": upc['ComicName'],
"IssueNumber": upc['IssueNumber'],
"IssueDate": upc['IssueDate'],
"ComicID": upc['ComicID'],
"IssueID": upc['IssueID'],
"Status": upc['Status'],
"DisplayComicName": upc['DisplayComicName']})
if int(tmpdate) >= int(timenow):
if upc['Status'] == 'Wanted':
upcoming.append({"ComicName": upc['ComicName'],
"IssueNumber": upc['IssueNumber'],
"IssueDate": upc['IssueDate'],
"ComicID": upc['ComicID'],
"IssueID": upc['IssueID'],
"Status": upc['Status'],
"DisplayComicName": upc['DisplayComicName']})
issues = myDB.select("SELECT * from issues WHERE Status='Wanted'")
ann_list = []

View File

@ -495,7 +495,7 @@ def pullitcheck(comic1off_name=None,comic1off_id=None,forcecheck=None, futurepul
pubdate.append(watchd[4])
lines.append(a_list[w+wc].strip())
unlines.append(a_list[w+wc].strip())
logger.info('loading in Alternate name for ' + str(cleanedname))
logger.fdebug('loading in Alternate name for ' + str(cleanedname))
n+=1
wc+=1
w+=wc
@ -534,7 +534,7 @@ def pullitcheck(comic1off_name=None,comic1off_id=None,forcecheck=None, futurepul
if '+' in sqlsearch: sqlsearch = re.sub('\+', '%PLUS%', sqlsearch)
sqlsearch = re.sub(r'\s', '%', sqlsearch)
sqlsearch = sqlsearch + '%'
logger.fdebug("searchsql: " + sqlsearch)
#logger.fdebug("searchsql: " + sqlsearch)
if futurepull is None:
weekly = myDB.select('SELECT PUBLISHER, ISSUE, COMIC, EXTRA, SHIPDATE FROM weekly WHERE COMIC LIKE (?)', [sqlsearch])
else: