From e0198dd4e5d56993de0b96237d99e5d8554e6144 Mon Sep 17 00:00:00 2001 From: Ruud Date: Sun, 18 Dec 2011 21:54:56 +0100 Subject: [PATCH] Include addfilestolibrary to rename.after event --- couchpotato/core/plugins/renamer/main.py | 5 ++--- couchpotato/core/plugins/scanner/main.py | 5 +++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/couchpotato/core/plugins/renamer/main.py b/couchpotato/core/plugins/renamer/main.py index 8cd389b..f09ea34 100644 --- a/couchpotato/core/plugins/renamer/main.py +++ b/couchpotato/core/plugins/renamer/main.py @@ -258,6 +258,7 @@ class Renamer(Plugin): remove_files.append(current_file) # Rename all files marked + group['renamed_files'] = [] for src in rename_files: if rename_files[src]: dst = rename_files[src] @@ -268,6 +269,7 @@ class Renamer(Plugin): try: self.moveFile(src, dst) + group['renamed_files'].append(dst) except: log.error('Failed moving the file "%s" : %s' % (os.path.basename(src), traceback.format_exc())) @@ -279,9 +281,6 @@ class Renamer(Plugin): for release in remove_releases: log.info('Removing release %s' % release) - # Add this release to the library - fireEvent('scanner.files', folder = destination, files = [x for x in rename_files.itervalues()]) - # Search for trailers etc fireEventAsync('renamer.after', group) diff --git a/couchpotato/core/plugins/scanner/main.py b/couchpotato/core/plugins/scanner/main.py index 5ba1923..65dd1f9 100644 --- a/couchpotato/core/plugins/scanner/main.py +++ b/couchpotato/core/plugins/scanner/main.py @@ -78,6 +78,11 @@ class Scanner(Plugin): addEvent('scanner.name_year', self.getReleaseNameYear) addEvent('scanner.partnumber', self.getPartNumber) + def after_rename(group): + return self.scanFilesToLibrary(self, folder = group['destination_dir'], files = group['renamed_files']) + + addEvent('rename.after', after_rename) + def scanFilesToLibrary(self, folder = None, files = None): groups = self.scan(folder = folder, files = files)