1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-24 03:54:20 +00:00
This commit is contained in:
Steffo 2018-06-14 00:29:51 +02:00
parent 38e0b38cc5
commit d2fbac8e8d

158
update.py
View file

@ -8,85 +8,85 @@ try:
while True: while True:
session = db.Session() session = db.Session()
# Update Steam # Update Steam
#print("STEAM") print("STEAM")
#for user in session.query(db.Steam).all(): for user in session.query(db.Steam).all():
# t = time.clock() t = time.clock()
# print(f"Updating {user.royal.username}", end="\t\t", flush=True) print(f"Updating {user.royal.username}", end="\t\t", flush=True)
# try: try:
# user.update() user.update()
# except errors.RequestError: except errors.RequestError:
# print("Request Error") print("Request Error")
# except errors.NotFoundError: except errors.NotFoundError:
# print("Not Found Error (?)") print("Not Found Error (?)")
# else: else:
# print("OK") print("OK")
# finally: finally:
# sleep_time = 1 - time.clock() + t sleep_time = 1 - time.clock() + t
# time.sleep(sleep_time if sleep_time > 0 else 0) time.sleep(sleep_time if sleep_time > 0 else 0)
## Update Rocket League # Update Rocket League
#print("ROCKET LEAGUE") print("ROCKET LEAGUE")
#for user in session.query(db.RocketLeague).all(): for user in session.query(db.RocketLeague).all():
# t = time.clock() t = time.clock()
# print(f"Updating {user.steam.royal.username}", end="\t\t", flush=True) print(f"Updating {user.steam.royal.username}", end="\t\t", flush=True)
# try: try:
# user.update() user.update()
# except errors.RequestError: except errors.RequestError:
# print("Request Error") print("Request Error")
# except errors.NotFoundError: except errors.NotFoundError:
# print("Not Found Error (?)") print("Not Found Error (?)")
# else: else:
# print("OK") print("OK")
# finally: finally:
# sleep_time = 1 - time.clock() + t sleep_time = 1 - time.clock() + t
# time.sleep(sleep_time if sleep_time > 0 else 0) time.sleep(sleep_time if sleep_time > 0 else 0)
## Update Dota 2 # Update Dota 2
#print("DOTA 2") print("DOTA 2")
#for user in session.query(db.Dota).all(): for user in session.query(db.Dota).all():
# t = time.clock() t = time.clock()
# print(f"Updating {user.steam.royal.username}", end="\t\t", flush=True) print(f"Updating {user.steam.royal.username}", end="\t\t", flush=True)
# try: try:
# user.update() user.update()
# except errors.RequestError: except errors.RequestError:
# print("Request Error") print("Request Error")
# except errors.NotFoundError: except errors.NotFoundError:
# print("Not Found Error (?)") print("Not Found Error (?)")
# else: else:
# print("OK") print("OK")
# finally: finally:
# sleep_time = 1 - time.clock() + t sleep_time = 1 - time.clock() + t
# time.sleep(sleep_time if sleep_time > 0 else 0) time.sleep(sleep_time if sleep_time > 0 else 0)
## Update League of Legends # Update League of Legends
#print("LEAGUE OF LEGENDS") print("LEAGUE OF LEGENDS")
#for user in session.query(db.LeagueOfLegends).all(): for user in session.query(db.LeagueOfLegends).all():
# t = time.clock() t = time.clock()
# print(f"Updating {user.royal.username}", end="\t\t", flush=True) print(f"Updating {user.royal.username}", end="\t\t", flush=True)
# try: try:
# user.update() user.update()
# except errors.RequestError: except errors.RequestError:
# print("Request Error") print("Request Error")
# except errors.NotFoundError: except errors.NotFoundError:
# print("Not Found Error (?)") print("Not Found Error (?)")
# else: else:
# print("OK") print("OK")
# finally: finally:
# sleep_time = 1 - time.clock() + t sleep_time = 1 - time.clock() + t
# time.sleep(sleep_time if sleep_time > 0 else 0) time.sleep(sleep_time if sleep_time > 0 else 0)
## Update Osu! # Update Osu!
#print("OSU!") print("OSU!")
#for user in session.query(db.Osu).all(): for user in session.query(db.Osu).all():
# t = time.clock() t = time.clock()
# print(f"Updating {user.royal.username}", end="\t\t", flush=True) print(f"Updating {user.royal.username}", end="\t\t", flush=True)
# try: try:
# user.update() user.update()
# except errors.RequestError: except errors.RequestError:
# print("Request Error") print("Request Error")
# except errors.NotFoundError: except errors.NotFoundError:
# print("Not Found Error (?)") print("Not Found Error (?)")
# else: else:
# print("OK") print("OK")
# finally: finally:
# sleep_time = 1 - time.clock() + t sleep_time = 1 - time.clock() + t
# time.sleep(sleep_time if sleep_time > 0 else 0) time.sleep(sleep_time if sleep_time > 0 else 0)
# Update Overwatch # Update Overwatch
print("OVERWATCH") print("OVERWATCH")
for user in session.query(db.Overwatch).all(): for user in session.query(db.Overwatch).all():