From d9dbd654ca890bbe2b0c3bbc43867fe1f91a22a3 Mon Sep 17 00:00:00 2001 From: jess Date: Tue, 20 Feb 2018 22:47:35 +0100 Subject: [PATCH] now we only toot once and let cron schedule --- README.md | 4 +--- gen.py | 16 ++++++---------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index a86ea9f..ce9aca6 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,4 @@ run `python3 main.py` to login and scrape run `pyhton3 gen.py` to make a toot -this will toot once every three hours after until it crashes - -maybe the code won't be total jenk eventually but \shrug +cron is an okay choice to make it toot regularly diff --git a/gen.py b/gen.py index 8ed533a..a4cd651 100644 --- a/gen.py +++ b/gen.py @@ -13,13 +13,9 @@ client = Mastodon( with open("corpus.txt") as fp: model = markovify.NewlineText(fp.read()) -print("Running...") -while True: - print("tooting") - # This is not the best long term fix tbh - sentence = None - while sentence is None: - sentence = model.make_sentence() - client.toot(sentence.replace(chr(31), "\n")) - print("sleeping") - time.sleep(60*60*3) +print("tooting") +# This is not the best long term fix tbh +sentence = None +while sentence is None: + sentence = model.make_sentence(tries=100000) +client.toot(sentence.replace(chr(31), "\n"))