Compare commits

...

4 Commits

Author SHA1 Message Date
Alexey Barabanov
ca7cd72b74 SH update 2025-10-20 18:43:53 +03:00
Alexey Barabanov
1a344d2be2 RUN.sh update 2025-10-20 14:03:23 +03:00
Alexey Barabanov
2bd99cf663 add RUN.sh 2025-10-20 13:59:12 +03:00
Alexey Barabanov
e1aa4c993a Test_RUN 2025-10-20 13:33:37 +03:00
18 changed files with 158 additions and 50068 deletions

3
.gitignore vendored
View File

@@ -1,3 +1,4 @@
.venv/*
/JSON/*
/logs/*
/logs/*
/static/*

102
RUN.sh Executable file
View File

@@ -0,0 +1,102 @@
#!/bin/bash
show_help() {
echo "Использование: $0 -t <домашняя команда>"
echo " -t Домашняя команда"
echo " -h Показать эту справку"
echo ""
echo "Пример: $0 -t \"cska\""
exit 0
}
# Определение IP адреса
if [[ "$(uname -s)" != "Darwin" ]]; then
ip_address=$(ip a 2>/dev/null | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1' | head -n1)
else
ip_address=$(ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1' | head -n1)
fi
echo "IP: $ip_address"
# База данных хостов в виде пар IP-команда
hosts=(
"10.10.35.21:cska"
"10.10.35.22:Kuban"
"10.10.35.23:uralmash"
"10.10.35.24:betcity parma"
"10.10.35.25:avtodor"
"10.10.35.26:zenit"
"10.10.35.27:samara"
"10.10.35.28:mba-mai"
"10.10.35.29:Pari Nizhny Novgorod"
"10.10.35.30:unics"
)
# Определение команды по IP
detected_team=""
for host in "${hosts[@]}"; do
host_ip="${host%%:*}"
host_team="${host#*:}"
if [[ "$ip_address" == "$host_ip" ]]; then
detected_team="$host_team"
break
fi
done
# Обработка аргументов командной строки
team=""
while getopts "t:h" opt; do
case $opt in
t) team="$OPTARG" ;;
h) show_help ;;
*) echo "Неверный аргумент"; exit 1 ;;
esac
done
# Определение финальной команды (приоритет у аргумента, затем у автоопределения)
if [[ -n "$team" ]]; then
final_team="$team"
echo "Используется команда из аргумента: $final_team"
elif [[ -n "$detected_team" ]]; then
final_team="$detected_team"
echo "Используется автоопределенная команда: $final_team"
else
echo "Ошибка: Не удалось определить команду. Укажите явно через -t или проверьте IP адрес"
echo "Доступные команды:"
for ip in "${!hosts[@]}"; do
echo " $ip: ${hosts[$ip]}"
done
exit 1
fi
# Проверка существования файлов
if [[ ! -f "$(pwd)/.venv/bin/streamlit" ]]; then
echo "Ошибка: streamlit не найден в $(pwd)/.venv/bin/streamlit"
exit 1
fi
if [[ ! -f "$(pwd)/visual.py" ]]; then
echo "Ошибка: visual.py не найден в $(pwd)/visual.py"
exit 1
fi
if [[ ! -f "$(pwd)/get_data.py" ]]; then
echo "Ошибка: get_data.py не найден в $(pwd)/get_data.py"
exit 1
fi
#Запуск сбора данных
echo "Запуск get_data.py..."
"$(pwd)/.venv/bin/python $(pwd)/get_data.py" --team "$final_team" &
# Небольшая задержка перед запуском второго процесса
sleep 2
# Запуск веб-морды
echo "Запуск приложения для команды: $final_team"
echo "Запуск streamlit..."
"$(pwd)/.venv/bin/streamlit" run "$(pwd)/visual.py"
# Ожидание завершения процессов
echo "Оба процесса запущены. Для остановки нажмите Ctrl+C"
wait

108
get_data.py Normal file → Executable file
View File

@@ -756,38 +756,38 @@ def Json_Team_Generation(who, data, stop_event):
player_season_stat = []
player_career_stat = []
coach_stat = []
# with ThreadPoolExecutor() as pool:
# player_season_stat_temp = [
# pool.submit(Player_Stat_Season, player_id, data["season"])
# for player_id in player_ids
# ]
# player_career_stat_temp = [
# pool.submit(Player_Stat_Career, player_id)
# for player_id in player_ids
# ]
# coach_stat_temp = [
# pool.submit(
# Coach_Stat, coach_id, data["season"], data[f"{who}_id"]
# )
# for coach_id in coach_ids
# ]
# player_futures = [pool.submit(Player_all_game, pid) for pid in player_ids]
# all_players_games = []
# for fut in as_completed(player_futures):
# try:
# all_players_games.append(fut.result())
# except Exception as e:
# logger.exception(f"Ошибка при обработке игрока: {e}")
with ThreadPoolExecutor() as pool:
player_season_stat_temp = [
pool.submit(Player_Stat_Season, player_id, data["season"])
for player_id in player_ids
]
player_career_stat_temp = [
pool.submit(Player_Stat_Career, player_id)
for player_id in player_ids
]
coach_stat_temp = [
pool.submit(
Coach_Stat, coach_id, data["season"], data[f"{who}_id"]
)
for coach_id in coach_ids
]
player_futures = [pool.submit(Player_all_game, pid) for pid in player_ids]
all_players_games = []
for fut in as_completed(player_futures):
try:
all_players_games.append(fut.result())
except Exception as e:
logger.exception(f"Ошибка при обработке игрока: {e}")
# player_season_stat += [
# res.result() for res in player_season_stat_temp
# ]
# player_career_stat += [
# res.result() for res in player_career_stat_temp
# ]
# coach_stat += [res.result() for res in coach_stat_temp]
player_season_stat += [
res.result() for res in player_season_stat_temp
]
player_career_stat += [
res.result() for res in player_career_stat_temp
]
coach_stat += [res.result() for res in coach_stat_temp]
# initialized = True
initialized = True
# print(coach_stat)
# while not stop_event.is_set():
role_list = [
@@ -2294,7 +2294,7 @@ def Play_By_Play(data: dict, stop_event: threading.Event) -> None:
json_live_status = get_json(url)
last_event = plays[-1]
if not json_live_status or json_live_status.get("message") == "Not Found":
if not json_live_status or json_live_status.get("status") == "Not Found":
period = last_event.get("period", 1)
second = 0
else:
@@ -2835,27 +2835,27 @@ def main():
args=("team1", data, stop_event),
name="Team1JSON",
),
# threading.Thread(
# target=Json_Team_Generation,
# args=("team2", data, stop_event),
# name="Team2JSON",
# ),
# threading.Thread(
# target=Team_Both_Stat, args=(stop_event,), name="BothTeamsStat"
# ),
# threading.Thread(target=Referee, args=(stop_event,), name="Referee"),
# threading.Thread(
# target=Scores_Quarter, args=(stop_event,), name="QuarterScore"
# ),
# threading.Thread(
# target=Status_Online, args=(data, stop_event), name="StatusOnline"
# ),
# threading.Thread(
# target=Play_By_Play, args=(data, stop_event), name="PlayByPlay"
# ),
# threading.Thread(
# target=Standing_func, args=(data, stop_event), name="Standings"
# ),
threading.Thread(
target=Json_Team_Generation,
args=("team2", data, stop_event),
name="Team2JSON",
),
threading.Thread(
target=Team_Both_Stat, args=(stop_event,), name="BothTeamsStat"
),
threading.Thread(target=Referee, args=(stop_event,), name="Referee"),
threading.Thread(
target=Scores_Quarter, args=(stop_event,), name="QuarterScore"
),
threading.Thread(
target=Status_Online, args=(data, stop_event), name="StatusOnline"
),
threading.Thread(
target=Play_By_Play, args=(data, stop_event), name="PlayByPlay"
),
threading.Thread(
target=Standing_func, args=(data, stop_event), name="Standings"
),
]
# Запуск всех потоков
@@ -2863,8 +2863,8 @@ def main():
t.start()
logger.debug(f"Поток {t.name} запущен.")
# How_To_Play_Quarter(data)
# pregame_data(data)
How_To_Play_Quarter(data)
pregame_data(data)
try:
while True:

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,128 +0,0 @@
[
{
"displayNumber": "",
"positionName": "Crew chief",
"lastNameGFX": "Aleksey Davydov",
"secondName": "Mikhailovich",
"birthday": "1984-10-05T00:00:00",
"age": 41,
"flag": "https://flagicons.lipis.dev/flags/4x3/ru.svg"
},
{
"displayNumber": "",
"positionName": "Referee 1",
"lastNameGFX": "Sergey Mikhailov",
"secondName": "Alexandrovich",
"birthday": "1977-05-20T00:00:00",
"age": 48,
"flag": "https://flagicons.lipis.dev/flags/4x3/ru.svg"
},
{
"displayNumber": "",
"positionName": "Referee 2",
"lastNameGFX": "Maksim Zhitlukhin",
"secondName": "Sergeevich",
"birthday": "1986-12-19T00:00:00",
"age": 38,
"flag": "https://flagicons.lipis.dev/flags/4x3/ru.svg"
},
{
"displayNumber": "",
"positionName": "Commissioner",
"lastNameGFX": "Igor Lebedev",
"secondName": "Anatolevich",
"birthday": "1965-05-27T00:00:00",
"age": 60,
"flag": "https://flagicons.lipis.dev/flags/4x3/ru.svg"
},
{
"displayNumber": "",
"positionName": "Scorer",
"lastNameGFX": "Viktoriya Isaeva",
"secondName": "Dmitrievna",
"birthday": "1996-01-09T00:00:00",
"age": 29,
"flag": "https://flagicons.lipis.dev/flags/4x3/ru.svg"
},
{
"displayNumber": "",
"positionName": "Assistant Scorer",
"lastNameGFX": "Dmitriy Kibenko",
"secondName": "Andreevich",
"birthday": "1983-12-25T00:00:00",
"age": 41,
"flag": "https://flagicons.lipis.dev/flags/4x3/ru.svg"
},
{
"displayNumber": "",
"positionName": "Timekeeper",
"lastNameGFX": "Olga Prosneva",
"secondName": "Nikolaevna",
"birthday": "1971-06-15T00:00:00",
"age": 54,
"flag": "https://flagicons.lipis.dev/flags/4x3/ru.svg"
},
{
"displayNumber": "",
"positionName": "Operator 24 sec",
"lastNameGFX": "Aleksey Nagibin",
"secondName": "Vitalevich",
"birthday": "1982-08-21T00:00:00",
"age": 43,
"flag": "https://flagicons.lipis.dev/flags/4x3/ru.svg"
},
{
"displayNumber": "",
"positionName": "Dictor",
"lastNameGFX": "Адель Халимов",
"secondName": "Рашидович",
"birthday": "1996-07-31T00:00:00",
"age": 29,
"flag": "https://flagicons.lipis.dev/flags/4x3/ru.svg"
},
{
"displayNumber": "",
"positionName": "Statistic",
"lastNameGFX": "Veronika Shuvagina",
"secondName": "Vladimirovna",
"birthday": "1968-05-08T00:00:00",
"age": 57,
"flag": "https://flagicons.lipis.dev/flags/4x3/ru.svg"
},
{
"displayNumber": "",
"positionName": "IS Operator",
"lastNameGFX": "Rashid Khabibullin",
"secondName": "Rinatovich",
"birthday": "1987-07-26T00:00:00",
"age": 38,
"flag": "https://flagicons.lipis.dev/flags/4x3/ru.svg"
},
{
"displayNumber": "",
"positionName": "Statistic",
"lastNameGFX": "Mariya Shuvagina",
"secondName": "Dmitrievna",
"birthday": "2002-08-04T00:00:00",
"age": 23,
"flag": "https://flagicons.lipis.dev/flags/4x3/ru.svg"
},
{
"displayNumber": "",
"positionName": "Video reviewer",
"lastNameGFX": "Kamil Habibullin",
"secondName": "Ildarovich",
"birthday": "1975-12-08T00:00:00",
"age": 49,
"flag": "https://flagicons.lipis.dev/flags/4x3/ru.svg"
},
{
"displayNumber": "",
"positionName": "-",
"lastNameGFX": "None None",
"secondName": null,
"birthday": null,
"age": null,
"flag": "https://flagicons.lipis.dev/flags/4x3/.svg"
}
]

File diff suppressed because it is too large Load Diff

View File

@@ -1,42 +0,0 @@
[
{
"Q": "Q1",
"score1": "33",
"score2": "20"
},
{
"Q": "Q2",
"score1": "26",
"score2": "21"
},
{
"Q": "Q3",
"score1": "26",
"score2": "20"
},
{
"Q": "Q4",
"score1": "18",
"score2": "22"
},
{
"Q": "OT1",
"score1": "",
"score2": ""
},
{
"Q": "OT2",
"score1": "",
"score2": ""
},
{
"Q": "OT3",
"score1": "",
"score2": ""
},
{
"Q": "OT4",
"score1": "",
"score2": ""
}
]

View File

@@ -1,88 +0,0 @@
[
{
"team": "UNICS",
"winQ1": 0,
"loseQ1": 0,
"drawQ1": 0,
"scoreQ1": 0,
"score_avgQ1": null,
"winQ2": 0,
"loseQ2": 0,
"drawQ2": 0,
"scoreQ2": 0,
"score_avgQ2": null,
"winQ3": 0,
"loseQ3": 0,
"drawQ3": 0,
"scoreQ3": 0,
"score_avgQ3": null,
"winQ4": 0,
"loseQ4": 0,
"drawQ4": 0,
"scoreQ4": 0,
"score_avgQ4": null,
"winOT1": 0,
"loseOT1": 0,
"drawOT1": 0,
"scoreOT1": 0,
"score_avgOT1": null,
"winOT2": 0,
"loseOT2": 0,
"drawOT2": 0,
"scoreOT2": 0,
"score_avgOT2": null,
"winOT3": 0,
"loseOT3": 0,
"drawOT3": 0,
"scoreOT3": 0,
"score_avgOT3": null,
"winOT4": 0,
"loseOT4": 0,
"drawOT4": 0,
"scoreOT4": 0,
"score_avgOT4": null
},
{
"team": "BETCITY PARMA",
"winQ1": 0,
"loseQ1": 0,
"drawQ1": 0,
"scoreQ1": 0,
"score_avgQ1": null,
"winQ2": 0,
"loseQ2": 0,
"drawQ2": 0,
"scoreQ2": 0,
"score_avgQ2": null,
"winQ3": 0,
"loseQ3": 0,
"drawQ3": 0,
"scoreQ3": 0,
"score_avgQ3": null,
"winQ4": 0,
"loseQ4": 0,
"drawQ4": 0,
"scoreQ4": 0,
"score_avgQ4": null,
"winOT1": 0,
"loseOT1": 0,
"drawOT1": 0,
"scoreOT1": 0,
"score_avgOT1": null,
"winOT2": 0,
"loseOT2": 0,
"drawOT2": 0,
"scoreOT2": 0,
"score_avgOT2": null,
"winOT3": 0,
"loseOT3": 0,
"drawOT3": 0,
"scoreOT3": 0,
"score_avgOT3": null,
"winOT4": 0,
"loseOT4": 0,
"drawOT4": 0,
"scoreOT4": 0,
"score_avgOT4": null
}
]

View File

@@ -1 +0,0 @@
[]

View File

@@ -1 +0,0 @@
[]

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,296 +0,0 @@
[
{
"name": "points",
"nameGFX_rus": "Очки",
"nameGFX_eng": "points",
"val1": "103",
"val2": "83"
},
{
"name": "goal2",
"nameGFX_rus": "",
"nameGFX_eng": "",
"val1": "28",
"val2": "25"
},
{
"name": "shot2",
"nameGFX_rus": "",
"nameGFX_eng": "",
"val1": "42",
"val2": "43"
},
{
"name": "goal3",
"nameGFX_rus": "",
"nameGFX_eng": "",
"val1": "9",
"val2": "7"
},
{
"name": "shot3",
"nameGFX_rus": "",
"nameGFX_eng": "",
"val1": "24",
"val2": "17"
},
{
"name": "goal1",
"nameGFX_rus": "",
"nameGFX_eng": "",
"val1": "20",
"val2": "12"
},
{
"name": "shot1",
"nameGFX_rus": "",
"nameGFX_eng": "",
"val1": "21",
"val2": "16"
},
{
"name": "assist",
"nameGFX_rus": "Передачи",
"nameGFX_eng": "assists",
"val1": "29",
"val2": "24"
},
{
"name": "pass",
"nameGFX_rus": "",
"nameGFX_eng": "",
"val1": "32",
"val2": "24"
},
{
"name": "steal",
"nameGFX_rus": "Перехваты",
"nameGFX_eng": "steals",
"val1": "10",
"val2": "9"
},
{
"name": "block",
"nameGFX_rus": "Блокшоты",
"nameGFX_eng": "blocks",
"val1": "3",
"val2": "0"
},
{
"name": "blocked",
"nameGFX_rus": "",
"nameGFX_eng": "",
"val1": "0",
"val2": "3"
},
{
"name": "defReb",
"nameGFX_rus": "подборы в защите",
"nameGFX_eng": "",
"val1": "19",
"val2": "15"
},
{
"name": "offReb",
"nameGFX_rus": "подборы в нападении",
"nameGFX_eng": "",
"val1": "14",
"val2": "8"
},
{
"name": "foulsOn",
"nameGFX_rus": "",
"nameGFX_eng": "",
"val1": "24",
"val2": "23"
},
{
"name": "turnover",
"nameGFX_rus": "Потери",
"nameGFX_eng": "turnovers",
"val1": "16",
"val2": "19"
},
{
"name": "foul",
"nameGFX_rus": "Фолы",
"nameGFX_eng": "fouls",
"val1": "23",
"val2": "24"
},
{
"name": "foulT",
"nameGFX_rus": "",
"nameGFX_eng": "",
"val1": "0",
"val2": "0"
},
{
"name": "foulD",
"nameGFX_rus": "",
"nameGFX_eng": "",
"val1": "0",
"val2": "0"
},
{
"name": "foulC",
"nameGFX_rus": "",
"nameGFX_eng": "",
"val1": "0",
"val2": "0"
},
{
"name": "foulB",
"nameGFX_rus": "",
"nameGFX_eng": "",
"val1": "0",
"val2": "0"
},
{
"name": "second",
"nameGFX_rus": "секунды",
"nameGFX_eng": "seconds",
"val1": "12000",
"val2": "12000"
},
{
"name": "dunk",
"nameGFX_rus": "данки",
"nameGFX_eng": "dunks",
"val1": "7",
"val2": "4"
},
{
"name": "fastBreak",
"nameGFX_rus": "",
"nameGFX_eng": "fast breaks",
"val1": "6",
"val2": "4"
},
{
"name": "plusMinus",
"nameGFX_rus": "+/-",
"nameGFX_eng": "+/-",
"val1": "100",
"val2": "-100"
},
{
"name": "pt-1",
"nameGFX_rus": "Штрафные",
"nameGFX_eng": "free throws",
"val1": "20/21",
"val2": "12/16"
},
{
"name": "pt-2",
"nameGFX_rus": "2-очковые",
"nameGFX_eng": "2-points",
"val1": "28/42",
"val2": "25/43"
},
{
"name": "pt-3",
"nameGFX_rus": "3-очковые",
"nameGFX_eng": "3-points",
"val1": "9/24",
"val2": "7/17"
},
{
"name": "fg",
"nameGFX_rus": "очки с игры",
"nameGFX_eng": "field goals",
"val1": "37/66",
"val2": "32/60"
},
{
"name": "pt-1_pro",
"nameGFX_rus": "штрафные, процент",
"nameGFX_eng": "free throws pro",
"val1": "95%",
"val2": "75%"
},
{
"name": "pt-2_pro",
"nameGFX_rus": "2-очковые, процент",
"nameGFX_eng": "2-points pro",
"val1": "67%",
"val2": "58%"
},
{
"name": "pt-3_pro",
"nameGFX_rus": "3-очковые, процент",
"nameGFX_eng": "3-points pro",
"val1": "38%",
"val2": "41%"
},
{
"name": "fg_pro",
"nameGFX_rus": "Очки с игры, процент",
"nameGFX_eng": "field goals pro",
"val1": "56%",
"val2": "53%"
},
{
"name": "Reb",
"nameGFX_rus": "Подборы",
"nameGFX_eng": "rebounds",
"val1": "33",
"val2": "23"
},
{
"name": "avgAge",
"nameGFX_rus": "",
"nameGFX_eng": "avg Age",
"val1": "26.8",
"val2": "25.4"
},
{
"name": "ptsStart",
"nameGFX_rus": "",
"nameGFX_eng": "Start PTS",
"val1": "74",
"val2": "51"
},
{
"name": "ptsStart_pro",
"nameGFX_rus": "",
"nameGFX_eng": "Start PTS, %",
"val1": "72%",
"val2": "61%"
},
{
"name": "ptsBench",
"nameGFX_rus": "",
"nameGFX_eng": "Bench PTS",
"val1": "29",
"val2": "32"
},
{
"name": "ptsBench_pro",
"nameGFX_rus": "",
"nameGFX_eng": "Bench PTS, %",
"val1": "28%",
"val2": "39%"
},
{
"name": "avgHeight",
"nameGFX_rus": "",
"nameGFX_eng": "avg height",
"val1": "198.8 cm",
"val2": "201.1 cm"
},
{
"name": "timeout_left",
"nameGFX_rus": "",
"nameGFX_eng": "timeout left",
"val1": "2",
"val2": "1"
},
{
"name": "timeout_str",
"nameGFX_rus": "",
"nameGFX_eng": "timeout str",
"val1": "2 Time-outs left in 2nd half",
"val2": "1 Time-out left in 2nd half"
}
]

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff