Make sure that filler won't fail on first run because of empty data sets
This commit is contained in:
parent
c78f40c179
commit
07740b880b
1 changed files with 6 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env python3
|
#!/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()):
|
def getTweets(db=dbtools.dbHelper(), user=twitools.twObject().whoami(), two=twitools.twObject()):
|
||||||
query = "from:" + user
|
query = "from:" + user
|
||||||
|
@ -103,12 +103,15 @@ def getFollowing(db=dbtools.dbHelper(), two=twitools.twObject(), firstrun=False)
|
||||||
return gained, lost
|
return gained, lost
|
||||||
|
|
||||||
if __name__ == "__main__":
|
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()
|
db = dbtools.dbHelper()
|
||||||
count, last, first = getTweets(db)
|
count, last, first = getTweets(db)
|
||||||
print("Stored %i tweets." % count)
|
print("Stored %i tweets." % count)
|
||||||
count, last, first = getMessages(db)
|
count, last, first = getMessages(db)
|
||||||
print("Stored %i messages." % count)
|
print("Stored %i messages." % count)
|
||||||
gained, lost = getFollowers(db)
|
gained, lost = getFollowers(db, firstrun=args.first)
|
||||||
print("Gained %i followers, lost %i." % (gained, lost))
|
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))
|
print("Started following %i, stopped following %i." % (gained, lost))
|
||||||
|
|
Loading…
Reference in a new issue