diff --git a/retweeter.py b/retweeter.py index 1257c6c..d223fbd 100644 --- a/retweeter.py +++ b/retweeter.py @@ -1,7 +1,7 @@ import argparse, tools def getSavepoint(db, user): - db.executeQuery("SELECT max(tweet_id) FROM retweets WHERE author = '%s'" % user) + db.executeQuery("SELECT MAX(tweet_id) FROM retweets WHERE LOWER(author) = '%s'" % user.lower()) try: return int(db.getNext()[0]) except: @@ -19,11 +19,11 @@ def retweet(user, two=tools.twObject(), db=tools.dbHelper(tools.dbpath())): tw_counter = 0 for status in timeline: - if status.text[0] != "@" or two.whoami() in status.text: + if (status.text[0] != "@" or two.whoami() in status.text) and status.text[0:2] != "RT": timestamp = status.created_at.strftime('%Y-%m-%d %H:%M:%S') + " +0000" text = unescapeText(status.text) - db.executeQuery("INSERT INTO retweets('id','created_at','text') VALUES(" + str(status.id) + ",'" + timestamp + "','" + text + "')") + db.executeQuery("INSERT INTO retweets('id','author','created_at','text') VALUES(" + str(status.id) + ",'" + user.lower() + "','" + timestamp + "','" + text + "')") db.commit() two.retweet(status.id)