Browse Source

Renamer error because of wrong variables

pull/66/head
Ruud 14 years ago
parent
commit
6bf6ffd4f8
  1. 2
      couchpotato/core/plugins/base.py
  2. 14
      couchpotato/core/plugins/renamer/main.py

2
couchpotato/core/plugins/base.py

@ -81,7 +81,7 @@ class Plugin(object):
def makeDir(self, path): def makeDir(self, path):
try: try:
if not os.path.isdir(path): if not os.path.isdir(path):
os.makedirs(path, Env.getValuePermission('folder')) os.makedirs(path, Env.getPermission('folder'))
return True return True
except Exception, e: except Exception, e:
log.error('Unable to create folder "%s": %s' % (path, e)) log.error('Unable to create folder "%s": %s' % (path, e))

14
couchpotato/core/plugins/renamer/main.py

@ -167,28 +167,28 @@ class Renamer(Plugin):
if group['is_dvd'] and file_type is 'movie': if group['is_dvd'] and file_type is 'movie':
found = False found = False
for top_dir in ['video_ts', 'audio_ts', 'bdmv', 'certificate']: for top_dir in ['video_ts', 'audio_ts', 'bdmv', 'certificate']:
has_string = file.lower().find(os.path.sep + top_dir + os.path.sep) has_string = current_file.lower().find(os.path.sep + top_dir + os.path.sep)
if has_string >= 0: if has_string >= 0:
structure_dir = file[has_string:].lstrip(os.path.sep) structure_dir = current_file[has_string:].lstrip(os.path.sep)
rename_files[file] = os.path.join(destination, final_folder_name, structure_dir) rename_files[current_file] = os.path.join(destination, final_folder_name, structure_dir)
found = True found = True
break break
if not found: if not found:
log.error('Could not determin dvd structure for: %s' % file) log.error('Could not determin dvd structure for: %s' % current_file)
# Do rename others # Do rename others
else: else:
if self.conf('move_leftover') and file_type is 'leftover': if self.conf('move_leftover') and file_type is 'leftover':
rename_files[file] = os.path.join(destination, final_folder_name, os.path.basename(file)) rename_files[current_file] = os.path.join(destination, final_folder_name, os.path.basename(current_file))
else: else:
rename_files[file] = os.path.join(destination, final_folder_name, final_file_name) rename_files[current_file] = os.path.join(destination, final_folder_name, final_file_name)
# Check for extra subtitle files # Check for extra subtitle files
if file_type is 'subtitle': if file_type is 'subtitle':
def test(s): def test(s):
return file[:-len(replacements['ext'])] in s return current_file[:-len(replacements['ext'])] in s
for subtitle_extra in set(filter(test, group['files']['subtitle_extra'])): for subtitle_extra in set(filter(test, group['files']['subtitle_extra'])):
replacements['ext'] = getExt(subtitle_extra) replacements['ext'] = getExt(subtitle_extra)

Loading…
Cancel
Save