mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-20 21:33:13 -07:00
additional extension rename checks. fixes #351
This commit is contained in:
parent
0c8ce3917b
commit
03c3a013ff
2 changed files with 17 additions and 0 deletions
|
@ -29,6 +29,8 @@ class autoProcessComics:
|
||||||
|
|
||||||
inputName, dirName = convert_to_ascii(inputName, dirName)
|
inputName, dirName = convert_to_ascii(inputName, dirName)
|
||||||
|
|
||||||
|
replaceExtensions(dirName)
|
||||||
|
|
||||||
params = {}
|
params = {}
|
||||||
params['nzb_folder'] = dirName
|
params['nzb_folder'] = dirName
|
||||||
if remote_path:
|
if remote_path:
|
||||||
|
|
|
@ -39,6 +39,21 @@ def sanitizeName(name):
|
||||||
|
|
||||||
return name
|
return name
|
||||||
|
|
||||||
|
def replaceExtensions(path):
|
||||||
|
for dirpath, dirnames, filesnames in os.walk(path):
|
||||||
|
for filename in filesnames:
|
||||||
|
name, ext = os.path.splitext(filename)
|
||||||
|
if ext in nzbtomedia.EXT_REPLACE:
|
||||||
|
file = os.path.join(dirpath, filename)
|
||||||
|
target = os.path.join(dirpath, name + nzbtomedia.EXT_REPLACE[ext])
|
||||||
|
try:
|
||||||
|
logger.debug("Renaming %s to %s" % (file, target), 'RENAME')
|
||||||
|
shutil.move(file, target)
|
||||||
|
except:
|
||||||
|
logger.error("Could not rename %s to %s" % (file, target), 'RENAME')
|
||||||
|
else:
|
||||||
|
continue
|
||||||
|
|
||||||
def makeDir(path):
|
def makeDir(path):
|
||||||
if not os.path.isdir(path):
|
if not os.path.isdir(path):
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue