Whatever it is that keeps going wrong, I hate it. And I have to try mitigating it.
This commit is contained in:
parent
188be95eb9
commit
1730a46ec3
1 changed files with 10 additions and 2 deletions
12
filler.py
12
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())))
|
||||
|
|
Loading…
Reference in a new issue