From 51f0babb696605615c37ca372c1a084ed031ff89 Mon Sep 17 00:00:00 2001 From: Milo Date: Sat, 6 Apr 2019 13:41:47 +0200 Subject: [PATCH] added steamplayer history script --- server/nightr/steamplayerhistory.py | 22 ++++++++++++++++++++++ server/nightr/strategies/miloStrats.py | 3 +-- 2 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 server/nightr/steamplayerhistory.py diff --git a/server/nightr/steamplayerhistory.py b/server/nightr/steamplayerhistory.py new file mode 100644 index 0000000..3ba04d3 --- /dev/null +++ b/server/nightr/steamplayerhistory.py @@ -0,0 +1,22 @@ +import requests +import numpy as np +import pandas as pd +from datetime import datetime +import time + +def main(): + filename = "dotaplayers " + str(datetime.now()) + ".csv" + header = {"Client-ID": "F07D7ED5C43A695B3EBB01C28B6A18E5"} + appId = 570 + game_players_url = 'https://api.steampowered.com/ISteamUserStats/GetNumberOfCurrentPlayers/v1/?format=json&appid=' + str(appId) + while True: + f = open(filename,"a+") + game_players = requests.get(game_players_url, headers=header) + players_str = str(game_players.json()['response']['player_count']) + f.write(players_str + ", " + str(datetime.now()) + "\r\n") + print("Game name: Dota 2" + ", Player count: " + str(game_players.json()['response']['player_count'])) + f.close() + time.sleep(100) + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/server/nightr/strategies/miloStrats.py b/server/nightr/strategies/miloStrats.py index 93d84a6..4d2f622 100644 --- a/server/nightr/strategies/miloStrats.py +++ b/server/nightr/strategies/miloStrats.py @@ -2,6 +2,7 @@ import cv2 from datetime import datetime, timedelta from pytz import timezone + def camImgStrat(): img = cv2.imread('night.jpg',0) average = img.mean(axis=0).mean(axis=0) @@ -21,5 +22,3 @@ def australiaStrat(): else: return 0.0 - -print(australiaStrat())