Add FPS script

Add some really hacky FPS script for quick testing. Dont use.
This commit is contained in:
Ari Timonen 2018-04-23 22:21:02 +00:00
parent 2dd674a98f
commit 655e7fbcd6

20
scripts/fps_data.py Normal file
View file

@ -0,0 +1,20 @@
import rHLDS, yaml, re, time, os
# Default port 27015
srv = rHLDS.Console(host=os.environ['RCON_HOST'], port=os.environ['RCON_PORT'], password=os.environ['RCON_PASSWORD'])
# Connect to server
srv.connect()
file1 = open("data.txt", "a+")
while True:
data = srv.execute("stats")
fps = re.search('(\d+.?\d*)(\d+.?\d*\s*)(\d+.?\d*\s*)(\d+.?\d*\s*)(\d+.?\d*\s*)(\d+.?\d*\s*)(\d+.?\d*\s*)', data).group(7)
if fps:
file1.write("%d,%s\n" % (time.time(), fps))
time.sleep(10)
file1.close()
srv.disconnect()