diff --git a/shreddit b/shreddit index dac7fb5..f1fbdb1 100755 --- a/shreddit +++ b/shreddit @@ -2,6 +2,7 @@ import reddit import ConfigParser +import re from datetime import datetime, timedelta config = ConfigParser.RawConfigParser() @@ -9,6 +10,7 @@ config.read('shreddit.cfg') days = config.getint('main', 'days') whitelist = config.get('main', 'whitelist') +whitelist_ids = config.get('main', 'whitelist_ids') sort = config.get('main', 'sort') verbose = config.getboolean('main', 'verbose') clear_vote = config.getboolean('main', 'clear_vote') @@ -27,6 +29,7 @@ if verbose: print "Deleting messages before %s" % before_time whitelist = [y.strip().lower() for y in whitelist.split(',')] +whitelist_ids = [y.strip().lower() for y in whitelist_ids.split(',')] if verbose: print "Keeping messages from subreddits %s" % ', '.join(whitelist) @@ -46,6 +49,9 @@ for thing in things: #print "%s, %s, %s" % (thing_time, before_time, thing_time < before_time) + if thing.id in whitelist_ids: + continue + if thing_time > before_time: continue diff --git a/shreddit.cfg b/shreddit.cfg index d6deec3..83afe94 100644 --- a/shreddit.cfg +++ b/shreddit.cfg @@ -22,4 +22,7 @@ item = overview # Anything in this list won't be deleted, coma delimited # spaces should work as .strip() is called after splitting # on comma. -whitelist = AskScience, TheCulture, redditdev, programming +whitelist = AskScience, TheCulture, redditdev, programming, charity + +# If you want any specific posts to be whitelisted stick 'em in here +whitelist_ids = abcdef