Fixes issue #332 with is_sample problem.

This commit is contained in:
echel0n 2014-04-20 08:19:26 -07:00
commit 2391f4a5de
4 changed files with 28 additions and 28 deletions

View file

@ -428,14 +428,13 @@ def get_dirnames(section, subsections=None):
return list(set(dirNames))
def delete(dirName):
def rmDir(dirName):
logger.info("Deleting %s" % (dirName))
try:
shutil.rmtree(dirName, True)
except:
logger.error("Unable to delete folder %s" % (dirName))
def cleanup_directories(inputCategory, processCategories, result, directory):
if inputCategory in processCategories and result == 0 and os.path.isdir(directory):
num_files_new = int(0)
@ -612,6 +611,10 @@ def listMediaFiles(path, ignoreSample=True):
elif isMediaFile(curFile):
# Optionally ignore sample files
if ignoreSample and is_sample(fullCurFile, nzbtomedia.MINSAMPLESIZE, nzbtomedia.SAMPLEIDS):
try:
os.unlink(fullCurFile)
logger.debug('Sample file %s has been removed.' % (curFile))
except:continue
continue
files.append(fullCurFile)