From 655e7fbcd68840907e930ba87629ecd1b4e98970 Mon Sep 17 00:00:00 2001 From: Ari Timonen Date: Mon, 23 Apr 2018 22:21:02 +0000 Subject: [PATCH] Add FPS script Add some really hacky FPS script for quick testing. Dont use. --- scripts/fps_data.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 scripts/fps_data.py diff --git a/scripts/fps_data.py b/scripts/fps_data.py new file mode 100644 index 0000000..14b9127 --- /dev/null +++ b/scripts/fps_data.py @@ -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() +