more manual run fixes.

This commit is contained in:
clinton-hall 2014-07-19 21:55:19 +09:30
commit 0268718074

View file

@ -480,10 +480,9 @@ def getDirs(section, subsection):
logger.info("Searching %s for mediafiles to post-process ..." % (path))
# search for single files and move them into there own folder for post-processing
for mediafile in listMediaFiles(path):
parentDir = os.path.dirname(mediafile)
if parentDir == path:
# search for single files and move them into their own folder for post-processing
for mediafile in [ os.path.join(path, o) for o in os.listdir(path) if
os.path.isfile(os.path.join(path, o)) ]:
logger.debug("Found file %s in root directory %s." % (mediafile, path))
newPath = None
fileExt = os.path.splitext(os.path.basename(mediafile))[1]
@ -497,7 +496,7 @@ def getDirs(section, subsection):
album = f.album
# create new path
newPath = os.path.join(parentDir, "%s - %s" % (sanitizeName(artist), sanitizeName(album)))
newPath = os.path.join(path, "%s - %s" % (sanitizeName(artist), sanitizeName(album)))
elif fileExt in nzbtomedia.MEDIACONTAINER:
f = guessit.guess_video_info(mediafile)
@ -511,13 +510,13 @@ def getDirs(section, subsection):
if not title:
title = os.path.splitext(os.path.basename(mediafile))[0]
newPath = os.path.join(parentDir, sanitizeName(title))
newPath = os.path.join(path, sanitizeName(title))
except Exception, e:
logger.error("Exception parsing name for media file: %s: %s" % (mediafile, e))
if not newPath:
title = os.path.splitext(os.path.basename(mediafile))[0]
newPath = os.path.join(parentDir, sanitizeName(title))
newPath = os.path.join(path, sanitizeName(title))
# Just fail-safe incase we already have afile with this clean-name (was actually a bug from earlier code, but let's be safe).
if os.path.isfile(newPath):