diff --git a/filler.py b/filler.py index 5782bf9..499c352 100755 --- a/filler.py +++ b/filler.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -import dbtools, setuptools, time, twitools +import argparse, dbtools, setuptools, time, twitools def getTweets(db=dbtools.dbHelper(), user=twitools.twObject().whoami(), two=twitools.twObject()): query = "from:" + user @@ -103,12 +103,15 @@ def getFollowing(db=dbtools.dbHelper(), two=twitools.twObject(), firstrun=False) return gained, lost if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("-f", "--first", help="first run: ignore empty databases", action="store_true") + args = parser.parse_args() db = dbtools.dbHelper() count, last, first = getTweets(db) print("Stored %i tweets." % count) count, last, first = getMessages(db) print("Stored %i messages." % count) - gained, lost = getFollowers(db) + gained, lost = getFollowers(db, firstrun=args.first) print("Gained %i followers, lost %i." % (gained, lost)) - gained, lost = getFollowing(db) + gained, lost = getFollowing(db, firstrun=args.first) print("Started following %i, stopped following %i." % (gained, lost))