From b760c913f74c62093ef9b6ec8297c06d69effc09 Mon Sep 17 00:00:00 2001 From: evilhero Date: Tue, 25 Nov 2014 11:59:56 -0500 Subject: [PATCH] FIX:(#891) If series on watchlist was on pull-list listed as a comp (ie.l-4), would assume it was a valid issue and error out, FIX: Fixed an invalid cache location reference point --- mylar/newpull.py | 2 +- mylar/weeklypull.py | 31 ++++++++++++++++++++++++++----- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/mylar/newpull.py b/mylar/newpull.py index 59636694..0e614e1e 100755 --- a/mylar/newpull.py +++ b/mylar/newpull.py @@ -86,7 +86,7 @@ def newpull(): x+=1 logger.fdebug('Saving new pull-list information into local file for subsequent merge') - except_file = '/home/hero/mylar/cache/newreleases.txt' + except_file = os.path.join(mylar.CACHE_DIR, 'newreleases.txt') try: csvfile = open(str(except_file), 'rb') csvfile.close() diff --git a/mylar/weeklypull.py b/mylar/weeklypull.py index 10924348..acaae745 100755 --- a/mylar/weeklypull.py +++ b/mylar/weeklypull.py @@ -119,6 +119,10 @@ def pullit(forcecheck=None): 'ONE SHOT', 'PI'] + #denotes issues that contain special characters within that would normally fail when checked if issue ONLY contained numerics. + #add freely, just lowercase and exclude decimals (they get stripped during comparisons) + specialissues = {'au','ai','inh','now'} + pub = "COMICS" prevcomic = "" previssue = "" @@ -129,7 +133,7 @@ def pullit(forcecheck=None): logger.info('[PULL-LIST] Populating & Loading pull-list data directly from webpage') newpull.newpull() else: - logger.info('[PULL-LIST] Populating & Loading pull-list data from file : ' + newrl) + logger.info('[PULL-LIST] Populating & Loading pull-list data from file') f = urllib.urlretrieve(PULLURL, newrl) #newtxtfile header info ("SHIPDATE\tPUBLISHER\tISSUE\tCOMIC\tEXTRA\tSTATUS\n") @@ -232,7 +236,20 @@ def pullit(forcecheck=None): if issname[n] == "PI": issue = "NA" break - issue = issname[n] + + #this is to ensure we don't get any comps added by removing them entirely (ie. #1-4, etc) + x = None + try: + x = float( re.sub('#','', issname[n].strip()) ) + except ValueError, e: + if any(d in re.sub(r'[^a-zA-Z0-9]','',issname[n]).strip() for d in specialissues): + issue = issname[n] + else: + logger.fdebug('Comp issue set detected as : ' + str(issname[n]) + '. Ignoring.') + issue = 'NA' + else: + issue = issname[n] + if 'ongoing' not in issname[n-1].lower() and '(vu)' not in issname[n-1].lower(): #print ("issue found : " + issname[n]) comicend = n - 1 @@ -585,7 +602,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: @@ -874,8 +891,12 @@ def checkthis(datecheck,datestatus,usedate): logger.fdebug('Store Date falls within acceptable range - series MATCH') valid_check = True elif int(datecheck) < int(usedate): - logger.fdebug('The issue date of issue was on ' + str(datecheck) + ' which is prior to ' + str(usedate)) - valid_check = False + if datecheck == '00000000': + logger.fdebug('Issue date retrieved as : ' + str(datecheck) + '. This is unpopulated data on CV, which normally means it\'s a new issue and is awaiting data population.') + valid_check = True + else: + logger.fdebug('The issue date of issue was on ' + str(datecheck) + ' which is prior to ' + str(usedate)) + valid_check = False return valid_check