1
0
Fork 0
mirror of https://github.com/evilhero/mylar synced 2024-12-22 07:42:24 +00:00

Added custom exceptions file to allow for user-based exceptions, as well as being able to maintain a base file in exceptions.csv

This commit is contained in:
evilhero 2012-10-20 03:51:17 -04:00
parent 150dcd775b
commit c9acfb465f
3 changed files with 61 additions and 28 deletions

View file

@ -0,0 +1,21 @@
# Mylar Custom Exception listings
# In an effort to map ComicVine to GCD correctly, use this.
#
#
# Make changes/additions, and rename this file to 'custom_exceptions.csv'.
#
#
# 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-----
#-----Mismatched Names------
#test
99,1111,22222,none
1 # Mylar Custom Exception listings
2 # In an effort to map ComicVine to GCD correctly, use this.
3 #
4 #
5 # Make changes/additions, and rename this file to 'custom_exceptions.csv'.
6 #
7 #
8 # Required Format, : code, ComicVineID, GCDComicID, GCDComicIDs (for volume spanning series)
9 # ----Format Breakdown
10 # code = # of volumes in series to be checked minus 1 (if there are 4 volumes in a series, put 3)
11 # = 99 is mismatched names. If a series won't match on GCD, this is what you would put.
12 # ComicVineID = the ComicVineID (taken from the searchresults, or the ..Loading.. detail screen)
13 # GCDComicID = the correct GCD Comic ID that Mylar is to match with.
14 # GCDComicIDs = put the GCD Comic ID's here for the given multiple volume spanning series seperated by a '/'
15 # use 'none' if you are not using an option (yes, it's necessary)
16 #
17 #-----Volume Spanning Series-----
18 #-----Mismatched Names------
19 #test
20 99,1111,22222,none

View file

@ -1,16 +1,12 @@
# Mylar Exception listings # Mylar Exception listings
# In an effort to map ComicVine to GCD correctly, use this. # In an effort to map ComicVine to GCD correctly, this file will be imported into Mylar.
#---- #----
#Required Format : code, ComicVineID, GCDComicID, GCDComicIDs (for volume spanning series) #
#----Format Breakdown ######### DO NOT USE THIS FILE TO ADD YOUR OWN EXCEPTIONS! ###########
#code = # of volumes in series to be checked minus 1 (if there are 4 volumes in a series, put 3) # USE custom_exceptions.csv FOR USER-ADDED EXCEPTIONS. #
= 99 is mismatched names. If a series won't match on GCD, this is what you would put. # NOT DOING THIS WILL RESULT IN LOSING YOUR USER-ADDED EXCEPTIONS. #
#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----- #-----Volume Spanning Series-----
#Fantastic Four #Fantastic Four
4,2045,none,1482/10251/6029/11218/62349 4,2045,none,1482/10251/6029/11218/62349

1 #Mylar Exception listings # Mylar Exception listings
2 # In an effort to map ComicVine to GCD correctly, use this. # In an effort to map ComicVine to GCD correctly, this file will be imported into Mylar.
3 #---- #----
4 #Required Format : code, ComicVineID, GCDComicID, GCDComicIDs (for volume spanning series) #
5 #----Format Breakdown ######### DO NOT USE THIS FILE TO ADD YOUR OWN EXCEPTIONS! ###########
6 #code = # of volumes in series to be checked minus 1 (if there are 4 volumes in a series, put 3) # USE custom_exceptions.csv FOR USER-ADDED EXCEPTIONS. #
7 = 99 is mismatched names. If a series won't match on GCD, this is what you would put. # NOT DOING THIS WILL RESULT IN LOSING YOUR USER-ADDED EXCEPTIONS. #
8 #ComicVineID = the ComicVineID (taken from the searchresults, or the ..Loading.. detail screen) ######################################################################
9 #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)
#--------
#--------
10 #-----Volume Spanning Series----- #-----Volume Spanning Series-----
11 #Fantastic Four #Fantastic Four
12 4,2045,none,1482/10251/6029/11218/62349 4,2045,none,1482/10251/6029/11218/62349

View file

@ -521,20 +521,35 @@ def dbcheck():
# c.execute('CREATE TABLE IF NOT EXISTS weekly (SHIPDATE, PUBLISHER text, ISSUE text, COMIC VARCHAR(150), EXTRA text, STATUS text)') # c.execute('CREATE TABLE IF NOT EXISTS weekly (SHIPDATE, PUBLISHER text, ISSUE text, COMIC VARCHAR(150), EXTRA text, STATUS text)')
#new #new
logger.info(u"Populating Exception listings into Mylar....")
c.execute('DROP TABLE IF EXISTS exceptions') c.execute('DROP TABLE IF EXISTS exceptions')
c.execute('CREATE TABLE IF NOT EXISTS exceptions (variloop TEXT, ComicID TEXT, NewComicID TEXT, GComicID TEXT)') c.execute('CREATE TABLE IF NOT EXISTS exceptions (variloop TEXT, ComicID TEXT, NewComicID TEXT, GComicID TEXT)')
EXCEPTIONS_FILE = os.path.join(DATA_DIR, 'exceptions.csv') # for Mylar-based Exception Updates....
i = 0
EXCEPTIONS = []
EXCEPTIONS.append('exceptions.csv')
EXCEPTIONS.append('custom_exceptions.csv')
while (i <= 1):
#EXCEPTIONS_FILE = os.path.join(DATA_DIR, 'exceptions.csv')
EXCEPTIONS_FILE = os.path.join(DATA_DIR, EXCEPTIONS[i])
if not os.path.exists(EXCEPTIONS_FILE): if not os.path.exists(EXCEPTIONS_FILE):
try: try:
csvfile = open(str(EXCEPTIONS_FILE), "rb") csvfile = open(str(EXCEPTIONS_FILE), "rb")
except OSError: except (OSError,IOError):
logger.error('Could not locate exceptions.csv file. Check in datadir: ' + DATA_DIR) if i == 1:
logger.error("No Custom Exceptions found. Using base exceptions only.")
else:
logger.error("Could not locate " + str(EXCEPTIONS[i]) + " file. Make sure it's in datadir: " + DATA_DIR)
break
else: else:
csvfile = open(str(EXCEPTIONS_FILE), "rb") csvfile = open(str(EXCEPTIONS_FILE), "rb")
if i == 0:
logger.info(u"Populating Base Exception listings into Mylar....")
elif i == 1:
logger.info(u"Populating Custom Exception listings into Mylar....")
creader = csv.reader(csvfile, delimiter=',') creader = csv.reader(csvfile, delimiter=',')
@ -545,6 +560,7 @@ def dbcheck():
#print ("Error - invald arguments...-skipping") #print ("Error - invald arguments...-skipping")
pass pass
csvfile.close() csvfile.close()
i+=1
#c.executemany("INSERT INTO exceptions VALUES (?, ?);", to_db) #c.executemany("INSERT INTO exceptions VALUES (?, ?);", to_db)