Daniel Muellers 5 months ago
commit
ec87261688
4 changed files with 71 additions and 0 deletions
  1. 0 0
      README.md
  2. 34 0
      mrz_may.py
  3. 1 0
      mrzmay.json
  4. 36 0
      mrzmay_eval.py

+ 0 - 0
README.md


+ 34 - 0
mrz_may.py

@@ -0,0 +1,34 @@
+import requests
+import json
+
+
+members = [
+    {"name": "Daniel", "id": 1466083},
+    {"name": "Glenn", "id": 1512446},
+    {"name": "Hannes", "id": 1395737},
+    {"name": "Janus", "id": 1413802},
+    {"name": "Julian", "id": 1611428},
+    {"name": "Lars", "id": 1504305},
+    {"name": "Luciano", "id": 1468202},
+    {"name": "Manuel", "id": 1465242},
+    {"name": "Pascal", "id": 1451860},
+    {"name": "Tim", "id": 1342244},
+    {"name": "Vincent", "id": 1463490},
+]
+
+for member in members:
+    url = "https://api.vatsim.net/v2/members/{}/atc?limit=100".format(member["id"])
+
+    payload={}
+    headers = {
+        'Accept': 'application/json'
+    }
+
+    response = requests.request("GET", url, headers=headers, data=payload)
+
+    member["data"] = json.loads(response.text)
+
+
+f = open("mrzmay.json", "w")
+f.write(json.dumps(members))
+f.close()

File diff suppressed because it is too large
+ 1 - 0
mrzmay.json


+ 36 - 0
mrzmay_eval.py

@@ -0,0 +1,36 @@
+import json
+from datetime import datetime, timedelta
+
+def s2t(seconds):
+    h = seconds//3600
+    m = seconds%3600//60
+    s = (seconds%3600)%60
+    return "{:02.0f}:{:02.0f}:{:02.0f}".format(h, m, s)
+
+f = open("mrzmay.json", "r")
+members = json.loads(f.read())
+f.close()
+
+dateformat = "%Y-%m-%dT%H:%M:%SZ"
+
+stations = ['EDWW_M__CTR', 'EDUU_O_CTR', 'EDWW_MRZ_CTR', 'EDWW__M_CTR', 'EDWW_M___CTR', 'EDWW_B___CTR', 'EDWW_CTR', 'EDWW_B_CTR', 'EDWW_M_CTR', 'EDWW_B__CTR', 'EDWW_F_CTR', 'EDWW_K_CTR']
+
+for member in members:
+    member["eval"] = {"sessions": 0, "time": timedelta(seconds=0), "aircraft": 0}
+    for item in member["data"]["items"]:
+        if datetime.strptime(item["connection_id"]["start"],dateformat) > datetime.strptime("2024-05-01T00:00:00Z",dateformat) and item["connection_id"]["callsign"] in stations:
+            member["eval"]["sessions"] += 1
+            member["eval"]["time"] += (datetime.strptime(item["connection_id"]["end"], dateformat) - datetime.strptime(item["connection_id"]["start"], dateformat))
+            member["eval"]["aircraft"] += item["aircrafttracked"]
+    print("{:>7}: Sessions: {:>3}, Online für:  {}, Flugzeuge: {:>4}".format(member["name"], member["eval"]["sessions"], s2t(member["eval"]["time"].total_seconds()), member["eval"]["aircraft"]))
+
+totals ={"sessions": 0, "time": timedelta(seconds=0), "aircraft": 0} 
+
+for member in members:
+    totals["sessions"] += member["eval"]["sessions"]
+    totals["time"] += member["eval"]["time"]
+    totals["aircraft"] += member["eval"]["aircraft"]
+
+print("=============================================================")
+print("{:>7}: Sessions: {:>3}, Online für: {}, Flugzeuge: {:>4}".format("Gesamt", totals["sessions"], s2t(totals["time"].total_seconds()), totals["aircraft"]))
+