From eee6d4c030ce24e519836fdc042b5a63d8cd41b6 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Fri, 1 Jan 2010 21:44:55 +0000 Subject: [PATCH] The !FreeSpace plugin only calculates free-space on existing directories. Cleaned-up logging. --- deluge/plugins/freespace/freespace/core.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/deluge/plugins/freespace/freespace/core.py b/deluge/plugins/freespace/freespace/core.py index 97bc0e6b8..03ad66b93 100644 --- a/deluge/plugins/freespace/freespace/core.py +++ b/deluge/plugins/freespace/freespace/core.py @@ -113,18 +113,20 @@ class Core(CorePluginBase): self._cleanup.stop() def update(self): - log.debug('\n\nUpdating %s FreeSpace', self.__class__.__name__) + log.debug('Updating %s FreeSpace', self.__class__.__name__) nots = {} for path in self.__gather_paths_to_check(): log.debug("Checking path %s", path) - free_percent = self.__get_free_space(path) - if (100 - free_percent) > self.config['percent']: - if path not in self.notifications_sent: - self.notifications_sent[path] = datetime.utcnow() - nots[path] = (100 - free_percent) - else: - log.warning("Running low on disk space on %s but " - "notifications were already triggered.", path) + if os.path.exists(path): + free_percent = self.__get_free_space(path) + if (100 - free_percent) > self.config['percent']: + if path not in self.notifications_sent: + self.notifications_sent[path] = datetime.utcnow() + nots[path] = (100 - free_percent) + else: + log.warning("Running low on disk space on %s but " + "notifications were already triggered.", + path) if nots: component.get("EventManager").emit(LowDiskSpaceEvent(nots))