From 98540f2fcd8a91b14ff4abe4624f39e21b7b5540 Mon Sep 17 00:00:00 2001 From: Ruud Date: Thu, 18 Sep 2014 22:00:59 +0200 Subject: [PATCH] Make sure original_folder isn't empty fix #3747 --- couchpotato/core/plugins/renamer.py | 3 +++ couchpotato/core/plugins/scanner.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) 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