From 85cf3f79c255c8633d9a509f3b44e8652cbe6c1c Mon Sep 17 00:00:00 2001 From: eli fessler Date: Thu, 20 Oct 2022 18:16:52 -1000 Subject: [PATCH] code touchups & fix #53 --- s3s.py | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/s3s.py b/s3s.py index ec7527c..fb5f3fd 100755 --- a/s3s.py +++ b/s3s.py @@ -8,7 +8,7 @@ import argparse, datetime, json, os, shutil, re, requests, sys, time, uuid import msgpack import iksm, utils -A_VERSION = "0.1.6" +A_VERSION = "0.1.7" DEBUG = False @@ -534,13 +534,28 @@ def prepare_battle_result(battle, ismonitoring, overview_data=None): payload["our_team_inked"] = our_team_inked payload["their_team_inked"] = their_team_inked - # Anarchy Battles only + if mode == "PRIVATE": # these don't get sent otherwise + try: # could be anarchy, maybe not + payload["knockout"] = "no" if battle["knockout"] is None or battle["knockout"] == "NEITHER" else "yes" + except: + pass + try: + payload["our_team_count"] = battle["myTeam"]["result"]["score"] + payload["their_team_count"] = battle["otherTeams"][0]["result"]["score"] + except: + pass + try: + payload["our_team_percent"] = float(battle["myTeam"]["result"]["paintRatio"]) * 100 + payload["their_team_percent"] = float(battle["otherTeams"][0]["result"]["paintRatio"]) * 100 + except: + pass + if mode == "BANKARA": try: payload["our_team_count"] = battle["myTeam"]["result"]["score"] payload["their_team_count"] = battle["otherTeams"][0]["result"]["score"] - except TypeError: # draw - 'result' is null + except: # draw - 'result' is null pass payload["knockout"] = "no" if battle["knockout"] is None or battle["knockout"] == "NEITHER" else "yes" @@ -1006,6 +1021,8 @@ def monitor_battles(which, secs, isblackout, istestrun): except KeyboardInterrupt: # print(f"\nChecking to see if there are unuploaded {utils.set_noun(which)} before exiting...") # TODO + # check LatestBattleHistoriesQuery against https://stat.ink/api/v3/s3s/uuid-list + # TODO - do update_salmon_profile() at end if salmon run print("\n\nChecking for unuploaded results before exiting is not yet implemented.") print("Please run s3s again with " + '\033[91m' + "-r" + '\033[0m' + " to get these battles.")