diff --git a/filler.py b/filler.py index 8f56c21..1fc7514 100755 --- a/filler.py +++ b/filler.py @@ -50,12 +50,16 @@ def getMessages(db=dbtools.dbHelper(), two=twitools.twObject()): return mcount, savepoint or 0, db.getLatestMessage() -def getFollowers(db=dbtools.dbHelper(), two=twitools.twObject()): +def getFollowers(db=dbtools.dbHelper(), two=twitools.twObject(), firstrun=False): current = db.getFollowers() new = list(twitools.getNamesByIDs(twitools.getFollowerIDs())) gained = 0 lost = 0 + if (len(current) == 0 or len(new) == 0) and not firstrun: + print("Something went wrong.") + return 0,0 + for follower in new: if follower not in current: db.executeQuery("INSERT INTO followers VALUES('%s', %i, NULL)" % (follower, int(time.time()))) @@ -72,12 +76,16 @@ def getFollowers(db=dbtools.dbHelper(), two=twitools.twObject()): return gained, lost -def getFollowing(db=dbtools.dbHelper(), two=twitools.twObject()): +def getFollowing(db=dbtools.dbHelper(), two=twitools.twObject(), firstrun=False): current = db.getFollowing() new = list(twitools.getNamesByIDs(twitools.getFollowingIDs())) gained = 0 lost = 0 + if (len(current) == 0 or len(new) == 0) and not firstrun: + print("Something went wrong.") + return 0,0 + for following in new: if following not in current: db.executeQuery("INSERT INTO following VALUES('%s', %i, NULL)" % (following, int(time.time())))