This commit is contained in:
Maxim Berezin 2018-08-08 17:06:36 +00:00 committed by GitHub
commit 446b2c5742
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View File

@ -557,6 +557,7 @@ def rename_param(comicid, comicname, issue, ofilename, comicyear=None, issueid=N
#if comversion is None, remove it so it doesn't populate with 'None'
if comversion == 'None':
chunk_f_f = re.sub('\$VolumeN', '', mylar.CONFIG.FILE_FORMAT)
chunk_f_f = chunk_f_f.strip().strip('\\').strip('/')
chunk_f = re.compile(r'\s+')
chunk_file_format = chunk_f.sub(' ', chunk_f_f)
logger.fdebug('No version # found for series, removing from filename')
@ -566,6 +567,7 @@ def rename_param(comicid, comicname, issue, ofilename, comicyear=None, issueid=N
if annualize is None:
chunk_f_f = re.sub('\$Annual', '', chunk_file_format)
chunk_f_f = chunk_f_f.strip().strip('\\').strip('/')
chunk_f = re.compile(r'\s+')
chunk_file_format = chunk_f.sub(' ', chunk_f_f)
logger.fdebug('not an annual - removing from filename paramaters')

View File

@ -40,6 +40,13 @@ def movefiles(comicid, comlocation, imported):
logger.fdebug("Renaming files not enabled, keeping original filename(s)")
dstimp = os.path.join(comlocation, orig_filename)
if not os.path.exists(os.path.dirname(dstimp)):
logger.fdebug(os.path.dirname(dstimp) + ' does not exist - attempting to create...')
try:
os.makedirs(os.path.dirname(dstimp), int(mylar.CONFIG.CHMOD_DIR))
except (OSError, IOError):
logger.fdebug('Failed to create full directory path, but will try to move file anyway.')
logger.info("moving " + srcimp + " ... to " + dstimp)
try:
shutil.move(srcimp, dstimp)