From 903d1ce7d12551e6d6a389173df005feb9e3a396 Mon Sep 17 00:00:00 2001 From: Ruud Date: Sun, 8 Jan 2012 17:30:18 +0100 Subject: [PATCH] Add some shutdown breaks, for longer events --- couchpotato/core/plugins/manage/main.py | 4 ++++ couchpotato/core/plugins/scanner/main.py | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/couchpotato/core/plugins/manage/main.py b/couchpotato/core/plugins/manage/main.py index b406b451..0eb18c8b 100644 --- a/couchpotato/core/plugins/manage/main.py +++ b/couchpotato/core/plugins/manage/main.py @@ -56,6 +56,10 @@ class Manage(Plugin): db.commit() db.remove() + # Break if CP wants to shut down + if self.shuttingDown(): + break + self.last_update = time.time() def directories(self): diff --git a/couchpotato/core/plugins/scanner/main.py b/couchpotato/core/plugins/scanner/main.py index 9973bb16..c6220fdf 100644 --- a/couchpotato/core/plugins/scanner/main.py +++ b/couchpotato/core/plugins/scanner/main.py @@ -122,6 +122,10 @@ class Scanner(Plugin): # Add identifier for library update update_after.append(group['library'].get('identifier')) + # Break if CP wants to shut down + if self.shuttingDown(): + break + for identifier in update_after: fireEvent('library.update', identifier = identifier) @@ -253,6 +257,10 @@ class Scanner(Plugin): if not group['library']: log.error('Unable to determin movie: %s' % group['identifiers']) + # Break if CP wants to shut down + if self.shuttingDown(): + break + # Delete still (asuming) unpacking files for identifier in delete_identifier: del movie_files[identifier]