From eab9bd3b85a911fab4a1609e7b3c58e4f84c8ec7 Mon Sep 17 00:00:00 2001 From: David Trail Date: Mon, 19 Mar 2012 15:31:21 +0100 Subject: [PATCH] A few minor changes, debug output, etc --- shreddit | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/shreddit b/shreddit index 499446f..c46b075 100755 --- a/shreddit +++ b/shreddit @@ -16,15 +16,24 @@ r = reddit.Reddit(user_agent="Shreddit-PRAW") # add user: / pswd: to the [reddit] config section r.login() +if verbose: + print "Logged in as %s" % r.user + before_time = datetime.now() - timedelta(days=days) +if verbose: + print "Deleting messages before %s" % before_time + whitelist = [y.strip().lower() for y in whitelist.split(',')] +if verbose: + print "Keeping messages from subreddits %s" % ', '.join(whitelist) + for comment in r.user.get_comments(limit=None, sort=sort): - if str(comment.subreddit).lower() in whitelist: - next - now_time = datetime.fromtimestamp(comment.created) - if now_time < before_time: - if verbose: - print 'Deleting: [%s]: "%s"' % (comment.subreddit, comment.body[:20]) - comment.delete() + if str(comment.subreddit).lower() in whitelist: + next + now_time = datetime.fromtimestamp(comment.created) + if now_time < before_time: + if verbose: + print 'Deleting: [%s]: "%s"' % (comment.subreddit, comment.body[:20]) + comment.delete()