From b9e121fec703b0d041e4018a007f775a005402be Mon Sep 17 00:00:00 2001 From: David Trail Date: Thu, 29 Mar 2012 15:34:57 +0200 Subject: [PATCH] Changed days to hours. Updated the readme. Added some helpful comments to the config file. --- README.rst | 1 + shreddit | 4 ++-- shreddit.cfg | 11 ++++++++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/README.rst b/README.rst index f6d5018..1586d15 100644 --- a/README.rst +++ b/README.rst @@ -8,6 +8,7 @@ Uses the reddit_api over at https://github.com/mellort/reddit_api to do all the Usage ----------- - Just run `./schreddit` +- You may want to check out the reddit_api, build it using `python setup.py build` and then copy the /reddit directory to this directory. The reason I don't provide it is that the reddit_api changes frequently and I don't want to include a static old version here. I also don't want to have a git repo in a git repo. Caveats ----------- diff --git a/shreddit b/shreddit index c1a79fc..d1faa55 100755 --- a/shreddit +++ b/shreddit @@ -7,7 +7,7 @@ from datetime import datetime, timedelta config = ConfigParser.RawConfigParser() config.read('shreddit.cfg') -days = config.getint('main', 'days') +hours = config.getint('main', 'hours') whitelist = config.get('main', 'whitelist') whitelist_ids = config.get('main', 'whitelist_ids') sort = config.get('main', 'sort') @@ -22,7 +22,7 @@ r.login() if verbose: print "Logged in as %s" % r.user -before_time = datetime.now() - timedelta(days=days) +before_time = datetime.now() - timedelta(hours=hours) if verbose: print "Deleting messages before %s" % before_time diff --git a/shreddit.cfg b/shreddit.cfg index 83afe94..f6de483 100644 --- a/shreddit.cfg +++ b/shreddit.cfg @@ -2,8 +2,13 @@ # or can be edited in the reddit_api [reddit] section [main] -# How many days of comments you want to keep -days = 2 +# How many hours of comments you want to keep +# 24 hours in a day, +# 168 hours in a week, +# 672 hours in two fortnights, +# 720 hours in a month (30 days), +# 8766 hours in a year (365.25 days) +hours = 24 # Options: new, top, controversial, more? sort = new @@ -25,4 +30,4 @@ item = overview whitelist = AskScience, TheCulture, redditdev, programming, charity # If you want any specific posts to be whitelisted stick 'em in here -whitelist_ids = abcdef +whitelist_ids = abcdef