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:
parent
150dcd775b
commit
c9acfb465f
3 changed files with 61 additions and 28 deletions
21
custom_exceptions_sample.csv
Normal file
21
custom_exceptions_sample.csv
Normal 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,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
|
||||||
|
|
|
|
@ -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)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue