Move tweet() to twitools

This commit is contained in:
Klaus-Uwe Mitterer 2017-02-15 22:42:38 +01:00
parent 6df747c303
commit 720411508b
3 changed files with 4 additions and 8 deletions

View file

@ -24,9 +24,6 @@ def postprocess(lid, tid, db = dbtools.dbHelper()):
db.executeQuery("UPDATE lyrics SET active = 1 WHERE ref = %i;" % int(lid)) db.executeQuery("UPDATE lyrics SET active = 1 WHERE ref = %i;" % int(lid))
db.commit() db.commit()
def tweet(text, ref = 0, two = twitools.twObject()):
return two.tweet(text, ref).id
if __name__ == "__main__": if __name__ == "__main__":
lid, text, ref = getLyrics() lid, text, ref = getLyrics()
postprocess(lid, tweet(text, ref)) postprocess(lid, twitools.tweet(text, ref))

View file

@ -22,8 +22,5 @@ def getText(db = dbtools.dbHelper()):
def markovifyText(text): def markovifyText(text):
return Possy(text).make_short_sentence(130).replace("@", "@") return Possy(text).make_short_sentence(130).replace("@", "@")
def tweet(text, ref = 0, two = twitools.twObject()):
return two.tweet(text, ref).id
if __name__ == "__main__": if __name__ == "__main__":
tweet(markovifyText(getText())) twitools.tweet(markovifyText(getText()))

View file

@ -42,3 +42,5 @@ def getNamesByIDs(fids=getFollowerIDs(), two=twObject()):
for follower in followers: for follower in followers:
yield {"id": follower.id, "name": follower.screen_name} yield {"id": follower.id, "name": follower.screen_name}
def tweet(text, ref = 0):
return twObject().tweet(text, ref).id