Add some shutdown breaks, for longer events

This commit is contained in:
Ruud committed 2012-01-08 17:30:18 +01:00
1 parent 33a8eb9fb1
commit 903d1ce7d1
2 files changed
+12

No files matched your search

+4
View File
@@ -56,6 +56,10 @@ class Manage(Plugin):
db.commit() db.commit()
db.remove() db.remove()
# Break if CP wants to shut down
if self.shuttingDown():
break
self.last_update = time.time() self.last_update = time.time()
def directories(self): def directories(self):
+8
View File
@@ -122,6 +122,10 @@ class Scanner(Plugin):
# Add identifier for library update # Add identifier for library update
update_after.append(group['library'].get('identifier')) update_after.append(group['library'].get('identifier'))
# Break if CP wants to shut down
if self.shuttingDown():
break
for identifier in update_after: for identifier in update_after:
fireEvent('library.update', identifier = identifier) fireEvent('library.update', identifier = identifier)
@@ -253,6 +257,10 @@ class Scanner(Plugin):
if not group['library']: if not group['library']:
log.error('Unable to determin movie: %s' % group['identifiers']) 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 # Delete still (asuming) unpacking files
for identifier in delete_identifier: for identifier in delete_identifier:
del movie_files[identifier] del movie_files[identifier]