Overlay ausgebaut
This commit is contained in:
@@ -4,6 +4,8 @@ import urllib.request
|
||||
import json
|
||||
import os
|
||||
import time
|
||||
import dl_country
|
||||
import dl_twitchstate
|
||||
|
||||
SPREADSHEET_ID = "1bsO07WG6ymV4UzHZyB0ayrKCn2zv67SpFaeE4Zmghcc"
|
||||
GID = "1669168528"
|
||||
@@ -57,14 +59,30 @@ def parse_csv_data(reader):
|
||||
|
||||
# Zeile 2 (Index 1): Meta Info aus Spalte B (Index 1)
|
||||
meta_b2 = rows[1][1] if len(rows[1]) > 1 else ""
|
||||
deadline = rows[1][8] if len(rows[1]) > 8 else "" # Falls Deadline in Spalte I steht
|
||||
|
||||
# deadline = rows[1][8] if len(rows[1]) > 8 else "" # Falls Deadline in Spalte I steht
|
||||
# with open("countries.json", "r") as ctries:
|
||||
# countries = json.load(ctries)
|
||||
countries = dl_country.read_data()
|
||||
twitch_state = dl_twitchstate.read_data()
|
||||
deadline = countries["deadline"]
|
||||
# Ab Zeile 4 (Index 3): Spieler-Leaderboard
|
||||
leaderboard = []
|
||||
for row in rows[3:]:
|
||||
# Nur wenn ein Spielername in Spalte F (Index 5) existiert
|
||||
if len(row) > 5 and row[5].strip():
|
||||
player_name = row[5].strip()
|
||||
try:
|
||||
country = countries["users"][player_name]
|
||||
except Exception as e:
|
||||
print(str(e))
|
||||
country = ""
|
||||
|
||||
try:
|
||||
grind_state = twitch_state[player_name]
|
||||
except Exception as e:
|
||||
#print(str(e))
|
||||
grind_state = ""
|
||||
|
||||
division = row[0].strip() if len(row) > 0 else ""
|
||||
match division:
|
||||
case "C":
|
||||
@@ -96,9 +114,11 @@ def parse_csv_data(reader):
|
||||
"divisionRank": int(rank_div) if rank_div.isdigit() else 0,
|
||||
"overallRank": int(rank_overall_clean) if rank_overall_clean.isdigit() else None,
|
||||
"player": player_name,
|
||||
"flag": f"https://flagcdn.com/80x60/{country}.png",
|
||||
"part1": part1,
|
||||
"part2": part2,
|
||||
"totalTime": total_time,
|
||||
"grindState" : grind_state,
|
||||
"isOnline": online_str in ["on", "online", "true", "1", "ja"],
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user