From 5a49c99defeddc0f516107f7d6eb80f757e48e7f Mon Sep 17 00:00:00 2001 From: David Trail Date: Tue, 13 Dec 2016 21:56:38 +0000 Subject: [PATCH] Correct INFO output when skipped deletions --- shreddit/shredder.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/shreddit/shredder.py b/shreddit/shredder.py index 9b456c8..08c6d9f 100644 --- a/shreddit/shredder.py +++ b/shreddit/shredder.py @@ -141,26 +141,29 @@ class Shredder(object): self._logger.info("Loading items to delete...") to_delete = [item for item in items] self._logger.info("Done. Starting on batch of {} items...".format(len(to_delete))) - count = 0 + count, count_removed = 0, 0 for item in to_delete: count += 1 self._logger.debug("Examining item {}: {}".format(count, item)) created = arrow.get(item.created_utc) if str(item.subreddit).lower() in self._blacklist: self._logger.debug("Deleting due to blacklist") + count_removed += 1 self._remove(item) elif self._check_whitelist(item): self._logger.debug("Skipping due to: whitelisted") continue if created <= self._nuke_cutoff: self._logger.debug("Item occurs prior to nuke cutoff") + count_removed += 1 self._remove(item) elif created > self._recent_cutoff: self._logger.debug("Skipping due to: too recent") continue else: + count_removed += 1 self._remove(item) - return count + return count_removed def _build_iterator(self): item = self._r.user.me()