Whatever it is that keeps going wrong, I hate it. And I have to try mitigating it.

This commit is contained in:
Klaus-Uwe Mitterer 2016-08-05 23:13:31 +02:00
parent 8381c4469a
commit 98afc3bffd

View file

@ -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())))