Ability to change sort methods through config.

pull/5/head
David Trail 13 years ago
parent 5d2551255d
commit 9d230704cd

@ -9,6 +9,7 @@ config.read('shreddit.cfg')
days = config.getint('main', 'days')
whitelist = config.get('main', 'whitelist')
sort = config.get('main', 'sort')
r = reddit.Reddit(user_agent="Shreddit-PRAW")
# add user: <YourUsername> / pswd: <YourPassword> to the [reddit] config section
@ -18,7 +19,7 @@ before_time = datetime.now() - timedelta(days=days)
whitelist = [y.strip().lower() for y in whitelist.split(',')]
for comment in r.user.get_comments(limit=None, sort='new'):
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)

@ -5,3 +5,5 @@ days = 7
# Don't delete from these subreddits
whitelist = AskScience, TheCulture, redditdev, sysadmin, programming
sort = new

Loading…
Cancel
Save