mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-21 22:03:13 -07:00
more manual run fixes
This commit is contained in:
parent
982f46c8a9
commit
88c1c08f15
1 changed files with 12 additions and 2 deletions
|
@ -484,6 +484,7 @@ def getDirs(section, subsection):
|
||||||
for mediafile in listMediaFiles(path):
|
for mediafile in listMediaFiles(path):
|
||||||
parentDir = os.path.dirname(mediafile)
|
parentDir = os.path.dirname(mediafile)
|
||||||
if parentDir == path:
|
if parentDir == path:
|
||||||
|
logger.debug("Found file %s in root directory %s." % (mediafile, path))
|
||||||
newPath = None
|
newPath = None
|
||||||
fileExt = os.path.splitext(os.path.basename(mediafile))[1]
|
fileExt = os.path.splitext(os.path.basename(mediafile))[1]
|
||||||
|
|
||||||
|
@ -508,11 +509,20 @@ def getDirs(section, subsection):
|
||||||
title = f['title']
|
title = f['title']
|
||||||
|
|
||||||
if not title:
|
if not title:
|
||||||
title = os.path.basename(mediafile)
|
title = os.path.splitext(os.path.basename(mediafile))[0]
|
||||||
|
|
||||||
newPath = os.path.join(parentDir, sanitizeName(title))
|
newPath = os.path.join(parentDir, sanitizeName(title))
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
logger.info("Exception from MediaFile for: %s: %s" % (dir, 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))
|
||||||
|
|
||||||
|
# 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):
|
||||||
|
newPath2 = os.path.join(os.path.join(os.path.split(newPath)[0], 'new'), os.path.split(newPath)[1])
|
||||||
|
newPath = newPath2
|
||||||
|
|
||||||
# create new path if it does not exist
|
# create new path if it does not exist
|
||||||
if not os.path.exists(newPath):
|
if not os.path.exists(newPath):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue