From e9abdf7a840d02e6dcdfaf12a9cb30e013a6ffd4 Mon Sep 17 00:00:00 2001 From: David Trail Date: Sat, 11 May 2013 18:52:43 +0100 Subject: [PATCH] Generate an improved pre-delete edit text. --- shreddit | 15 +++++++++++++-- shreddit.cfg | 4 ++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/shreddit b/shreddit index c113e34..46b572d 100755 --- a/shreddit +++ b/shreddit @@ -5,6 +5,11 @@ import ConfigParser import argparse from datetime import datetime, timedelta +try: + from loremipsum import get_sentence +except: + get_sentence = '''I have been Shreddited for privacy!''' + parser = argparse.ArgumentParser() parser.add_argument('-c', '--config', help="config file to use instead of shreddit.cfg") args = parser.parse_args() @@ -21,6 +26,7 @@ whitelist_ids = config.get('main', 'whitelist_ids') sort = config.get('main', 'sort') verbose = config.getboolean('main', 'verbose') clear_vote = config.getboolean('main', 'clear_vote') +trial_run = config.getboolean('main', 'trial_run') item = config.get('main', 'item') _user = config.get('main', 'username') @@ -80,5 +86,10 @@ for thing in things: print 'Deleting: [%s]: "%s"' % (thing.subreddit, thing.body[:20]) if clear_vote: thing.clear_vote() - thing.edit('Shredded') - thing.delete() + if trial_run: + thing.edit(get_sentence) + if verbose: + print "Edited comment with {0}".format(get_sentence) + thing.delete() + if verbose: + print "Comment deleted." diff --git a/shreddit.cfg b/shreddit.cfg index 2a89e83..3cd6601 100644 --- a/shreddit.cfg +++ b/shreddit.cfg @@ -34,3 +34,7 @@ whitelist = AskScience, TheCulture, redditdev, programming, charity # If you want any specific posts to be whitelisted stick 'em in here whitelist_ids = abcdef + +# If you set this then no editing or deleting will be done +# but the output from the program will be shown as an example +trial_run = True