1
0
Fork 0
mirror of https://github.com/evilhero/mylar synced 2025-02-03 04:51:48 +00:00

Fix for comiclocation error on adding new series (directory creation). Also fixed for ',' in directory creation.

This commit is contained in:
evilhero 2012-10-31 12:03:15 -04:00
parent f2022def21
commit 18f719fb6d
2 changed files with 21 additions and 16 deletions

View file

@ -115,12 +115,14 @@ def addComictoDB(comicid,mismatch=None):
# setup default location here # setup default location here
if comlocation is None: if comlocation is None:
if ':' in comic['ComicName'] or '/' in comic['ComicName']: if ':' in comic['ComicName'] or '/' in comic['ComicName'] or ',' in comic['ComicName']:
comicdir = comic['ComicName'] comicdir = comic['ComicName']
if ':' in comicdir: if ':' in comicdir:
comicdir = comicdir.replace(':','') comicdir = comicdir.replace(':','')
if '/' in comicdir: if '/' in comicdir:
comicdir = comicdir.replace('/','-') comicdir = comicdir.replace('/','-')
if ',' in comicdir:
comicdir = comicdir.replace(',','')
else: comicdir = comic['ComicName'] else: comicdir = comic['ComicName']
series = comicdir series = comicdir
@ -445,13 +447,14 @@ def GCDimport(gcomicid):
#comic book location on machine #comic book location on machine
# setup default location here # setup default location here
if comlocation is None: if comlocation is None:
if ':' in ComicName or '/' in ComicName: if ':' in ComicName or '/' in ComicName or ',' in ComicName:
comicdir = ComicName comicdir = ComicName
if ':' in comicdir: if ':' in comicdir:
comicdir = comicdir.replace(':','') comicdir = comicdir.replace(':','')
if '/' in comicdir: if '/' in comicdir:
comicdir = comicdir.replace('/','-') comicdir = comicdir.replace('/','-')
if ',' in comicdir:
comicdir = comicdir.replace(',','')
else: comicdir = ComicName else: comicdir = ComicName
comlocation = mylar.DESTINATION_DIR + "/" + comicdir + " (" + ComicYear + ")" comlocation = mylar.DESTINATION_DIR + "/" + comicdir + " (" + ComicYear + ")"
if mylar.DESTINATION_DIR == "": if mylar.DESTINATION_DIR == "":
@ -568,11 +571,11 @@ def GCDimport(gcomicid):
#---END.NEW. #---END.NEW.
# check if the issue already exists # check if the issue already exists
iss_exists = myDB.select('SELECT * from issues WHERE IssueID=?', [issid]) iss_exists = myDB.action('SELECT * from issues WHERE IssueID=?', [issid]).fetchone()
# Only change the status & add DateAdded if the issue is not already in the database # Only change the status & add DateAdded if the issue is not already in the database
if not len(iss_exists): if iss_exists is None:
newValueDict['DateAdded'] = helpers.today() newValueDict['DateAdded'] = helpers.today()
#adjust for inconsistencies in GCD date format - some dates have ? which borks up things. #adjust for inconsistencies in GCD date format - some dates have ? which borks up things.

View file

@ -62,19 +62,21 @@ class WebInterface(object):
myDB = db.DBConnection() myDB = db.DBConnection()
comic = myDB.action('SELECT * FROM comics WHERE ComicID=?', [ComicID]).fetchone() comic = myDB.action('SELECT * FROM comics WHERE ComicID=?', [ComicID]).fetchone()
issues = myDB.select('SELECT * from issues WHERE ComicID=? order by Int_IssueNumber DESC', [ComicID]) issues = myDB.select('SELECT * from issues WHERE ComicID=? order by Int_IssueNumber DESC', [ComicID])
# make sure comic dir exists..
comlocation = comic['ComicLocation']
if os.path.isdir(str(comlocation)): pass
#logger.info(u"Directory (" + str(comlocation) + ") already exists! Continuing...")
else:
print ("Directory doesn't exist!")
try:
os.makedirs(str(comlocation))
logger.info(u"No directory found - So I created one at: " + str(comlocation))
except OSError:
logger.error(u"Could not create directory for comic : " + str(comlocation))
if comic is None: if comic is None:
raise cherrypy.HTTPRedirect("home") raise cherrypy.HTTPRedirect("home")
else:
# make sure comic dir exists..
comlocation = comic['ComicLocation']
if os.path.isdir(str(comlocation)): pass
#logger.info(u"Directory (" + str(comlocation) + ") already exists! Continuing...")
else:
print ("Directory doesn't exist!")
try:
os.makedirs(str(comlocation))
logger.info(u"No directory found - So I created one at: " + str(comlocation))
except OSError:
logger.error(u"Could not create directory for comic : " + str(comlocation))
comicConfig = { comicConfig = {
"comiclocation" : mylar.COMIC_LOCATION "comiclocation" : mylar.COMIC_LOCATION
} }