Fix: allow for ',:' in search, directory creation, and post-processing IMP: Altering default comic directory

This commit is contained in:
evilhero 2012-12-20 06:52:21 -05:00
parent 7b6389b4a4
commit 282726fd6c
3 changed files with 15 additions and 0 deletions

View File

@ -16,6 +16,7 @@
import os
import shutil
import re
import time
@ -130,6 +131,8 @@ def PostProcess(nzb_name, nzb_folder):
#mylar.REPLACE_CHAR ...determines what to replace spaces with underscore or dot
nfilename = nfilename.replace(' ', mylar.REPLACE_CHAR)
#TODO - sort issue numbering 12.00 should be 12
#replace funky characters so it doesn't break things
nfilename = re.sub('[\,\:]', '', nfilename)
log2screen = log2screen + "New Filename: " + nfilename + "\n"
src = nzb_folder + "/" + ofilename

View File

@ -441,6 +441,7 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
#filenzb = os.path.join(tmppath,filenamenzb)
logger.fdebug("unalterted nzb name: " + str(filenamenzb))
#let's send a clean copy to SAB because the names are random characters and/or could be stupid.
ComicName = re.sub('[\:\,]', '', ComicName)
filenzb = str(ComicName.replace(' ', '_')) + "_" + str(IssueNumber) + "_(" + str(comyear) + ")"
logger.fdebug("prettified nzb name: " + str(filenzb))

View File

@ -531,6 +531,17 @@ class WebInterface(object):
#"QUALtype": qual_type,
#"QUALquality": qual_quality
#}
#force the check/creation of directory com_location here
if os.path.isdir(str(com_location)):
logger.info(u"Validating Directory (" + str(com_location) + "). Already exists! Continuing...")
else:
logger.fdebug("Updated Directory doesn't exist! - attempting to create now.")
try:
os.makedirs(str(com_location))
logger.info(u"Directory successfully created at: " + str(com_location))
except OSError:
logger.error(u"Could not create comicdir : " + str(com_location))
myDB.upsert("comics", newValues, controlValueDict)
raise cherrypy.HTTPRedirect("artistPage?ComicID=%s" % ComicID)
comic_config.exposed = True