починил play_by_play для офлайн матча
This commit is contained in:
18
get_data.py
18
get_data.py
@@ -1433,9 +1433,9 @@ async def started_team2(sort_by: str = None):
|
||||
return maybe_clear_for_vmix(players)
|
||||
|
||||
|
||||
@app.get("/game")
|
||||
@app.get("/latest_data")
|
||||
async def game():
|
||||
return latest_data["game"]
|
||||
return latest_data
|
||||
|
||||
|
||||
@app.get("/status")
|
||||
@@ -2773,7 +2773,6 @@ async def play_by_play():
|
||||
team1_name = data["team1"]["name"]
|
||||
team2_name = data["team2"]["name"]
|
||||
|
||||
json_live_status = latest_data["live-status"]["data"]
|
||||
|
||||
team1_startnum = [
|
||||
i["startNum"]
|
||||
@@ -2798,13 +2797,12 @@ async def play_by_play():
|
||||
|
||||
df_data_pbp = pd.DataFrame(data_pbp[::-1])
|
||||
last_event = data_pbp[-1]
|
||||
|
||||
if "play" not in df_data_pbp:
|
||||
return maybe_clear_for_vmix([])
|
||||
|
||||
if json_live_status["status"] != "Not Found":
|
||||
json_quarter = json_live_status["result"]["period"]
|
||||
json_second = json_live_status["result"]["second"]
|
||||
if "live-status" in latest_data and latest_data["live-status"]["data"] != "Not Found":
|
||||
json_quarter = latest_data["live-status"]["data"]["result"]["period"]
|
||||
json_second = latest_data["live-status"]["data"]["result"]["second"]
|
||||
else:
|
||||
json_quarter = last_event["period"]
|
||||
json_second = 0
|
||||
@@ -2896,12 +2894,14 @@ async def play_by_play():
|
||||
|
||||
# если хочешь вообще никаких NaN во всём JSON — можно так:
|
||||
# df_goals = df_goals.fillna("")
|
||||
|
||||
# print(payload)
|
||||
payload = df_goals.to_dict(orient="records")
|
||||
return maybe_clear_for_vmix(payload)
|
||||
|
||||
|
||||
|
||||
@app.get("/vmix")
|
||||
async def vmix_project():
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user