mirror of https://github.com/evilhero/mylar
FIX: When manual processing with folders, would delete the main folder provided to in the GUI. Now will check if files exist within directory, and that it's not identical as the provided folder and remove if both are not True, FIX: Removed some str statements that were hanging up due to unicode.
This commit is contained in:
parent
957baad665
commit
5696ab905c
|
@ -728,12 +728,13 @@ class PostProcessor(object):
|
|||
|
||||
#if it's a Manual Run, use the ml['ComicLocation'] for the exact filename.
|
||||
if ml is None:
|
||||
|
||||
for root, dirnames, filenames in os.walk(self.nzb_folder):
|
||||
for filename in filenames:
|
||||
if filename.lower().endswith(extensions):
|
||||
odir = root
|
||||
logger.fdebug(module + ' odir (root): ' + odir)
|
||||
ofilename = filename
|
||||
logger.fdebug(module + ' ofilename: ' + ofilename)
|
||||
path, ext = os.path.splitext(ofilename)
|
||||
|
||||
if odir is None:
|
||||
|
@ -852,7 +853,7 @@ class PostProcessor(object):
|
|||
|
||||
#tidyup old path
|
||||
try:
|
||||
if os.path.isdir(odir): #and odir != self.nzb_folder:
|
||||
if os.path.isdir(odir) and odir != self.nzb_folder:
|
||||
# check to see if the directory is empty or not.
|
||||
if not os.listdir(odir):
|
||||
logger.fdebug(module + ' Tidying up. Deleting folder : ' + odir)
|
||||
|
|
|
@ -185,7 +185,7 @@ def run (dirName, nzbName=None, issueid=None, manual=None, filename=None, module
|
|||
|
||||
if removetemp == True:
|
||||
if comicpath != downloadpath:
|
||||
shutil.rmtree( comicpath )
|
||||
#shutil.rmtree( comicpath )
|
||||
logger.fdebug(module + ' Successfully removed temporary directory: ' + comicpath)
|
||||
else:
|
||||
loggger.fdebug(module + ' Unable to remove temporary directory since it is identical to the download location : ' + comicpath)
|
||||
|
@ -254,7 +254,11 @@ def run (dirName, nzbName=None, issueid=None, manual=None, filename=None, module
|
|||
# #remove the IssueID from the path
|
||||
# file_dir = re.sub(issueid, '', comicpath)
|
||||
# file_n = os.path.split(nfilename)[1]
|
||||
file_dir = re.sub(issueid, '', comicpath)
|
||||
if manual is None:
|
||||
file_dir = downloadpath
|
||||
else:
|
||||
file_dir = re.sub(issueid, '', comicpath)
|
||||
|
||||
file_n = os.path.split(nfilename)[1]
|
||||
logger.fdebug(module + ' Converted directory: ' + str(file_dir))
|
||||
logger.fdebug(module + ' Converted filename: ' + str(file_n))
|
||||
|
@ -382,9 +386,14 @@ def run (dirName, nzbName=None, issueid=None, manual=None, filename=None, module
|
|||
if os.path.exists(os.path.join(os.path.abspath(file_dir),file_n)): #(os.path.abspath(dirName),file_n)):
|
||||
logger.fdebug(module + ' Unable to move from temporary directory - file already exists in destination: ' + os.path.join(os.path.abspath(file_dir),file_n))
|
||||
else:
|
||||
shutil.move( os.path.join(comicpath, nfilename), os.path.join(os.path.abspath(file_dir),file_n)) #os.path.abspath(dirName),file_n))
|
||||
#shutil.move( nfilename, os.path.join(os.path.abspath(dirName),file_n))
|
||||
logger.fdebug(module + ' Sucessfully moved file from temporary path.')
|
||||
try:
|
||||
shutil.move( os.path.join(comicpath, nfilename), os.path.join(os.path.abspath(file_dir),file_n)) #os.path.abspath(dirName),file_n))
|
||||
#shutil.move( nfilename, os.path.join(os.path.abspath(dirName),file_n))
|
||||
logger.fdebug(module + ' Sucessfully moved file from temporary path.')
|
||||
except:
|
||||
logger.error(module + ' Unable to move file from temporary path. Deletion of temporary path halted.')
|
||||
return os.path.join(comicpath, nfilename)
|
||||
|
||||
i = 0
|
||||
|
||||
os.chdir( mylar.PROG_DIR )
|
||||
|
|
|
@ -167,11 +167,11 @@ def listFiles(dir,watchcomic,Publisher,AlternateSearch=None,manual=None,sarc=Non
|
|||
if numberinseries == 'True' or decimalinseries == 'True':
|
||||
#we need to remove the series from the subname and then search the remainder.
|
||||
watchname = re.sub('[\:\;\!\'\/\?\+\=\_\%\.]', '', watchcomic) #remove spec chars for watchcomic match.
|
||||
logger.fdebug('[FILECHECKER] watch-cleaned: ' + str(watchname))
|
||||
logger.fdebug('[FILECHECKER] watch-cleaned: ' + watchname)
|
||||
subthis = re.sub('.cbr', '', subname)
|
||||
subthis = re.sub('.cbz', '', subthis)
|
||||
subthis = re.sub('[\:\;\!\'\/\?\+\=\_\%\.]', '', subthis)
|
||||
logger.fdebug('[FILECHECKER] sub-cleaned: ' + str(subthis))
|
||||
logger.fdebug('[FILECHECKER] sub-cleaned: ' + subthis)
|
||||
#we need to make sure the file is part of the correct series or else will match falsely
|
||||
if watchname not in subthis:
|
||||
logger.fdebug('[FILECHECKER] this is a false match. Ignoring this result.')
|
||||
|
|
|
@ -470,7 +470,7 @@ def torrentdbsearch(seriesname,issue,comicid=None,nzbprov=None):
|
|||
tsearch_removed = re.sub('\s+', ' ', tsearch_rem2)
|
||||
tsearch_seriesname = re.sub('[\'\!\@\#\$\%\:\-\;\/\\=\?\&\.\s]', '%',tsearch_removed)
|
||||
tsearch = tsearch_seriesname + "%"
|
||||
logger.fdebug('tsearch : ' + str(tsearch))
|
||||
logger.fdebug('tsearch : ' + tsearch)
|
||||
AS_Alt = []
|
||||
tresults = []
|
||||
|
||||
|
|
Loading…
Reference in New Issue