Allows you to whitelist specific ids

pull/5/head
David Trail 13 years ago
parent a34681d169
commit e3d622fac4

@ -2,6 +2,7 @@
import reddit import reddit
import ConfigParser import ConfigParser
import re
from datetime import datetime, timedelta from datetime import datetime, timedelta
config = ConfigParser.RawConfigParser() config = ConfigParser.RawConfigParser()
@ -9,6 +10,7 @@ config.read('shreddit.cfg')
days = config.getint('main', 'days') days = config.getint('main', 'days')
whitelist = config.get('main', 'whitelist') whitelist = config.get('main', 'whitelist')
whitelist_ids = config.get('main', 'whitelist_ids')
sort = config.get('main', 'sort') sort = config.get('main', 'sort')
verbose = config.getboolean('main', 'verbose') verbose = config.getboolean('main', 'verbose')
clear_vote = config.getboolean('main', 'clear_vote') clear_vote = config.getboolean('main', 'clear_vote')
@ -27,6 +29,7 @@ if verbose:
print "Deleting messages before %s" % before_time print "Deleting messages before %s" % before_time
whitelist = [y.strip().lower() for y in whitelist.split(',')] whitelist = [y.strip().lower() for y in whitelist.split(',')]
whitelist_ids = [y.strip().lower() for y in whitelist_ids.split(',')]
if verbose: if verbose:
print "Keeping messages from subreddits %s" % ', '.join(whitelist) 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) #print "%s, %s, %s" % (thing_time, before_time, thing_time < before_time)
if thing.id in whitelist_ids:
continue
if thing_time > before_time: if thing_time > before_time:
continue continue

@ -22,4 +22,7 @@ item = overview
# Anything in this list won't be deleted, coma delimited # Anything in this list won't be deleted, coma delimited
# spaces should work as .strip() is called after splitting # spaces should work as .strip() is called after splitting
# on comma. # 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

Loading…
Cancel
Save