From 4336be442936b20cad6c874831d1b6c0ccd6a358 Mon Sep 17 00:00:00 2001 From: David Trail Date: Sun, 18 Mar 2012 12:17:18 +0100 Subject: [PATCH] Blarg --- .gitignore | 3 ++- grab.py | 11 +++++++---- schreddit | 1 + shreddit | 14 ++------------ user.json | 2 +- 5 files changed, 13 insertions(+), 18 deletions(-) create mode 120000 schreddit diff --git a/.gitignore b/.gitignore index 5354031..2307ea7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ -*.json +data.json +user.json *.swp *~ diff --git a/grab.py b/grab.py index 664fb85..dc9785c 100755 --- a/grab.py +++ b/grab.py @@ -5,10 +5,13 @@ from json import loads, dumps from urllib2 import urlopen, HTTPError from time import sleep -if len(sys.argv) != 2: - raise Exception("You must specifiy a user") - -user = sys.argv[1] +user = None +if len(sys.argv) == 2: + user = sys.argv[1] +else: + f = open('user.json', 'r') + user = loads(f.read())['user'] + f.close() sub_section = 'comments' after = '' diff --git a/schreddit b/schreddit new file mode 120000 index 0000000..502d7c0 --- /dev/null +++ b/schreddit @@ -0,0 +1 @@ +shreddit \ No newline at end of file diff --git a/shreddit b/shreddit index eae3a66..656ccad 100755 --- a/shreddit +++ b/shreddit @@ -1,19 +1,9 @@ #!/bin/sh -USER=$1 - -if [ $2 ]; then - DAYS=$2 -else - DAYS=7 -fi - -echo "Deleting everything before $DAYS days ago for user $USER" - echo "Running grab.py to get your history..." python2 grab.py $USER || exit 1 echo "Running kill.py to annihilate your history..." -python2 kill.py $DAYS || exit 1 +python2 kill.py $DAYS || exit 2 -echo "Everything seemed to run successfully." +echo "Everything seemed to execute successfully." diff --git a/user.json b/user.json index 7b90969..d499622 100644 --- a/user.json +++ b/user.json @@ -1 +1 @@ -{"passwd": "", "user": ""} +{"passwd": "", "user": "", "days": "7"}