Sorted it so you can delete submissions as well now. Changed date in config file

pull/5/head
David Trail 13 years ago
parent 5a19e9596d
commit 1d5a8c238f

@ -31,13 +31,22 @@ whitelist = [y.strip().lower() for y in whitelist.split(',')]
if verbose: if verbose:
print "Keeping messages from subreddits %s" % ', '.join(whitelist) print "Keeping messages from subreddits %s" % ', '.join(whitelist)
delete_whitelist = ('comments', 'submitted')
if item not in delete_whitelist:
raise Exception("Your deletion section is wrong")
things = [] things = []
if item == "comments": if item == "comments":
things = r.user.get_comments(limit=None, sort=sort) things = r.user.get_comments(limit=None, sort=sort)
elif item == "submissions": elif item == "submitted":
things = r.user.get_submissions(limit=None, sort=sort) things = r.user.get_submitted(limit=None, sort=sort)
for thing in things: for thing in things:
if item == "submitted":
if verbose:
print thing
thing.delete()
continue
if str(thing.subreddit).lower() in whitelist: if str(thing.subreddit).lower() in whitelist:
continue continue
now_time = datetime.fromtimestamp(thing.created) now_time = datetime.fromtimestamp(thing.created)

@ -3,23 +3,24 @@
[main] [main]
# How many days of comments you want to keep # How many days of comments you want to keep
days = 7 days = 2
# Options: new, top, controversial, more? # Options: new, top, controversial, more?
sort = new sort = new
# Enables print statements to notify you of what's going on # Enables print statements to notify you of what's going on
verbose = True verbose = False
# Removes your vote before deleting the item # Removes your vote before deleting the item
clear_vote = False clear_vote = False
# Options: comments, submissions # Options: comments, sumbitted, overview
# See: https://github.com/mellort/reddit_api/blob/master/reddit/objects.py#L359
# Deletes either everything you've submitted # Deletes either everything you've submitted
# or every comment in your history. # or every comment in your history.
item = comments item = submitted
# 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, sysadmin, programming whitelist = AskScience, TheCulture, redditdev, programming

Loading…
Cancel
Save