diff --git a/couchpotato/core/plugins/renamer.py b/couchpotato/core/plugins/renamer.py index 9decf08..4c7aa3b 100755 --- a/couchpotato/core/plugins/renamer.py +++ b/couchpotato/core/plugins/renamer.py @@ -344,6 +344,9 @@ class Renamer(Plugin): replacements['original'] = os.path.splitext(os.path.basename(current_file))[0] replacements['original_folder'] = fireEvent('scanner.remove_cptag', group['dirname'], single = True) + if not replacements['original_folder'] or len(replacements['original_folder']) == 0: + replacements['original_folder'] = replacements['original'] + # Extension replacements['ext'] = getExt(current_file) diff --git a/couchpotato/core/plugins/scanner.py b/couchpotato/core/plugins/scanner.py index 8e835b5..a1b5cf8 100644 --- a/couchpotato/core/plugins/scanner.py +++ b/couchpotato/core/plugins/scanner.py @@ -694,7 +694,7 @@ class Scanner(Plugin): def removeCPTag(self, name): try: - return re.sub(self.cp_imdb, '', name) + return re.sub(self.cp_imdb, '', name).strip() except: pass return name