From d2fbac8e8d350b13c6af6f488f33b04541707bcf Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Thu, 14 Jun 2018 00:29:51 +0200 Subject: [PATCH] derp --- update.py | 158 +++++++++++++++++++++++++++--------------------------- 1 file changed, 79 insertions(+), 79 deletions(-) diff --git a/update.py b/update.py index a44962dc..232e37a8 100644 --- a/update.py +++ b/update.py @@ -8,85 +8,85 @@ try: while True: session = db.Session() # Update Steam - #print("STEAM") - #for user in session.query(db.Steam).all(): - # t = time.clock() - # print(f"Updating {user.royal.username}", end="\t\t", flush=True) - # try: - # user.update() - # except errors.RequestError: - # print("Request Error") - # except errors.NotFoundError: - # print("Not Found Error (?)") - # else: - # print("OK") - # finally: - # sleep_time = 1 - time.clock() + t - # time.sleep(sleep_time if sleep_time > 0 else 0) - ## Update Rocket League - #print("ROCKET LEAGUE") - #for user in session.query(db.RocketLeague).all(): - # t = time.clock() - # print(f"Updating {user.steam.royal.username}", end="\t\t", flush=True) - # try: - # user.update() - # except errors.RequestError: - # print("Request Error") - # except errors.NotFoundError: - # print("Not Found Error (?)") - # else: - # print("OK") - # finally: - # sleep_time = 1 - time.clock() + t - # time.sleep(sleep_time if sleep_time > 0 else 0) - ## Update Dota 2 - #print("DOTA 2") - #for user in session.query(db.Dota).all(): - # t = time.clock() - # print(f"Updating {user.steam.royal.username}", end="\t\t", flush=True) - # try: - # user.update() - # except errors.RequestError: - # print("Request Error") - # except errors.NotFoundError: - # print("Not Found Error (?)") - # else: - # print("OK") - # finally: - # sleep_time = 1 - time.clock() + t - # time.sleep(sleep_time if sleep_time > 0 else 0) - ## Update League of Legends - #print("LEAGUE OF LEGENDS") - #for user in session.query(db.LeagueOfLegends).all(): - # t = time.clock() - # print(f"Updating {user.royal.username}", end="\t\t", flush=True) - # try: - # user.update() - # except errors.RequestError: - # print("Request Error") - # except errors.NotFoundError: - # print("Not Found Error (?)") - # else: - # print("OK") - # finally: - # sleep_time = 1 - time.clock() + t - # time.sleep(sleep_time if sleep_time > 0 else 0) - ## Update Osu! - #print("OSU!") - #for user in session.query(db.Osu).all(): - # t = time.clock() - # print(f"Updating {user.royal.username}", end="\t\t", flush=True) - # try: - # user.update() - # except errors.RequestError: - # print("Request Error") - # except errors.NotFoundError: - # print("Not Found Error (?)") - # else: - # print("OK") - # finally: - # sleep_time = 1 - time.clock() + t - # time.sleep(sleep_time if sleep_time > 0 else 0) + print("STEAM") + for user in session.query(db.Steam).all(): + t = time.clock() + print(f"Updating {user.royal.username}", end="\t\t", flush=True) + try: + user.update() + except errors.RequestError: + print("Request Error") + except errors.NotFoundError: + print("Not Found Error (?)") + else: + print("OK") + finally: + sleep_time = 1 - time.clock() + t + time.sleep(sleep_time if sleep_time > 0 else 0) + # Update Rocket League + print("ROCKET LEAGUE") + for user in session.query(db.RocketLeague).all(): + t = time.clock() + print(f"Updating {user.steam.royal.username}", end="\t\t", flush=True) + try: + user.update() + except errors.RequestError: + print("Request Error") + except errors.NotFoundError: + print("Not Found Error (?)") + else: + print("OK") + finally: + sleep_time = 1 - time.clock() + t + time.sleep(sleep_time if sleep_time > 0 else 0) + # Update Dota 2 + print("DOTA 2") + for user in session.query(db.Dota).all(): + t = time.clock() + print(f"Updating {user.steam.royal.username}", end="\t\t", flush=True) + try: + user.update() + except errors.RequestError: + print("Request Error") + except errors.NotFoundError: + print("Not Found Error (?)") + else: + print("OK") + finally: + sleep_time = 1 - time.clock() + t + time.sleep(sleep_time if sleep_time > 0 else 0) + # Update League of Legends + print("LEAGUE OF LEGENDS") + for user in session.query(db.LeagueOfLegends).all(): + t = time.clock() + print(f"Updating {user.royal.username}", end="\t\t", flush=True) + try: + user.update() + except errors.RequestError: + print("Request Error") + except errors.NotFoundError: + print("Not Found Error (?)") + else: + print("OK") + finally: + sleep_time = 1 - time.clock() + t + time.sleep(sleep_time if sleep_time > 0 else 0) + # Update Osu! + print("OSU!") + for user in session.query(db.Osu).all(): + t = time.clock() + print(f"Updating {user.royal.username}", end="\t\t", flush=True) + try: + user.update() + except errors.RequestError: + print("Request Error") + except errors.NotFoundError: + print("Not Found Error (?)") + else: + print("OK") + finally: + sleep_time = 1 - time.clock() + t + time.sleep(sleep_time if sleep_time > 0 else 0) # Update Overwatch print("OVERWATCH") for user in session.query(db.Overwatch).all():