From dd96a80a1872d7a4c0724b8817203ffb60fd10ca Mon Sep 17 00:00:00 2001 From: evilhero Date: Wed, 17 Oct 2012 11:56:09 -0400 Subject: [PATCH] Fixed some problems loading exceptions, included some details in csv file now --- exceptions.csv | 19 +++++++++++++++++++ mylar/__init__.py | 14 ++++++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/exceptions.csv b/exceptions.csv index a6683af6..cbb62d78 100644 --- a/exceptions.csv +++ b/exceptions.csv @@ -1,6 +1,25 @@ +#Mylar Exception listings +# In an effort to map ComicVine to GCD correctly, use this. +#---- +#Required Format : code, ComicVineID, GCDComicID, GCDComicIDs (for volume spanning series) +#----Format Breakdown +#code = # of volumes in series to be checked minus 1 (if there are 4 volumes in a series, put 3) + = 99 is mismatched names. If a series won't match on GCD, this is what you would put. +#ComicVineID = the ComicVineID (taken from the searchresults, or the ..Loading.. detail screen) +#GCDComicID = the correct GCD Comic ID that Mylar is to match with. +#GCDComicIDs = put the GCD Comic ID's here for the given multiple volume spanning series seperated by a '/' +#use 'none' if you are not using an option (yes, it's necessary) +#-------- +#-------- +#-----Volume Spanning Series----- +#Fantastic Four 4,2045,none,1482/10251/6029/11218/62349 +#Amazing Spider-man 2,2127,none,1570/7794/11288 +#The Boys 1,18033,none,19531/25058 +#-------- +#-----Mismatched Names------ 99,3092,2605,none 99,50389,66832,none 99,42947,61242,none diff --git a/mylar/__init__.py b/mylar/__init__.py index bf2e4de7..cdaef28b 100755 --- a/mylar/__init__.py +++ b/mylar/__init__.py @@ -522,13 +522,23 @@ def dbcheck(): #new logger.info(u"Populating Exception listings into Mylar....") + c.execute('DROP TABLE IF EXISTS exceptions') + c.execute('CREATE TABLE IF NOT EXISTS exceptions (variloop TEXT, ComicID TEXT, NewComicID TEXT, GComicID TEXT)') - csvfile = open('exceptions.csv', "rb") + EXCEPTIONS_FILE = os.path.join(DATA_DIR, 'exceptions.csv') + + if not os.path.exists(EXCEPTIONS_FILE): + try: + csvfile = open(str(EXCEPTIONS_FILE), "rb") + except OSError: + logger.error('Could not locate exceptions.csv file. Check in datadir: ' + DATA_DIR) + else: + csvfile = open(str(EXCEPTIONS_FILE), "rb") + creader = csv.reader(csvfile, delimiter=',') for row in creader: - #print (row) try: c.execute("INSERT INTO exceptions VALUES (?,?,?,?);", row) except Exception, e: