Compare commits
74 Commits
pr-1
...
56e68ed751
| Author | SHA1 | Date | |
|---|---|---|---|
| 56e68ed751 | |||
| 00bbe05b1c | |||
| e373c6b274 | |||
| e80ee6bf8f | |||
| a25be482b0 | |||
| 4e8cb48c82 | |||
| bc82fcd6b8 | |||
| 5d238cb6b8 | |||
| fe4c9aab3d | |||
| 9e8a60dfa1 | |||
| 7fe4e03945 | |||
| ffcfa12d4c | |||
|
|
f7e80811a0 | ||
| c86a93c153 | |||
| 43eb1d421d | |||
| c2568c86ef | |||
| cf46fdfbb7 | |||
| 791d20139d | |||
| c3a6626d6f | |||
| 5960e44b17 | |||
| 919d64ca5e | |||
| 2cfa5f1fa4 | |||
| 9b45a3f26f | |||
| 3dfc40cdb0 | |||
|
|
13f6e2e3b9 | ||
|
|
9a007f504c | ||
|
|
b5fdbb3230 | ||
| be951d296f | |||
| 6e1e8ccc7d | |||
| 03463905ef | |||
| 35db71b8cc | |||
| f65a174089 | |||
| bdfa31c8ea | |||
| 206f7d6fb3 | |||
| df0e47c610 | |||
| 3b9aa8150b | |||
| bc557b35af | |||
| 4987dc4cf7 | |||
| 48825185b8 | |||
| 42c60f9db5 | |||
| 504702700c | |||
| ca961320e7 | |||
| 56f90efe40 | |||
| 72141768d4 | |||
| 67307f216f | |||
| 65ec7ff73d | |||
| b6ae33861e | |||
| 69e911b1b8 | |||
| 4893715118 | |||
| 00a30695b7 | |||
| 8689426ae3 | |||
| a372459298 | |||
| 8a0c9ae9b8 | |||
| c1facf00fb | |||
| 96e2c53484 | |||
| 0b52d5b527 | |||
| 5f13949cd4 | |||
| c35da4a043 | |||
| 4eb107d3ad | |||
| dc845cf884 | |||
| 5c149761e3 | |||
| 76db85765c | |||
| a707edcb30 | |||
| 6175f7171f | |||
|
|
ca58821361 | ||
| b5ebcfbe68 | |||
| 21cd2c05a6 | |||
| 2ab09603e4 | |||
| d4d24bf7c2 | |||
| 3cfb3eff7b | |||
|
|
29f6186e8c | ||
| c5883be6da | |||
| 58ace0340e | |||
| 200dda9ab3 |
6
.editorconfig
Normal file
@@ -0,0 +1,6 @@
|
||||
[*]
|
||||
end_of_line = crlf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
indent_style = tab
|
||||
15
.gitignore
vendored
@@ -360,4 +360,17 @@ MigrationBackup/
|
||||
.ionide/
|
||||
|
||||
# Fody - auto-generated XML schema
|
||||
FodyWeavers.xsd
|
||||
FodyWeavers.xsd
|
||||
|
||||
# Wirtualne środowisko pythona
|
||||
FlaskWebProject/env
|
||||
.venv
|
||||
|
||||
# Wersja pythona
|
||||
FlaskWebProject/FlaskWebProject.pyproj
|
||||
|
||||
# Baza sqlite
|
||||
FlaskWebProject/FlaskWebProject/instance
|
||||
|
||||
# Poufne dane
|
||||
config.toml
|
||||
@@ -7,17 +7,30 @@
|
||||
<ProjectGuid>89df7a6e-dc87-40f3-8b4b-f609a6e889d1</ProjectGuid>
|
||||
<ProjectHome>.</ProjectHome>
|
||||
<ProjectTypeGuids>{789894c7-04a9-4a11-a6b5-3f4435165112};{1b580a1a-fdb3-4b32-83e1-6407eb2722e6};{349c5851-65df-11da-9384-00065b846f21};{888888a0-9f3d-457c-b088-3a5042f75d52}</ProjectTypeGuids>
|
||||
<StartupFile>runserver.py</StartupFile>
|
||||
<StartupFile>FlaskWebProject\lewy.py</StartupFile>
|
||||
<SearchPath>
|
||||
</SearchPath>
|
||||
<WorkingDirectory>.</WorkingDirectory>
|
||||
<WorkingDirectory>.\FlaskWebProject\</WorkingDirectory>
|
||||
<LaunchProvider>Web launcher</LaunchProvider>
|
||||
<WebBrowserUrl>http://localhost</WebBrowserUrl>
|
||||
<WebBrowserUrl>http://127.0.0.1</WebBrowserUrl>
|
||||
<OutputPath>.</OutputPath>
|
||||
<SuppressCollectPythonCloudServiceFiles>true</SuppressCollectPythonCloudServiceFiles>
|
||||
<Name>FlaskWebProject</Name>
|
||||
<RootNamespace>FlaskWebProject</RootNamespace>
|
||||
<InterpreterId>MSBuild|env|$(MSBuildProjectFullPath)</InterpreterId>
|
||||
<PythonRunWebServerCommandEnvironment>
|
||||
</PythonRunWebServerCommandEnvironment>
|
||||
<PythonDebugWebServerCommandEnvironment>
|
||||
</PythonDebugWebServerCommandEnvironment>
|
||||
<IsWindowsApplication>False</IsWindowsApplication>
|
||||
<WebBrowserPort>5000</WebBrowserPort>
|
||||
<Environment>
|
||||
</Environment>
|
||||
<PythonRunWebServerCommandArguments>
|
||||
</PythonRunWebServerCommandArguments>
|
||||
<PythonDebugWebServerCommandArguments>
|
||||
</PythonDebugWebServerCommandArguments>
|
||||
<CommandLineArguments>-i 127.0.0.1 -p 5000</CommandLineArguments>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -28,9 +41,14 @@
|
||||
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="FlaskWebProject\fs_scraper.py" />
|
||||
<Compile Include="FlaskWebProject\lewy.py" />
|
||||
<Compile Include="FlaskWebProject\lewy_api.py" />
|
||||
<Compile Include="FlaskWebProject\lewy_api_v1.py" />
|
||||
<Compile Include="FlaskWebProject\lewy_db.py" />
|
||||
<Compile Include="FlaskWebProject\lewy_globals.py" />
|
||||
<Compile Include="FlaskWebProject\lewy_routes.py" />
|
||||
<Compile Include="runserver.py" />
|
||||
<Compile Include="FlaskWebProject\__init__.py" />
|
||||
<Compile Include="FlaskWebProject\views.py" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="FlaskWebProject\" />
|
||||
@@ -41,6 +59,12 @@
|
||||
<Folder Include="FlaskWebProject\templates\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="FlaskWebProject\config.toml" />
|
||||
<Content Include="FlaskWebProject\static\script.js" />
|
||||
<Content Include="FlaskWebProject\static\style.css" />
|
||||
<Content Include="FlaskWebProject\templates\base.html" />
|
||||
<Content Include="FlaskWebProject\templates\matches.html" />
|
||||
<Content Include="FlaskWebProject\templates\stats.html" />
|
||||
<Content Include="requirements.txt" />
|
||||
<Content Include="FlaskWebProject\static\content\bootstrap.css" />
|
||||
<Content Include="FlaskWebProject\static\content\bootstrap.min.css" />
|
||||
@@ -64,10 +88,7 @@
|
||||
<Content Include="FlaskWebProject\static\scripts\respond.js" />
|
||||
<Content Include="FlaskWebProject\static\scripts\respond.min.js" />
|
||||
<Content Include="FlaskWebProject\static\scripts\_references.js" />
|
||||
<Content Include="FlaskWebProject\templates\about.html" />
|
||||
<Content Include="FlaskWebProject\templates\contact.html" />
|
||||
<Content Include="FlaskWebProject\templates\index.html" />
|
||||
<Content Include="FlaskWebProject\templates\layout.html" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Interpreter Include="env\">
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
"""
|
||||
The flask application package.
|
||||
"""
|
||||
|
||||
from flask import Flask
|
||||
app = Flask(__name__)
|
||||
|
||||
import FlaskWebProject.views
|
||||
31
FlaskWebProject/FlaskWebProject/config.example.toml
Normal file
@@ -0,0 +1,31 @@
|
||||
[general]
|
||||
db_path_url = "postgresql+psycopg2://user:password@hostname/database_name"
|
||||
db_prefix = "" # What (if any) prefix will be appended to table names.
|
||||
is_proxied = false # Will ignore discrepancies between retrieved IP and public-facing URL.
|
||||
public_facing_url = "http://127.0.0.1:5000/" # Used for URL rewriting. Note the trailing forward slash /.
|
||||
|
||||
[api]
|
||||
# Leave empty to automatically generate API key every launch (insecure).
|
||||
api_key = ""
|
||||
|
||||
[scraper]
|
||||
user-agent = "" # Leave empty for default (Firefox ESR).
|
||||
|
||||
[sportsmen]
|
||||
tracked_ids = [
|
||||
"MVC8zHZD", # Robert Lewandowski
|
||||
"WGOY4FSt", # Cristiano Ronaldo
|
||||
"vgOOdZbd", # Lionel Messi
|
||||
"Wn6E2SED", # Kylian Mbappe
|
||||
"AiH2zDve", # Zlatan Ibrahimovic
|
||||
"dUShzrBp", # Luis Suarez
|
||||
"UmV9iQmE", # Erling Haaland
|
||||
"tpV0VX0S", # Karim Benzema
|
||||
"vw8ZV7HC", # Sergio Aguero
|
||||
"Qgx2trzH", # Edinson Cavani
|
||||
"2oMimkAU", # Radamel Falcao
|
||||
"WfXv1DCa", # Wayne Rooney
|
||||
"0vgcq6un", # Robin van Persie
|
||||
"v5HSlEAa", # Harry Kane
|
||||
"4S9fNUYh" # Ciro Immobile
|
||||
]
|
||||
269
FlaskWebProject/FlaskWebProject/fs_scraper.py
Normal file
@@ -0,0 +1,269 @@
|
||||
from flask import session
|
||||
from lewy_db import baza as ldb
|
||||
from lewy_globals import colors as c
|
||||
from lewy_globals import safeTraverse as safe_traverse
|
||||
import json
|
||||
import lewy_globals
|
||||
import requests
|
||||
import time
|
||||
from sqlalchemy import func
|
||||
|
||||
class scraper:
|
||||
|
||||
headers = {
|
||||
'x-fsign': 'SW9D1eZo'
|
||||
}
|
||||
|
||||
db = None
|
||||
|
||||
def __init__(self):
|
||||
self.db = lewy_globals.getDb()
|
||||
pass
|
||||
|
||||
def pobierzDaneNajlepszegoSportowcaNaSwiecie(self) -> dict:
|
||||
response = requests.get('https://3.flashscore.ninja/3/x/feed/plm_MVC8zHZD_0', headers=headers)
|
||||
return json.loads(response.text)
|
||||
|
||||
def pobierz_pojedyncza_strone(self, zewnetrzne_id_sportowca: str = "MVC8zHZD", nr_strony: int = 0) -> dict:
|
||||
if len(zewnetrzne_id_sportowca) != 8:
|
||||
raise ValueError("Zewnętrzne ID sportowca powinno być długości 8!")
|
||||
response = requests.get(f'https://3.flashscore.ninja/3/x/feed/plm_{zewnetrzne_id_sportowca}_{nr_strony}', headers=self.headers)
|
||||
return json.loads(response.text)
|
||||
|
||||
def __czy_x_istnieje(self, typ, **id):
|
||||
rekord = self.db.simple_select_all(typ, **id)
|
||||
if rekord is not None and rekord != []:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def to_iso_compatible_date(self, dmy_date: str):
|
||||
"""
|
||||
Zamienia datę z formatu DD.MM.YY na YYYY-MM-DD
|
||||
|
||||
:param dmy_date: Data w formacie DD.MM.YY
|
||||
:type dmy_date: str
|
||||
"""
|
||||
day, month, year = dmy_date.split(".")
|
||||
return f"{2000 + int(year)}-{month}-{day}"
|
||||
|
||||
|
||||
def czy_mecz_istnieje(self, zewnetrzne_id_meczu: str):
|
||||
return self.__czy_x_istnieje("mecze", zewnetrzne_id_meczu=zewnetrzne_id_meczu)
|
||||
|
||||
def czy_klub_istnieje(self, id_klubu: str):
|
||||
return self.__czy_x_istnieje("kluby", id_klubu=id_klubu)
|
||||
|
||||
def czy_nie_trzeba_pobierac_nowych_meczy_zawodnika(self, id_zawodnika: int, zewnetrzne_id_meczu: str):
|
||||
return self.__czy_x_istnieje("sportowcy_w_meczach", id_zawodnika=id_zawodnika, zewnetrzne_id_meczu=zewnetrzne_id_meczu)
|
||||
|
||||
def id_na_imie_nazwisko_urodziny(self, zewnetrzne_id_sportowca: str = "MVC8zHZD"):
|
||||
"""
|
||||
Scraper z dykty xD
|
||||
Pobiera imiona, nazwiska i dni urodzin sportowców z zewnętrznego id.
|
||||
Działa na słowo honoru.
|
||||
|
||||
:param zewnetrzne_id_sportowca: Zewnętrzne id sportowca
|
||||
:type zewnetrzne_id_sportowca: str
|
||||
"""
|
||||
if len(zewnetrzne_id_sportowca) != 8:
|
||||
raise ValueError("Zewnętrzne ID sportowca powinno być długości 8!")
|
||||
r = requests.get(f'https://www.flashscore.pl/?r=4:{zewnetrzne_id_sportowca}')
|
||||
page = r.text
|
||||
|
||||
name_start_pos = page.find("data-testid=\"wcl-scores-heading-02\">") + 36
|
||||
name_end_pos = page.find("</", name_start_pos)
|
||||
name = page[name_start_pos:name_end_pos].strip().split(' ')
|
||||
|
||||
# Tak wiem... można by było użyć beautifulsoup4, ale nie ma sensu dodawać nowych zależności dla tylko jednej metody.
|
||||
birthday_start_pos_1 = page.find("data-testid=\"wcl-scores-simpleText-01\">", name_end_pos) + 39
|
||||
birthday_start_pos_2 = page.find("data-testid=\"wcl-scores-simpleText-01\">", birthday_start_pos_1) + 39
|
||||
birthday_start_pos_3 = page.find("data-testid=\"wcl-scores-simpleText-01\">", birthday_start_pos_2) + 39
|
||||
birthday_start_pos = page.find("data-testid=\"wcl-scores-simpleText-01\">", birthday_start_pos_3) + 39
|
||||
birthday_end_pos = page.find("</", birthday_start_pos) - 1
|
||||
birthday = None if birthday_end_pos - birthday_start_pos > 20 else page[birthday_start_pos:birthday_end_pos].strip(" ()")
|
||||
|
||||
return name, birthday
|
||||
|
||||
def aktualizuj_dane_sportowca(self, zewnetrzne_id_sportowca: str = "MVC8zHZD"):
|
||||
stop_scraping = False
|
||||
matches_to_add = []
|
||||
|
||||
# TODO: Sprawdź, czy sportowiec istnieje w bazie.
|
||||
# Jeśli nie, dodaj go w podobny sposób, jak
|
||||
# w sample_data_init() (w lewy_db.py).
|
||||
# -- Jednak tego tak nie robimy, ponieważ nie uzyskamy wielu informacji.
|
||||
|
||||
id_zawodnika = self.db.get_id_zawodnika_by_zewnetrzne_id(zewnetrzne_id_sportowca)
|
||||
zawodnik = self.db.simple_select_all("sportowcy", zewnetrzne_id_zawodnika=zewnetrzne_id_sportowca)[0]
|
||||
|
||||
page = 0
|
||||
match_num = 0
|
||||
while not stop_scraping:
|
||||
|
||||
retrieved_page = self.pobierz_pojedyncza_strone(zewnetrzne_id_sportowca=zewnetrzne_id_sportowca, nr_strony=page)
|
||||
if not safe_traverse(retrieved_page, ["hasMoreLastMatches"], default=False):
|
||||
stop_scraping = True
|
||||
break
|
||||
|
||||
print(f"{c.WARNING}Pobrano nową stronę {page}{c.ENDC}:\n{retrieved_page}")
|
||||
|
||||
retrieved_matches = safe_traverse(retrieved_page, ["lastMatches"], default=[])
|
||||
for match in retrieved_matches:
|
||||
|
||||
match_id = safe_traverse(match, ["eventEncodedId"], default="non-existent-match-id")
|
||||
home_club_id = safe_traverse(match, ["homeParticipantUrl"], default="non-existent-club-id")
|
||||
away_club_id = safe_traverse(match, ["awayParticipantUrl"], default="non-existent-club-id")
|
||||
|
||||
# ~Sprawdź, czy mecz nie znajduje się już w bazie~
|
||||
#
|
||||
# UWAGA! Nie powinniśmy tego sprawdzać jak w komentarzu poniżej!
|
||||
# To sprawdzenie powinno jedynie służyć zapobieganiu dodania istniejących meczy,
|
||||
# natomiast istniejący mecz nie oznacza, że sportowiec ma już statystykę z niego!
|
||||
# Przerwać scrapowanie należy wtedy, gdy znajdzie się statystykę sportowca
|
||||
# z bieżącego meczu, a nie kiedy znajdzie się bieżący mecz w bazie!
|
||||
#
|
||||
# if self.czy_mecz_istnieje(zewnetrzne_id_meczu=match_id):
|
||||
# stop_scraping = True
|
||||
# break
|
||||
#
|
||||
# Rozwiązanie jest mocno nieefektywne przy scrapowaniu całej bazy od zera,
|
||||
# ale rozwiąże przypadki, w których zawodnicy, których śledzimy, grali przeciwko sobie.
|
||||
if self.czy_nie_trzeba_pobierac_nowych_meczy_zawodnika(id_zawodnika=id_zawodnika, zewnetrzne_id_meczu=match_id):
|
||||
stop_scraping = True
|
||||
break
|
||||
|
||||
if self.czy_mecz_istnieje(zewnetrzne_id_meczu=match_id):
|
||||
# Nie scrapuj istniejących meczy.
|
||||
# Naturalnie, istniejący mecz nie musi oznaczać potrzeby zakończenia scrapowania.
|
||||
continue
|
||||
|
||||
# Sprawdź, czy klub znajduje się już w bazie. Jeśli nie,
|
||||
# trzeba go dodać przed meczem.
|
||||
if not self.czy_klub_istnieje(id_klubu=home_club_id):
|
||||
print(f"{c.OKCYAN}Nowy klub{c.ENDC}: {home_club_id}")
|
||||
self.db.simple_insert_one("kluby",
|
||||
id_klubu=home_club_id,
|
||||
pelna_nazwa=safe_traverse(match, ["homeParticipantName"]),
|
||||
skrocona_nazwa=safe_traverse(match, ["homeParticipant3CharName"]))
|
||||
if not self.czy_klub_istnieje(id_klubu=away_club_id):
|
||||
print(f"{c.OKCYAN}Nowy klub{c.ENDC}: {away_club_id}")
|
||||
self.db.simple_insert_one("kluby",
|
||||
id_klubu=away_club_id,
|
||||
pelna_nazwa=safe_traverse(match, ["awayParticipantName"]),
|
||||
skrocona_nazwa=safe_traverse(match, ["awayParticipant3CharName"]))
|
||||
|
||||
# TODO: dodaj obiekt mecz do bazy (simple_insert_one(), simple_insert_many())
|
||||
print(f"{c.OKCYAN}Nowy mecz ({match_num}){c.ENDC}: {match}")
|
||||
|
||||
iso_converted_date = self.to_iso_compatible_date(safe_traverse(match, ["eventStartTime"], default="1970-01-01"))
|
||||
|
||||
self.db.simple_insert_one("mecze",
|
||||
zewnetrzne_id_meczu = safe_traverse(match, ["eventEncodedId"], default=""),
|
||||
data = iso_converted_date,
|
||||
gospodarze_id = home_club_id,
|
||||
gospodarze = self.db.simple_select_all("kluby", id_klubu=home_club_id)[0],
|
||||
goscie_id = away_club_id,
|
||||
goscie = self.db.simple_select_all("kluby", id_klubu=away_club_id)[0],
|
||||
gosp_wynik = safe_traverse(match, ["homeScore"], default=0),
|
||||
gosc_wynik = safe_traverse(match, ["awayScore"], default=0),
|
||||
sezon = safe_traverse(match, ["tournamentSeason"], default=""),
|
||||
nazwa_turnieju = safe_traverse(match, ["tournamentTitle"], default=""),
|
||||
skrocona_nazwa_turnieju = safe_traverse(match, ["tournamentTemplateShortCode"], default=""),
|
||||
flaga = safe_traverse(match, ["flagId"], default=0),
|
||||
)
|
||||
match_num += 1
|
||||
|
||||
stats = safe_traverse(match, ["stats"], default="")
|
||||
zewnetrzne_id_meczu = safe_traverse(match, ["eventEncodedId"], default="")
|
||||
|
||||
if stats != False: # gdy sportowiec był aktywny w meczu
|
||||
# print("todo :)")
|
||||
self.db.simple_insert_one("sportowcy_w_meczach",
|
||||
id_zawodnika = id_zawodnika,
|
||||
zawodnik = zawodnik,
|
||||
zewnetrzne_id_meczu = zewnetrzne_id_meczu,
|
||||
# Uwaga! Czasami przygłupy z flashscore zwracają puste pole '' zamiast zera, np. do liczby strzelonych goli.
|
||||
# Dlatego int("0" + "") = int("0"), co zapobiegnie wysypaniu się przy int("").
|
||||
czas_gry = int("0" + safe_traverse(stats, ["595", "value"], default="0").rstrip("'?")),
|
||||
goli = int("0" + safe_traverse(stats, ["596", "value"], default="0")),
|
||||
asyst = int("0" + safe_traverse(stats, ["541", "value"], default="0")),
|
||||
interwencje_bramkarza = 0,
|
||||
suma_interwencji_na_bramke = 0,
|
||||
zolte_kartki = int("0" + safe_traverse(stats, ["599", "value"], default="0")),
|
||||
czerwone_kartki = int("0" + safe_traverse(stats, ["600", "value"], default="0")),
|
||||
wygrana = {"Z": 1, "R": 0, "P": -1}.get(safe_traverse(match, ["winLoseShort"], default=""), 0),
|
||||
wynik = safe_traverse(match, ["rating"], default=0) or 0
|
||||
)
|
||||
|
||||
# # analogicznie zinkrementuj statystyki_sportowcow:
|
||||
# # aby to zrobić, najpierw pobierz najnowszą statystykę sportowca
|
||||
# # ...
|
||||
#
|
||||
#
|
||||
# # a następnie użyj funkcji w lewy_db do inkrementowania danych
|
||||
# # (póki co jeszcze takiej nie ma)
|
||||
# self.db.simple_increment_data("statystyki_sportowcow",
|
||||
# id = ... # pewnie id się przyda
|
||||
# sportowiec = zawodnik,
|
||||
# ostatni_mecz = self.db.get_id_meczu_by_zewnetrzne_id(zewnetrzne_id_meczu),
|
||||
# ilosc_wystapien = 1 if int(safe_traverse(stats, ["595", "value"], default="0").rstrip("'")) > 0 else 0,
|
||||
# minut_gry = int(safe_traverse(stats, ["595", "value"], default="0").rstrip("'")),
|
||||
# gier_sum = 1 if int(safe_traverse(stats, ["595", "value"], default="0").rstrip("'")) > 0 else 0,
|
||||
# goli_sum = int(safe_traverse(stats, ["596", "value"], default="0")),
|
||||
# asyst_sum = int(safe_traverse(stats, ["541", "value"], default="0")),
|
||||
# interwencji_sum = 0,
|
||||
# nieobronionych_interwencji_sum = 0,
|
||||
# zoltych_kartek_sum = int(safe_traverse(stats, ["599", "value"], default="0")),
|
||||
# czerwonych_kartek_sum = int(safe_traverse(stats, ["600", "value"], default="0")),
|
||||
# wygranych_sum = 1 if safe_traverse(match, ["winloseshort"], default="") == "z" else 0,
|
||||
# wynik_sum = safe_traverse(match, ["rating"], default=0),
|
||||
# meczow_do_wynikow_sum = 1 if safe_traverse(match, ["rating"], default=0) not in (0, none) else none
|
||||
# )
|
||||
|
||||
else:
|
||||
# print("też todo :)")
|
||||
# # TODO: TU TEŻ TRZEBA POPRAWIĆ ANALOGICZNIE DO TEGO, CO JEST WEWNĄTRZ IF'A
|
||||
self.db.simple_insert_one("sportowcy_w_meczach",
|
||||
id_zawodnika = id_zawodnika,
|
||||
zawodnik = zawodnik,
|
||||
zewnetrzne_id_meczu = zewnetrzne_id_meczu,
|
||||
czas_gry = 0, #(lambda v: int(str(v).rstrip("'")) if isinstance(v, (str, int, float)) and str(v).rstrip("'").lstrip("-").isdigit() else 0)(safe_traverse(stats if isinstance(stats, dict) else {}, ["595", "value"], default="0")),
|
||||
goli = int("0" + safe_traverse(stats, ["596", "value"], default="0")),
|
||||
asyst = int("0" + safe_traverse(stats, ["541", "value"], default="0")),
|
||||
interwencje_bramkarza = 0,
|
||||
suma_interwencji_na_bramke = 0,
|
||||
zolte_kartki = int("0" + safe_traverse(stats, ["599", "value"], default="0")),
|
||||
czerwone_kartki = int("0" + safe_traverse(stats, ["600", "value"], default="0")),
|
||||
wygrana = {"Z": 1, "R": 0, "P": -1}.get(safe_traverse(match, ["winLoseShort"], default=""), 0),
|
||||
wynik = safe_traverse(match, ["rating"], default=0) or 0
|
||||
)
|
||||
|
||||
# TODO: Zaktualizuj statystyki sportowca
|
||||
|
||||
|
||||
# Opcjonalnie: odczekaj kilka sekund (?)
|
||||
# Problem w tym, że time.sleep() jest blokujące,
|
||||
# a asyncio i flask nie idą ze sobą w parze.
|
||||
# Można to załatwić osobnym skryptem, ale
|
||||
# martwmy się tym dopiero, gdy dostaniemy
|
||||
# rate limita. - sherl
|
||||
|
||||
page += 1
|
||||
#time.sleep(5)
|
||||
|
||||
|
||||
def aktualizuj_dane(self):
|
||||
"""
|
||||
Pobiera mecze dla każdego sportowca wymienionego
|
||||
w pliku konfiguracyjnym.
|
||||
"""
|
||||
start_time = time.time()
|
||||
|
||||
for id_sportowca in lewy_globals.config['sportsmen']['tracked_ids']:
|
||||
self.aktualizuj_dane_sportowca(zewnetrzne_id_sportowca=id_sportowca)
|
||||
time.sleep(5)
|
||||
|
||||
end_time = time.time()
|
||||
|
||||
print(f"Scrapowanie trwało {end_time - start_time}s.")
|
||||
177
FlaskWebProject/FlaskWebProject/lewy.py
Normal file
@@ -0,0 +1,177 @@
|
||||
from argparse import ArgumentParser
|
||||
from flask import Flask, Response, render_template
|
||||
from flask_apscheduler import APScheduler
|
||||
from fs_scraper import scraper
|
||||
from lewy_globals import colors as c
|
||||
import lewy_api
|
||||
import lewy_db
|
||||
import lewy_globals
|
||||
import lewy_routes
|
||||
import os
|
||||
import time
|
||||
|
||||
app = Flask(__name__)
|
||||
app_host = "None"
|
||||
app_port = "None"
|
||||
scr = None
|
||||
|
||||
def setup():
|
||||
# sanity check: make sure config is set
|
||||
# required to make `flask --app lewy run --debug` work
|
||||
global config, app_host, app_port, scrape
|
||||
try:
|
||||
if not config['general']:
|
||||
lewy_globals.setConfig(lewy_globals.configfile)
|
||||
config = lewy_globals.config
|
||||
except:
|
||||
lewy_globals.setConfig(lewy_globals.configfile)
|
||||
config = lewy_globals.config
|
||||
|
||||
# setting all the variables
|
||||
lewy_globals.starttime = int(time.time())
|
||||
lewy_globals.realUptime = 0
|
||||
lewy_globals.apiRequests = 0
|
||||
lewy_globals.apiFailedRequests = 0
|
||||
lewy_globals.isProxied = config['general']['is_proxied']
|
||||
lewy_globals.outsideApiHits = 0
|
||||
|
||||
are_we_sure_of_host_and_port = True
|
||||
if app_host == "None":
|
||||
app_host = "127.0.0.1"
|
||||
are_we_sure_of_host_and_port = False
|
||||
if app_port == "None":
|
||||
app_port = "5000"
|
||||
are_we_sure_of_host_and_port = False
|
||||
|
||||
public_facing_url = config['general']['public_facing_url']
|
||||
if len(public_facing_url) >= 4 and public_facing_url[0:5].lower() == "https":
|
||||
https_str = f"{c.OKBLUE}INFO:{c.ENDC} You're trying to run this web server on HTTPS, but currently it's not possible to do that!\n"
|
||||
https_str += f" Please consider running this service behind a reverse proxy if you need HTTPS.\n"
|
||||
print(https_str)
|
||||
rewrite_sanity_check = public_facing_url.replace(f"{app_host}:{app_port}", "")
|
||||
if not config['general']['is_proxied'] and public_facing_url == rewrite_sanity_check:
|
||||
sanity_string = f"{c.OKBLUE}INFO:{c.ENDC} Public facing URL does not match the IP and port the server is running on.\n"
|
||||
sanity_string += f" Expected: {c.OKCYAN}{config['general']['public_facing_url']}{c.ENDC}, but"
|
||||
if not are_we_sure_of_host_and_port: sanity_string += " (assuming it's)"
|
||||
sanity_string += f" running on: {c.OKCYAN}{app_host}:{app_port}{c.ENDC}.\n"
|
||||
sanity_string += f" This is just a sanity check and may not neccessarily mean bad configuration.\n"
|
||||
sanity_string += f" If you're running a reverse proxy, set {c.OKCYAN}is_proxied{c.ENDC} to true to silence this message.\n"
|
||||
print(sanity_string)
|
||||
|
||||
# Should fix disconnects: https://stackoverflow.com/a/61739721
|
||||
app.config['SQLALCHEMY_ENGINE_OPTIONS'] = {"pool_pre_ping": True}
|
||||
app.config['SQLALCHEMY_DATABASE_URI'] = f"{config['general']['db_path_url']}"
|
||||
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
|
||||
|
||||
# Widoki widoczne dla "normalnego" użytkownika:
|
||||
app.add_url_rule('/', view_func=lewy_routes.index)
|
||||
app.add_url_rule('/index.html', view_func=lewy_routes.index)
|
||||
app.add_url_rule('/mecze', view_func=lewy_routes.mecze)
|
||||
app.add_url_rule('/statystyki', view_func=lewy_routes.statystyki)
|
||||
app.add_url_rule('/toggle_dark_mode', view_func=lewy_routes.toggle_dark_mode)
|
||||
app.add_url_rule('/club', view_func=lewy_routes.clubs)
|
||||
app.add_url_rule('/representation', view_func=lewy_routes.representation)
|
||||
app.add_url_rule('/compare', view_func=lewy_routes.compare)
|
||||
app.add_url_rule('/trophies', view_func=lewy_routes.trophies)
|
||||
|
||||
# API:
|
||||
app.add_url_rule('/api/', view_func=lewy_api.api_greeting)
|
||||
app.add_url_rule('/api/<path:received_request>', view_func=lewy_api.api_global_catchall)
|
||||
|
||||
db = lewy_globals.setupDb(app, config)
|
||||
scr = scraper()
|
||||
|
||||
with app.app_context():
|
||||
db.create_all()
|
||||
|
||||
# job scheduler for repetetive tasks
|
||||
scheduler = APScheduler()
|
||||
scheduler.add_job(func=every5seconds, trigger='interval', id='5sec', seconds=5)
|
||||
scheduler.add_job(func=every2hours, trigger='interval', id='2hr', hours=2)
|
||||
scheduler.start()
|
||||
|
||||
# gets called every 5 seconds
|
||||
def every5seconds():
|
||||
# update the "real" uptime counter
|
||||
lewy_globals.realUptime += 5
|
||||
|
||||
def every2hours():
|
||||
# zaktualizuj bazę danych scrapując FS
|
||||
scr.aktualizuj_dane()
|
||||
return
|
||||
|
||||
@app.route('/<string:val>', methods=['GET'])
|
||||
def blank(val):
|
||||
return Response(f"{val}: not implemented in lewangoalski {lewy_globals.getCommitWithFailsafe()}", mimetype="text/plain")
|
||||
|
||||
def main(args):
|
||||
print(f"{c.BOLD + c.HEADER}Witaj w webaplikacji 'lewangoalski' ({lewy_globals.getCommitWithFailsafe()})!{c.ENDC}")
|
||||
print(f"Aby uruchomić w trybie deweloperskim (aby włączyć automatyczne przeładowanie zmian), użyj: {c.OKCYAN}flask --app lewy run --debug{c.ENDC}.")
|
||||
print( "Aby uruchomić lokalnie, użyj adresu IP 127.0.0.1. Aby uruchomić na każdym z interfejsów, użyj 0.0.0.0.\n")
|
||||
|
||||
global config, app_host, app_port
|
||||
try:
|
||||
# if specified, use custom config file
|
||||
lewy_globals.configfile = args.config
|
||||
lewy_globals.setConfig(lewy_globals.configfile)
|
||||
|
||||
except:
|
||||
# if not, try using the default "config.toml"
|
||||
if os.path.exists("config.toml"):
|
||||
lewy_globals.configfile = "config.toml"
|
||||
else:
|
||||
# unless it's not there, if that's the case then use the dummy file
|
||||
lewy_globals.configfile = ""
|
||||
# but try to set the API secret if provided by the user
|
||||
if args.secret:
|
||||
lewy_globals.randomly_generated_passcode = args.secret
|
||||
lewy_globals.setConfig(lewy_globals.configfile)
|
||||
|
||||
config = lewy_globals.config
|
||||
|
||||
try:
|
||||
host = args.ip
|
||||
port = args.port
|
||||
if not host or not port:
|
||||
raise Exception
|
||||
except:
|
||||
config_ip, config_port = lewy_globals.extractIpAndPortFromPublicUrl()
|
||||
print(f"Wpisz nazwę_hosta:port, na których należy uruchomić serwer Flask [domyślnie: {config_ip}:{config_port}]:")
|
||||
try:
|
||||
host_port = input('> ').split(':')
|
||||
if host_port == ['']:
|
||||
host_port = [config_ip, config_port] # defaults
|
||||
|
||||
except KeyboardInterrupt:
|
||||
print(" ...wychodzę z programu."), quit() # handle Ctrl+C
|
||||
|
||||
host = host_port[0]
|
||||
port = host_port[1]
|
||||
|
||||
print()
|
||||
|
||||
app_host = host
|
||||
app_port = port
|
||||
|
||||
setup()
|
||||
app.run(host=host, port=int(port))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
#app.run(host="127.0.0.1", port=5000)
|
||||
#app.run(host="0.0.0.0", port=5000)
|
||||
parser = ArgumentParser(description='Aplikacja webowa do śledzenia statystyk Roberta Lewandowskiego.')
|
||||
|
||||
parser.add_argument("-i", "--ip", dest="ip", help="ip address/interface to bind to")
|
||||
parser.add_argument("-p", "--port", dest="port", help="port on which the flask web backend should be ran")
|
||||
parser.add_argument("-c", "--config", dest="config", help="path to TOML config file")
|
||||
parser.add_argument("-s", "--secret", dest="secret", help="API key for resource access") # NOT tested
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
main(args)
|
||||
|
||||
else:
|
||||
app_host = os.getenv("FLASK_RUN_HOST", "None")
|
||||
app_port = os.getenv("FLASK_RUN_PORT", "None")
|
||||
setup()
|
||||
43
FlaskWebProject/FlaskWebProject/lewy_api.py
Normal file
@@ -0,0 +1,43 @@
|
||||
from flask import Response, request
|
||||
from lewy_globals import colors as c
|
||||
from markupsafe import escape
|
||||
import json
|
||||
import lewy_globals
|
||||
import lewy_api_v1
|
||||
import requests
|
||||
import time
|
||||
import traceback
|
||||
|
||||
def api_greeting():
|
||||
string = {'status': 200, 'msg': f"ok (lewangoalski {lewy_globals.version})", 'latest_api': f"v{lewy_globals.apiVersion}"}
|
||||
string = json.dumps(string)
|
||||
return Response(string, mimetype='application/json')
|
||||
|
||||
def api_global_catchall(received_request):
|
||||
lewy_globals.apiRequests += 1
|
||||
if request.environ['REMOTE_ADDR'] != "127.0.0.1" or (lewy_globals.isProxied and request.environ['X-Forwarded-For'] != "127.0.0.1"):
|
||||
lewy_globals.outsideApiHits += 1
|
||||
|
||||
request_list = received_request.split('/')
|
||||
api_version = request_list[0]
|
||||
if request_list[0] == 'v1':
|
||||
# use v1 api
|
||||
del request_list[0]
|
||||
# if list is empty, aka /api/v1/, or /api/v1
|
||||
if request_list == [''] or request_list == []:
|
||||
resp = api_greeting()
|
||||
try:
|
||||
status, received, data = lewy_api_v1.lookup(request_list, request)
|
||||
except Exception as e:
|
||||
lewy_globals.apiFailedRequests += 1
|
||||
stripped_filename = __file__[max(__file__.rfind("/"), __file__.rfind("\\")) + 1:]
|
||||
print(f"\n{c.FAIL}Error! /api/{received_request} -> {stripped_filename}:L{e.__traceback__.tb_lineno} -> {type(e).__name__}{c.ENDC}:")
|
||||
print(traceback.format_exc())
|
||||
status, received, data = 500, f"internal server error: call ended in failure: {e} ({stripped_filename}:L{e.__traceback__.tb_lineno})", []
|
||||
resp = Response(json.dumps({'status': status, 'msg': received, 'data': data}), mimetype='application/json', status=status)
|
||||
else:
|
||||
lewy_globals.apiFailedRequests += 1
|
||||
status, received, data = 405, f'error: unsupported api version: "{request_list[0]}". try: "v{lewy_globals.apiVersion}".', []
|
||||
resp = Response(json.dumps({'status': status, 'msg': received, 'data': data}), mimetype='application/json', status=status)
|
||||
|
||||
return resp
|
||||
190
FlaskWebProject/FlaskWebProject/lewy_api_v1.py
Normal file
@@ -0,0 +1,190 @@
|
||||
# API is expected to return a tuple of:
|
||||
# - HTTP status code,
|
||||
# - human-readable status message,
|
||||
# - json with appropriate data
|
||||
from datetime import datetime
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
from fs_scraper import scraper
|
||||
from functools import wraps
|
||||
from lewy_globals import getDb, colors as c
|
||||
import flask, json, time
|
||||
import lewy_db as ldb
|
||||
import lewy_globals
|
||||
|
||||
def require_authentication(func):
|
||||
"""
|
||||
Ten dekorator służy do wymuszenia parametru "token"
|
||||
podczas obsługi zapytania. Powinien on zostać doklejony
|
||||
do żądania, np. /api/v1/halt?token=XXX...
|
||||
Wartość tokenu jest pobierana z pola api_key w config.toml.
|
||||
Jeżeli skrypt jej tam nie znajdzie, jest generowana losowo
|
||||
na starcie i drukowana w terminalu.
|
||||
"""
|
||||
@wraps(func)
|
||||
def wrapper(*args, **kwargs):
|
||||
token = kwargs["r"].args.get('token')
|
||||
if token == lewy_globals.config['api']['api_key']:
|
||||
try:
|
||||
status, received, data = func(*args, **kwargs)
|
||||
return status, received, data
|
||||
except:
|
||||
raise AssertionError(f"Function \"{func.__name__}\" does not return status, code, and data as it should!")
|
||||
else:
|
||||
increment_bad_requests()
|
||||
return 401, "error", {'error_msg': "Unauthorized"}
|
||||
return wrapper
|
||||
|
||||
def increment_bad_requests():
|
||||
"""
|
||||
Zwiększa globalny, tymczasowy licznik nieprawidłowych zapytań.
|
||||
"""
|
||||
lewy_globals.apiFailedRequests += 1
|
||||
|
||||
def not_implemented(data):
|
||||
"""
|
||||
Zwraca kod 501 wraz z endpointem, który wywołał błąd.
|
||||
|
||||
:param data: Ścieżka zapytania
|
||||
:type data: list
|
||||
"""
|
||||
# TODO: change list to string -> data, not data[0]
|
||||
return 501, f"not recognised/implemented: {data[0]}", []
|
||||
|
||||
def __czy_x_istnieje(typ, **id):
|
||||
rekord = getDb().simple_select_all(typ, **id)
|
||||
if rekord is not None and rekord != []:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def czy_sportowiec_istnieje(id_zawodnika: str):
|
||||
return __czy_x_istnieje("sportowcy", id_zawodnika=id_zawodnika)
|
||||
|
||||
# GET /api/v1
|
||||
def stub_hello():
|
||||
"""
|
||||
Prosta funkcja witająca użytkowników w /api/v1
|
||||
"""
|
||||
return 200, 'hello from v1! stats are at /api/v1/stats', []
|
||||
|
||||
def epoch_to_date(epoch):
|
||||
"""
|
||||
Zamienia Unix'owy epoch na lokalny czas,
|
||||
w formacie przypominającym format ISO.
|
||||
|
||||
:param epoch: Epoch - sekundy po 1. stycznia 1970
|
||||
:type epoch: int
|
||||
"""
|
||||
return time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(epoch))
|
||||
|
||||
# GET /api/v1/
|
||||
# GET /api/v1/stats
|
||||
def stats():
|
||||
"""
|
||||
Zwraca ogólne statystyki serwera.
|
||||
"""
|
||||
data_to_send = {
|
||||
"start_time": lewy_globals.starttime,
|
||||
"uptime": lewy_globals.getUptime(),
|
||||
"real_uptime": lewy_globals.realUptime,
|
||||
"total_api_requests": lewy_globals.apiRequests,
|
||||
"failed_api_requests": lewy_globals.apiFailedRequests,
|
||||
"outside_api_requests": lewy_globals.outsideApiHits,
|
||||
"local_api_requests": lewy_globals.apiRequests - lewy_globals.outsideApiHits
|
||||
}
|
||||
return 200, "ok", data_to_send
|
||||
|
||||
# GET /api/v1/matches
|
||||
def get_matches(r = None, id_zawodnika: str | None = None, rok: int | None = None):
|
||||
"""
|
||||
Zwraca mecze.
|
||||
Przykład wywołania:
|
||||
get_matches(r, id_zawodnika=1), tożsame z GET /api/v1/matches?id_zawodnika=1
|
||||
get_matches(r, rok=2024), tożsame z GET /api/v1/matches?rok=2024
|
||||
get_matches(r), tożsame z GET /api/v1/matches
|
||||
"""
|
||||
response_json = []
|
||||
mecze = None
|
||||
|
||||
if id_zawodnika is None:
|
||||
# Gdy nie podano id wprost, sprawdź, czy podano je przez parametr.
|
||||
id_zawodnika = r.args.get('id_zawodnika', -1)
|
||||
|
||||
if rok is None:
|
||||
# Gdy nie podano roku wprost, sprawdź, czy podano je przez parametr.
|
||||
# Jeśli nie, przyjmij None (2025).
|
||||
rok = r.args.get('rok', None)
|
||||
|
||||
# Sprawdź, czy podano jakiekolwiek ID sportowca. Jeżeli nie, wypisz wszystkie mecze.
|
||||
if id_zawodnika == -1:
|
||||
mecze = getDb().get_sportsman_matches(year=rok)
|
||||
|
||||
# Sprawdź, czy sportowiec o podanym (lub niepodanym) id istnieje.
|
||||
# Jeśli nie istnieje, wypisz wszystkie mecze.
|
||||
elif not czy_sportowiec_istnieje(id_zawodnika=id_zawodnika):
|
||||
return 404, "error", {"error_msg": "This sportsman has not been found in the database. Try: id_zawodnika=1"}
|
||||
|
||||
# Gdy sportowiec istnieje, wypisz jego mecze.
|
||||
else:
|
||||
mecze = getDb().get_sportsman_matches(id_zawodnika=id_zawodnika, year=rok)
|
||||
|
||||
for mecz in mecze:
|
||||
response_json.append(mecz.jsonify())
|
||||
# print(f"zwracam mecze: {response_json}")
|
||||
return 200, "ok", response_json
|
||||
|
||||
# GET /api/v1/debugger_halt?token=XXX...
|
||||
@require_authentication
|
||||
def debugger_halt(r):
|
||||
"""
|
||||
Zatrzymuje wykonywanie skryptu, aby pozwolić
|
||||
administratorowi na wykonywanie dowolnego polecenia z konsoli.
|
||||
"""
|
||||
if lewy_globals.config['general']['is_proxied']:
|
||||
print(f"{c.WARNING}[{epoch_to_date(time.time())}]{c.ENDC} {r.headers['X-Forwarded-For']} triggered a debugger halt!")
|
||||
else:
|
||||
print(f"{c.WARNING}[{epoch_to_date(time.time())}]{c.ENDC} {r.remote_addr} triggered a debugger halt!")
|
||||
breakpoint()
|
||||
return 200, "ok", []
|
||||
|
||||
def last_goal_for(sportowiec: str = "MVC8zHZD"):
|
||||
"""
|
||||
Pobierz klub, dla którego sportowiec (domyślnie Robert) oddał ostatni gol.
|
||||
|
||||
:returns: Klub, lub None
|
||||
:rtype: kluby | None
|
||||
"""
|
||||
|
||||
sportowiec = getDb().simple_select_all("sportowcy", zewnetrzne_id_zawodnika=sportowiec)
|
||||
if sportowiec != []:
|
||||
return sportowiec[0].ostatni_gol_dla
|
||||
|
||||
return None
|
||||
|
||||
def lookup(data, request):
|
||||
"""
|
||||
Obsługuje zapytania zwrócone do /api/v1/...
|
||||
|
||||
:param data: Lista ze ścieżką zapytania
|
||||
:type data: list
|
||||
:param request: Zapytanie
|
||||
:type request: flask.request
|
||||
|
||||
:returns: Wartość zwróconą przez którąś z przywołanych funkcji.
|
||||
"""
|
||||
if data == []:
|
||||
return stub_hello()
|
||||
match data[0].lower():
|
||||
case 'stats' | '':
|
||||
return stats()
|
||||
case 'user':
|
||||
return stub_hello()
|
||||
case 'info':
|
||||
return stub_hello()
|
||||
case 'halt':
|
||||
return debugger_halt(r = request)
|
||||
case 'matches':
|
||||
return get_matches(r = request)
|
||||
case _:
|
||||
increment_bad_requests()
|
||||
return not_implemented(data)
|
||||
1191
FlaskWebProject/FlaskWebProject/lewy_db.py
Normal file
158
FlaskWebProject/FlaskWebProject/lewy_globals.py
Normal file
@@ -0,0 +1,158 @@
|
||||
#from git import Repo # hash ostatniego commitu
|
||||
import os
|
||||
import time
|
||||
import toml
|
||||
import lewy_db
|
||||
|
||||
global db, config, randomly_generated_passcode
|
||||
|
||||
class colors:
|
||||
HEADER = '\033[95m'
|
||||
OKBLUE = '\033[94m'
|
||||
OKCYAN = '\033[96m'
|
||||
OKGREEN = '\033[92m'
|
||||
WARNING = '\033[93m'
|
||||
FAIL = '\033[91m'
|
||||
ENDC = '\033[0m'
|
||||
BOLD = '\033[1m'
|
||||
UNDERLINE = '\033[4m'
|
||||
ENDL = '\n'
|
||||
|
||||
def safeTraverse(obj: dict, path: list, default=None):
|
||||
result = obj
|
||||
try:
|
||||
for x in path:
|
||||
result = result[x]
|
||||
except (KeyError, TypeError):
|
||||
result = default
|
||||
print(f"error reading: {' -> '.join(path)} - returning: {default}")
|
||||
finally:
|
||||
return result
|
||||
|
||||
def getCommit() -> str | None:
|
||||
try:
|
||||
return Repo(search_parent_directories=True).head.object.hexsha
|
||||
except Exception as e:
|
||||
return None
|
||||
|
||||
def getCommitInFormattedHTML():
|
||||
repo = "<center><p style=\"color: white;\">Brak informacji o wersji skryptu</p></center>"
|
||||
commit = getCommit()
|
||||
|
||||
if commit is not None:
|
||||
repo = f"<center><p style=\"color: white;\">Commit: <a href='https://gitea.7o7.cx/roberteam/lewangoalski/commit/{commit}'>{commit[:11]}</a></p></center>"
|
||||
|
||||
return repo
|
||||
|
||||
def getCommitWithFailsafe():
|
||||
commit = getCommit()
|
||||
|
||||
if commit is None:
|
||||
commit = "(unknown commit)"
|
||||
else:
|
||||
commit = "#" + commit
|
||||
|
||||
return commit[:12]
|
||||
|
||||
def ensureRandomlyGeneratedPassword():
|
||||
global randomly_generated_passcode
|
||||
|
||||
# iff the passcode is 0, as we manually set it elsewhere!
|
||||
if randomly_generated_passcode == 0:
|
||||
# generate a pseudorandom one and use it in the temporary config
|
||||
randomly_generated_passcode = str(int(time.time() * 1337 % 899_999 + 100_000))
|
||||
|
||||
print(f"{colors.WARNING}WARNING{colors.ENDC}: Default config populated with one-time, insecure pseudorandom API key: {colors.OKCYAN}{randomly_generated_passcode}{colors.ENDC}.\n"
|
||||
f" The API key is not the Flask debugger PIN. You need to provide a config file for persistence!{colors.ENDL}")
|
||||
|
||||
def getConfig(configfile: str) -> dict:
|
||||
global randomly_generated_passcode
|
||||
|
||||
if not os.path.exists(configfile):
|
||||
dummy_config = {'general': {'db_path_url': 'sqlite:///lewangoalski.sqlite', 'is_proxied': False, 'public_facing_url': 'http://127.0.0.1:5000/', 'db_prefix': 'lewy_sqlite'}, 'api': {'api_key': 'CHANGEME'}, 'scraper': {'user-agent': ''}, 'sportsmen': {'tracked_ids': ["MVC8zHZD", "WGOY4FSt", "vgOOdZbd", "Wn6E2SED", "AiH2zDve", "dUShzrBp", "UmV9iQmE", "tpV0VX0S", "vw8ZV7HC", "Qgx2trzH", "2oMimkAU", "WfXv1DCa", "0vgcq6un", "v5HSlEAa", "4S9fNUYh"]}}
|
||||
# if a passcode has not been provided by the user (config file doesn't exist, and user didn't specify it using an argument)
|
||||
print(f"{colors.WARNING}WARNING{colors.ENDC}: Using default, baked in config data. {colors.ENDL}"
|
||||
f" Consider copying and editing the provided example file ({colors.OKCYAN}config.example.toml{colors.ENDC}).")
|
||||
|
||||
ensureRandomlyGeneratedPassword()
|
||||
|
||||
dummy_config['api']['api_key'] = str(randomly_generated_passcode)
|
||||
return dummy_config
|
||||
|
||||
else:
|
||||
return toml.load(configfile)
|
||||
|
||||
def setupDb(app, config) -> lewy_db.baza:
|
||||
global db
|
||||
db = lewy_db.baza(app, config)
|
||||
return db
|
||||
|
||||
def getDb() -> lewy_db.baza:
|
||||
"""
|
||||
Akcesor dla wrappera bazy danych wspólnego dla całego projektu
|
||||
(klasy baza z lewy_db)
|
||||
"""
|
||||
return db
|
||||
|
||||
def setConfig(configfile):
|
||||
"""
|
||||
Zapewnia, że konfiguracja nie jest pusta,
|
||||
nawet, gdy sam plik jest pusty.
|
||||
|
||||
:param configfile: Ścieżka do pliku
|
||||
:type configfile: str
|
||||
"""
|
||||
global config
|
||||
config = getConfig(configfile)
|
||||
|
||||
if safeTraverse(config['api']['api_key'], []) is None or not config['api']['api_key']:
|
||||
ensureRandomlyGeneratedPassword()
|
||||
config['api']['api_key'] = str(randomly_generated_passcode)
|
||||
|
||||
|
||||
def getHeaders():
|
||||
"""
|
||||
Zwraca hardkodowane nagłówki do scrapowania, bądź te,
|
||||
z config.toml (o ile użytkownik jakieś podał).
|
||||
"""
|
||||
|
||||
# NOTE: use ESR user-agent
|
||||
# user_agent = 'Mozilla/5.0 (Windows NT 10.0; rv:130.0) Gecko/20100101 Firefox/130.0'
|
||||
user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0'
|
||||
|
||||
if safeTraverse(config[scraper]['user-agent'], []) is not None:
|
||||
user_agent = config[scraper]['user-agent']
|
||||
|
||||
return user_agent
|
||||
|
||||
def getUptime():
|
||||
"""
|
||||
Zwraca informację o czasie działania serwera.
|
||||
"""
|
||||
return int(time.time()) - starttime
|
||||
|
||||
def extractIpAndPortFromPublicUrl() -> tuple:
|
||||
|
||||
"""
|
||||
Pobiera dane z konfiguracji i zwraca
|
||||
krotkę: adres IP i port.
|
||||
"""
|
||||
|
||||
ip, port = "127.0.0.1", "5000"
|
||||
|
||||
try:
|
||||
url = config['general']['public_facing_url'].replace(":/", "")
|
||||
url_parts = url.split('/')
|
||||
ip_and_port = url_parts[1]
|
||||
ip, port = ip_and_port.split(':')
|
||||
except:
|
||||
pass
|
||||
|
||||
return ip, port
|
||||
|
||||
# Please leave at the bottom of this file.
|
||||
config = {}
|
||||
configfile = "config.toml"
|
||||
version = getCommitWithFailsafe()
|
||||
apiVersion = "1"
|
||||
randomly_generated_passcode = 0
|
||||
190
FlaskWebProject/FlaskWebProject/lewy_routes.py
Normal file
@@ -0,0 +1,190 @@
|
||||
from flask import render_template, request, make_response
|
||||
import lewy_api_v1
|
||||
import lewy_db
|
||||
import lewy_globals
|
||||
import json
|
||||
from lewy_api_v1 import get_matches
|
||||
def get_lewy_stats():
|
||||
return {
|
||||
'all_time_stats': {
|
||||
'goals': 589+85,
|
||||
'assists':154+35,
|
||||
'matches': 791+158,
|
||||
},
|
||||
'club_stats': {
|
||||
'goals': 589,
|
||||
'assists': 154,
|
||||
'matches': 791,
|
||||
},
|
||||
'nation_stats': {
|
||||
'goals': 85,
|
||||
'assists': 35,
|
||||
'matches': 158,
|
||||
},
|
||||
'international_cups': {
|
||||
'goals': 110,
|
||||
'assists': 19,
|
||||
'matches': 152,
|
||||
},
|
||||
'national_cups': {
|
||||
'goals': 58,
|
||||
'assists': 4,
|
||||
'matches': 74,
|
||||
},
|
||||
'cards': {
|
||||
'yellow': 86,
|
||||
'red': 2,
|
||||
}
|
||||
}
|
||||
|
||||
def index():
|
||||
dark_mode = request.cookies.get('darkMode', 'disabled')
|
||||
# Przykładowe użycie endpointu last_goal_for():
|
||||
# roberts_last_goals_club = lewy_api_v1.last_goal_for()
|
||||
# print(roberts_last_goals_club.id_klubu)
|
||||
stats = {
|
||||
'goals': 38,
|
||||
'assists': 12,
|
||||
'matches': 45,
|
||||
'matches_list': [
|
||||
{'date': '2024-10-12', 'opponent': 'Real Madrid', 'goals': 2, 'assists': 1, 'minutes': 90},
|
||||
{'date': '2024-10-19', 'opponent': 'Valencia', 'goals': 1, 'assists': 0, 'minutes': 85},
|
||||
# Możesz dodać więcej meczów...
|
||||
]
|
||||
}
|
||||
return render_template('index.html', goals=stats['goals'], assists=stats['assists'],
|
||||
matches=stats['matches'], matches_list=stats['matches_list'],
|
||||
commit_in_html=lewy_globals.getCommitInFormattedHTML(),
|
||||
dark_mode=dark_mode)
|
||||
|
||||
def mecze():
|
||||
# Możesz dostarczyć szczegóły dotyczące meczów
|
||||
selected_date = request.args.get("date", '2025')
|
||||
try:
|
||||
selected_date = int(selected_date)
|
||||
except:
|
||||
selected_date = 2025
|
||||
#with open("static/lewandowski_matches.json", "r") as file:
|
||||
# data = json.load(file)
|
||||
status, msg, matches = get_matches(None, id_zawodnika=1, rok=selected_date)
|
||||
|
||||
return render_template('matches.html', matches=matches, selected_date=selected_date)
|
||||
|
||||
def statystyki():
|
||||
dane=get_lewy_stats()
|
||||
return render_template('stats.html', **dane)
|
||||
|
||||
def clubs():
|
||||
selected_club = request.args.get("club","FC Barcelona")
|
||||
clubs = [
|
||||
{'club': 'FC Barcelona', 'goals': 101,'assist':20, 'matches':147,'minutes_played': 11684,'yellow_card':12,'red_card': 1, 'wins':101, 'draws': 14,'lost': 32},
|
||||
{'club': 'Bayern Monachium', 'goals': 344,'assist':73,'matches':375,'minutes_played': 31759,'yellow_card':36,'red_card': 0, 'wins':307, 'draws': 35,'lost': 33},
|
||||
{'club': 'Borussia Dortmund', 'goals': 103,'assist':42,'matches':187,'minutes_played': 14374,'yellow_card':19,'red_card': 1, 'wins':120, 'draws': 40,'lost': 27},
|
||||
{'club': 'Lech Poznan', 'goals': 41,'assist':19,'matches':82,'minutes_played': 6858,'yellow_card':9,'red_card': 0, 'wins':'-', 'draws': '-','lost': '-'},
|
||||
]
|
||||
return render_template('club.html', clubs=clubs, selected_club=selected_club)
|
||||
|
||||
def representation():
|
||||
nation_stats = {
|
||||
'goals': 85,
|
||||
'assists': 35,
|
||||
'matches': 158,
|
||||
'minutes_played': 12108,
|
||||
'yellow_card':10,
|
||||
'red_card': 0,
|
||||
'wins':75,
|
||||
'draws': 35,
|
||||
'lost': 48
|
||||
}
|
||||
return render_template('representation.html', nation_stats=nation_stats)
|
||||
def compare():
|
||||
selected_player = request.args.get("player","Leo Messi")
|
||||
lewy=get_lewy_stats()
|
||||
player2 = [
|
||||
{'name':'Leo Messi','goals': 865,'assists': 384,'matches':1103},
|
||||
{'name':'Cristiano Ronaldo','goals': 937,'assists': 257,'matches':1280},
|
||||
{'name':'Kylian Mbappé','goals': 330,'assists': 187,'matches':436},
|
||||
{'name':'Zlatan Ibrahimović','goals': 573,'assists': 200,'matches':988},
|
||||
{'name':'Luis Suárez','goals': 511,'assists': 277,'matches':858},
|
||||
{'name':'Erling Haaland','goals': 276,'assists': 49,'matches':342},
|
||||
{'name':'Karim Benzema','goals': 438,'assists': 160,'matches':820},
|
||||
{'name':'Sergio Agüero','goals': 385,'assists': 118,'matches':685},
|
||||
]
|
||||
return render_template('compare.html',player2=player2, selected_player=selected_player,**lewy, )
|
||||
def trophies():
|
||||
trophy = [
|
||||
{'name': 'Piłkarz Roku FIFA', 'year':'2021'},
|
||||
{'name': 'Piłkarz Roku FIFA', 'year':'2020'},
|
||||
{'name': 'UEFA Best Player in Europe', 'year':'2020'},
|
||||
{'name': 'Zdobywca Złotego Buta (Europe)', 'sezon':'2021/2022'},
|
||||
{'name': 'Zdobywca Złotego Buta (Europe)', 'sezon':'2020/2021'},
|
||||
{'name': 'Piłkarz roku', 'sezon':'2021'},
|
||||
{'name': 'Piłkarz roku', 'sezon':'2021'},
|
||||
{'name': 'Piłkarz roku', 'sezon':'2020'},
|
||||
{'name': 'Piłkarz roku', 'sezon':'2020'},
|
||||
{'name': 'Piłkarz roku', 'sezon':'2019'},
|
||||
{'name': 'Piłkarz roku', 'sezon':'2017'},
|
||||
{'name': 'Piłkarz roku', 'sezon':'2016'},
|
||||
{'name': 'Piłkarz roku', 'sezon':'2015'},
|
||||
{'name': 'Piłkarz roku', 'sezon':'2014'},
|
||||
{'name': 'Piłkarz roku', 'sezon':'2013'},
|
||||
{'name': 'Piłkarz roku', 'sezon':'2012'},
|
||||
{'name': 'Piłkarz roku', 'sezon':'2011'},
|
||||
{'name': 'Król strzelców', 'sezon':'2022/2023'},
|
||||
{'name': 'Król strzelców', 'sezon':'2021/2022'},
|
||||
{'name': 'Król strzelców', 'sezon':'2020/2021'},
|
||||
{'name': 'Król strzelców', 'sezon':'2019/2020'},
|
||||
{'name': 'Król strzelców', 'sezon':'2019/2020'},
|
||||
{'name': 'Król strzelców', 'sezon':'2018/2019'},
|
||||
{'name': 'Król strzelców', 'sezon':'2018/2019'},
|
||||
{'name': 'Król strzelców', 'sezon':'2017/2018'},
|
||||
{'name': 'Król strzelców', 'sezon':'2017/2018'},
|
||||
{'name': 'Król strzelców', 'sezon':'2016/2017'},
|
||||
{'name': 'Król strzelców', 'sezon':'2016/2017'},
|
||||
{'name': 'Król strzelców', 'sezon':'2015/2016'},
|
||||
{'name': 'Król strzelców', 'sezon':'2015/2016'},
|
||||
{'name': 'Król strzelców', 'sezon':'2013/2014'},
|
||||
{'name': 'Król strzelców', 'sezon':'2011/2012'},
|
||||
{'name': 'Król strzelców', 'sezon':'2009/2010'},
|
||||
{'name': 'Zdobywca Ligi Mistrzów', 'sezon':'2019/2020'},
|
||||
{'name': 'Zdobywca Klubowych Mistrzostw Świata', 'sezon':'2021'},
|
||||
{'name': 'Mistrz Hiszpanii', 'sezon':'2024/2025'},
|
||||
{'name': 'Mistrz Hiszpanii', 'sezon':'2022/2023'},
|
||||
{'name': 'Mistrz Niemiec', 'sezon':'2021/2022'},
|
||||
{'name': 'Mistrz Niemiec', 'sezon':'2020/2021'},
|
||||
{'name': 'Mistrz Niemiec', 'sezon':'2019/2020'},
|
||||
{'name': 'Mistrz Niemiec', 'sezon':'2018/2019'},
|
||||
{'name': 'Mistrz Niemiec', 'sezon':'2017/2018'},
|
||||
{'name': 'Mistrz Niemiec', 'sezon':'2016/2017'},
|
||||
{'name': 'Mistrz Niemiec', 'sezon':'2015/2016'},
|
||||
{'name': 'Mistrz Niemiec', 'sezon':'2014/2015'},
|
||||
{'name': 'Mistrz Niemiec', 'sezon':'2011/2012'},
|
||||
{'name': 'Mistrz Niemiec', 'sezon':'2010/2011'},
|
||||
{'name': 'Mistrz Niemiec', 'sezon':'2020/2021'},
|
||||
{'name': 'Zdobywca Superpucharu UEFA', 'sezon':'2020/2021'},
|
||||
{'name': 'Zdobywca Pucharu Niemiec', 'sezon':'2019/2020'},
|
||||
{'name': 'Zdobywca Pucharu Niemiec', 'sezon':'2018/2019'},
|
||||
{'name': 'Zdobywca Pucharu Niemiec', 'sezon':'2015/2016'},
|
||||
{'name': 'Zdobywca Pucharu Niemiec', 'sezon':'2011/2012'},
|
||||
{'name': 'Zdobywca Pucharu Hiszpanii', 'sezon':'2024/2025'},
|
||||
{'name': 'Zdobywca Superpucharu Niemiec', 'sezon':'2021/2022'},
|
||||
{'name': 'Zdobywca Superpucharu Niemiec', 'sezon':'2020/2021'},
|
||||
{'name': 'Zdobywca Superpucharu Niemiec', 'sezon':'2018/2019'},
|
||||
{'name': 'Zdobywca Superpucharu Niemiec', 'sezon':'2017/2018'},
|
||||
{'name': 'Zdobywca Superpucharu Niemiec', 'sezon':'2016/2017'},
|
||||
{'name': 'Zdobywca Superpucharu Niemiec', 'sezon':'2013/2014'},
|
||||
{'name': 'Zdobywca Superpucharu Hiszpanii', 'sezon':'2024/2025'},
|
||||
{'name': 'Zdobywca Superpucharu Hiszpanii', 'sezon':'2022/2023'},
|
||||
{'name': 'Mistrz Polski', 'sezon':'2009/2010'},
|
||||
{'name': 'Zdobywca Superpucharu Polski', 'sezon': '2009/2010'},
|
||||
{'name': 'Zdobywca Pucharu Polski', 'sezon': '2008/2009'},
|
||||
]
|
||||
return render_template('trophies.html',trophy=trophy)
|
||||
|
||||
def toggle_dark_mode():
|
||||
# Przełącz tryb i zapisz w ciasteczku
|
||||
dark_mode = request.cookies.get('darkMode', 'disabled')
|
||||
new_mode = 'enabled' if dark_mode == 'disabled' else 'disabled'
|
||||
response = make_response("OK")
|
||||
response.set_cookie('darkMode', new_mode, max_age=31536000) # Ustawienie ciasteczka na 1 rok
|
||||
return response
|
||||
@@ -1,17 +0,0 @@
|
||||
from flask import render_template, request, make_response
|
||||
from FlaskWebProject import app
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
# Odczyt ciasteczka "darkMode" <20> domy<6D>lnie "disabled"
|
||||
dark_mode = request.cookies.get('darkMode', 'disabled')
|
||||
return render_template('index.html', dark_mode=dark_mode)
|
||||
|
||||
@app.route('/toggle_dark_mode')
|
||||
def toggle_dark_mode():
|
||||
# Prze<7A><65>cz tryb i zapisz w ciasteczku
|
||||
dark_mode = request.cookies.get('darkMode', 'disabled')
|
||||
new_mode = 'enabled' if dark_mode == 'disabled' else 'disabled'
|
||||
response = make_response("OK")
|
||||
response.set_cookie('darkMode', new_mode, max_age=31536000) # Ustawienie ciasteczka na 1 rok
|
||||
return response
|
||||
BIN
FlaskWebProject/FlaskWebProject/static/Borussia_Dortmund.png
Normal file
|
After Width: | Height: | Size: 165 KiB |
BIN
FlaskWebProject/FlaskWebProject/static/FC_Barcelona.png
Normal file
|
After Width: | Height: | Size: 206 KiB |
BIN
FlaskWebProject/FlaskWebProject/static/FC_Bayern.png
Normal file
|
After Width: | Height: | Size: 186 KiB |
BIN
FlaskWebProject/FlaskWebProject/static/Lech_Poznan.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
FlaskWebProject/FlaskWebProject/static/fonts/Exo2-ExtraBold.ttf
Normal file
BIN
FlaskWebProject/FlaskWebProject/static/fonts/Exo2-SemiBold.ttf
Normal file
BIN
FlaskWebProject/FlaskWebProject/static/gigabuła.png
Normal file
|
After Width: | Height: | Size: 244 KiB |
11421
FlaskWebProject/FlaskWebProject/static/lewandowski_matches.json
Normal file
BIN
FlaskWebProject/FlaskWebProject/static/lewandowski_no_bg.png
Normal file
|
After Width: | Height: | Size: 351 KiB |
BIN
FlaskWebProject/FlaskWebProject/static/soccer-field.jpg
Normal file
|
After Width: | Height: | Size: 132 KiB |
@@ -1,62 +1,881 @@
|
||||
body {
|
||||
font-family: 'Arial', sans-serif;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background: #f7f7f7;
|
||||
color: #222;
|
||||
transition: all 0.3s ease;
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
nav {
|
||||
background: #d32f2f;
|
||||
padding: 10px;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
color: white;
|
||||
@font-face {
|
||||
font-family: 'Exo2SemiBold';
|
||||
src: url('fonts/Exo2-SemiBold.ttf') format('truetype');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
nav a, nav button {
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
background: none;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'Exo2ExtraBold';
|
||||
src: url('fonts/Exo2-ExtraBold.ttf') format('truetype');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
:root {
|
||||
--barca-blue: #002147;
|
||||
--barca-red: #A50044;
|
||||
--barca-gold: #FDB913;
|
||||
--polska-red-dark: #DC143C;
|
||||
--polska-red: #E30B17;
|
||||
--polska-white: #FFFFFF;
|
||||
|
||||
--polska-section-color: #121623;
|
||||
--section-color: #051839;
|
||||
--pink-highlight: #E1317E;
|
||||
--blue-highlight: #00B9BF;
|
||||
--yellow-highlight: #FFD23F;
|
||||
--border-radius: 5px;
|
||||
}
|
||||
|
||||
/* Podstawowy styl */
|
||||
body {
|
||||
font-family: 'Exo2ExtraBold', sans-serif;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background-color: var(--section-color);
|
||||
color: black;
|
||||
transition: all 0s ease;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
/* Wyśrodkowanie elementów w poziomie */
|
||||
justify-content: flex-start;
|
||||
/* Ustalamy początek na górze */
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
/* Header */
|
||||
.header-content {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 20px 0;
|
||||
background: var(--section-color);
|
||||
color: white;
|
||||
font-size: 15px;
|
||||
z-index: -2;
|
||||
position: relative;
|
||||
margin-top: 60px;
|
||||
/* box-shadow: 0px -5px 10px 2px rgba(0, 0, 0, 0.347); */
|
||||
}
|
||||
|
||||
|
||||
.header-content h1 {
|
||||
border-bottom: 10px solid var(--barca-red);
|
||||
border-radius: 10px;
|
||||
padding: 5px;
|
||||
animation: header-content 500ms ease;
|
||||
transform: skewX(-5deg);
|
||||
}
|
||||
|
||||
.header-content-special {
|
||||
font-size: 50px;
|
||||
color: var(--barca-gold);
|
||||
}
|
||||
|
||||
.profile-image {
|
||||
width: 40%;
|
||||
padding: 20px;
|
||||
position: relative;
|
||||
|
||||
}
|
||||
|
||||
.profile-image-cover {
|
||||
background: linear-gradient(185deg, transparent 40% 60%, var(--section-color) 85%, var(--section-color) 90%);
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
left: 0;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
|
||||
.profile-image img {
|
||||
width: 100%;
|
||||
max-width: 600px;
|
||||
animation: header-content 400ms ease;
|
||||
background: linear-gradient(90deg, var(--barca-blue) 50%, var(--barca-red) 50% 100%);
|
||||
border-radius: var(--border-radius);
|
||||
transform: skewX(2deg) skewY(0deg);
|
||||
}
|
||||
|
||||
@keyframes header-content {
|
||||
0% {
|
||||
opacity: 00%;
|
||||
transform: skewX(30deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
opacity: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
header button {
|
||||
border: none;
|
||||
font-size: 16px;
|
||||
cursor: pointer;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: var(--border-radius);
|
||||
}
|
||||
|
||||
|
||||
/* Styl nawigacji */
|
||||
.navbar {
|
||||
background: linear-gradient(to right, #002147, #A50044);
|
||||
|
||||
padding: 2.3rem 1rem;
|
||||
height: 1.5rem;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
z-index: 999;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
.navbar ul {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.logo {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.logo-text {
|
||||
font-size: 1.5rem;
|
||||
font-weight: bold;
|
||||
color: var(--barca-gold);
|
||||
}
|
||||
|
||||
.logo-icon {
|
||||
font-size: 2.8em;
|
||||
}
|
||||
|
||||
.logo-link {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.nav-links {
|
||||
display: flex;
|
||||
gap: 0rem;
|
||||
list-style: none;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.nav-links li a {
|
||||
display: block;
|
||||
color: white;
|
||||
/* dopasowane do .navbar padding */
|
||||
font-weight: 500;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
align-items: center;
|
||||
text-decoration: none;
|
||||
border-radius: var(--border-radius);
|
||||
padding: 10px;
|
||||
height: 100%;
|
||||
transition: 100ms ease;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.nav-links li a::before {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
opacity: 0%;
|
||||
font-size: 25px;
|
||||
transition: 100ms ease;
|
||||
}
|
||||
|
||||
.nav-links li:hover a::before {
|
||||
opacity: 100%;
|
||||
transform: translateY(-20px);
|
||||
}
|
||||
|
||||
.nav-links li:nth-child(1) a::before {
|
||||
content: "🏠";
|
||||
}
|
||||
|
||||
.nav-links li:nth-child(2) a::before {
|
||||
content: "📅";
|
||||
}
|
||||
|
||||
.nav-links li:nth-child(3) a::before {
|
||||
content: "📊";
|
||||
}
|
||||
|
||||
.nav-links li:nth-child(4) a::before {
|
||||
content: "🤝";
|
||||
}
|
||||
.nav-links li:nth-child(5) a::before {
|
||||
content: "⚽";
|
||||
}
|
||||
.nav-links li:nth-child(6) a::before {
|
||||
content: "🏆";
|
||||
}
|
||||
.nav-links li:nth-child(7) a::before {
|
||||
content: "🔎";
|
||||
}
|
||||
|
||||
.nav-links li {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.nav-links li:has(button) {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.nav-links li button {
|
||||
width: 1.5em;
|
||||
height: 1.5em;
|
||||
padding: 20px;
|
||||
font-size: 30px;
|
||||
border-radius: 50%;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
background-color: var(--bg-color);
|
||||
border: none;
|
||||
}
|
||||
|
||||
.nav-links li button {
|
||||
background-color: var(--barca-blue);
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
box-shadow: 0px 0px 6px 1px #FDB913;
|
||||
transition: 100ms ease;
|
||||
}
|
||||
|
||||
.nav-links li button:hover {
|
||||
transform: scale(1.1, 1.1);
|
||||
}
|
||||
|
||||
.nav-links li button::after {
|
||||
content: "";
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: -1px;
|
||||
background-color: var(--barca-red);
|
||||
width: 50%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.nav-links li button::before {
|
||||
content: "";
|
||||
background: url('FC_Barcelona.png');
|
||||
background-size: contain;
|
||||
z-index: 1;
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
left: 5px;
|
||||
width: 80%;
|
||||
height: 80%;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
.nav-links a:hover {
|
||||
background-color: var(--barca-gold, #FDB913);
|
||||
color: var(--barca-blue, #002147);
|
||||
}
|
||||
|
||||
.hamburger {
|
||||
display: none;
|
||||
font-size: 2rem;
|
||||
color: var(--barca-gold);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
@media (max-width: 1090px) {
|
||||
/* .base-header .navbar:not(:has(.show))
|
||||
{
|
||||
margin-bottom: 400px;
|
||||
} */
|
||||
|
||||
|
||||
.nav-links {
|
||||
position: absolute;
|
||||
flex-direction: column;
|
||||
top: 57px;
|
||||
right: 0px;
|
||||
padding: 0rem;
|
||||
gap: 0;
|
||||
height: auto;
|
||||
backdrop-filter: blur(4px);
|
||||
width: 30%;
|
||||
justify-content: center;
|
||||
box-shadow: 0px 0px 5px 5px rgba(0, 0, 0, 0.105);
|
||||
}
|
||||
|
||||
.nav-links li {
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.nav-links li a,
|
||||
.nav-links li button {
|
||||
display: block;
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
padding: 1rem;
|
||||
margin: 0;
|
||||
border-radius: 0;
|
||||
/* brak zaokrągleń w mobilnym menu */
|
||||
}
|
||||
.nav-links li button
|
||||
{
|
||||
background-color: none;
|
||||
width: 45px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.nav-links li button::before,.nav-links li button::after
|
||||
{
|
||||
background-color: none
|
||||
;
|
||||
}
|
||||
.nav-links li button:hover
|
||||
{
|
||||
transform: none;
|
||||
}
|
||||
|
||||
.nav-links.show {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.hamburger {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
@media (max-width: 1000px)
|
||||
{
|
||||
.header-content
|
||||
{
|
||||
flex-direction: column;
|
||||
}
|
||||
.header-content .profile-image
|
||||
{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
}
|
||||
.header-content .profile-image img{
|
||||
width: 100%;
|
||||
}
|
||||
.about-section-image
|
||||
{
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Wyśrodkowanie głównej zawartości */
|
||||
main {
|
||||
padding: 20px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.main-index {
|
||||
border-radius: var(--border-radius);
|
||||
margin-top: 20px;
|
||||
padding: 20px;
|
||||
width: 80%;
|
||||
max-width: 1200px;
|
||||
background-color: rgba(255, 255, 255, 0.086);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.about-section {
|
||||
border-radius: var(--border-radius);
|
||||
background-color: var(--barca-blue);
|
||||
padding: 20px;
|
||||
color: white;
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
grid-gap: 20px;
|
||||
grid-template-areas:
|
||||
"how how"
|
||||
"- about-section-image"
|
||||
"- about-section-image"
|
||||
"- about-section-image";
|
||||
}
|
||||
|
||||
.about-section article h3 {
|
||||
background-color: var(--barca-gold);
|
||||
color: black;
|
||||
text-align: center;
|
||||
border-radius: var(--border-radius);
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.about-section article h4 {
|
||||
background-color: #00B9BF;
|
||||
width: fit-content;
|
||||
padding: 10px;
|
||||
color: black;
|
||||
border-radius: (--border-radius)
|
||||
}
|
||||
|
||||
.article__how-it-works {
|
||||
grid-area: how;
|
||||
}
|
||||
|
||||
.about-section article a {
|
||||
display: block;
|
||||
width: 100%;
|
||||
color: var(--barca-gold);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.about-section-image {
|
||||
grid-area: about-section-image;
|
||||
z-index: 0;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.about-section-image::after {
|
||||
content: "";
|
||||
display: block;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
width: 90%;
|
||||
height: 90%;
|
||||
|
||||
z-index: -1;
|
||||
background-color: #051839;
|
||||
border-radius: 20px;
|
||||
}
|
||||
|
||||
.about-section-image img {
|
||||
width: 100%;
|
||||
z-index: 3;
|
||||
}
|
||||
|
||||
.general-stats-section {
|
||||
border-radius: var(--border-radius);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.general-stats-section h2 {
|
||||
width: 100%;
|
||||
background-color: #002147;
|
||||
padding: 20px;
|
||||
text-align: center;
|
||||
|
||||
}
|
||||
|
||||
.general-stats-section .grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr 1fr;
|
||||
height: 150px;
|
||||
gap: 20px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.general-stats-section .grid article {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
font-size: 1.3em;
|
||||
}
|
||||
.general-stats-section .grid article:nth-child(1){background-color: var(--blue-highlight);}
|
||||
.general-stats-section .grid article:nth-child(2){background-color: var(--yellow-highlight);}
|
||||
.general-stats-section .grid article:nth-child(3){background-color: var(--pink-highlight);}
|
||||
.general-stats-section .grid p
|
||||
{
|
||||
font-size: 40px;
|
||||
}
|
||||
.general-stats-section .grid h3, .general-stats-section .grid p
|
||||
{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* Styl dla tabeli */
|
||||
table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
margin-top: 20px;
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
th, td {
|
||||
padding: 10px;
|
||||
border-bottom: 1px solid #ccc;
|
||||
text-align: center;
|
||||
th,
|
||||
td {
|
||||
padding: 10px;
|
||||
border-bottom: 1px solid #ccc;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* Styl dla zdjęcia */
|
||||
.photo {
|
||||
width: 200px;
|
||||
border-radius: 50%;
|
||||
display: block;
|
||||
margin: 20px auto;
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
border-radius: 50%;
|
||||
display: block;
|
||||
margin: 0 auto;
|
||||
/* Wyśrodkowanie obrazka */
|
||||
}
|
||||
|
||||
/* Dark Mode */
|
||||
body.dark-mode {
|
||||
background-color: #121212;
|
||||
color: white;
|
||||
.section__matches
|
||||
{
|
||||
background-color: white;
|
||||
width: 80%;
|
||||
border-radius: var(--border-radius);
|
||||
max-width: 1000px;
|
||||
margin-bottom: 50px;
|
||||
}
|
||||
.section__matches h2
|
||||
{
|
||||
margin: 0;
|
||||
border-radius: var(--border-radius);
|
||||
background-color: var(--barca-gold);
|
||||
padding: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
.section__matches td:nth-child(1)
|
||||
{
|
||||
border-radius: 25px 0 0px 25px;
|
||||
}
|
||||
|
||||
body.dark-mode nav {
|
||||
background: #333;
|
||||
.section__matches td:last-child
|
||||
{
|
||||
border-radius: 0 25px 25px 0;
|
||||
}
|
||||
.section__matches th
|
||||
{
|
||||
font-size: 1.3em;
|
||||
color: var(--barca-red)
|
||||
}
|
||||
.section__matches tr
|
||||
{
|
||||
transition: 100ms ease;
|
||||
}
|
||||
.section__matches tr:hover:has(:not(th))
|
||||
{
|
||||
transform: scale(1.05,1.05);
|
||||
background-color: #00B9BF;
|
||||
}
|
||||
|
||||
body.dark-mode table {
|
||||
color: #e0e0e0;
|
||||
/* Styl dla trybu polskiego */
|
||||
body.poland-mode {
|
||||
background-color: var(--polska-section-color);
|
||||
}
|
||||
|
||||
body.poland-mode .navbar {
|
||||
background: linear-gradient(to bottom, #bd4148, #dc1414);
|
||||
}
|
||||
|
||||
body.poland-mode .logo {
|
||||
color: var(--polska-white)
|
||||
}
|
||||
|
||||
body.poland-mode .logo-text {
|
||||
color: white;
|
||||
}
|
||||
|
||||
body.poland-mode .nav-links li a {
|
||||
color: white;
|
||||
}
|
||||
|
||||
body.poland-mode .nav-links li a:hover {
|
||||
color: #220000;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
body.poland-mode .nav-links li button::before {
|
||||
background: none;
|
||||
}
|
||||
|
||||
body.poland-mode .nav-links li button {
|
||||
background-color: red;
|
||||
box-shadow: 0px 0px 6px 5px rgba(109, 0, 0, 0.219);
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
body.poland-mode .nav-links li button::after {
|
||||
content: "";
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
background-color: white;
|
||||
width: 100%;
|
||||
height: 50%;
|
||||
}
|
||||
|
||||
body.poland-mode .profile-image img {
|
||||
width: 100%;
|
||||
animation: header-content 300ms ease;
|
||||
background: linear-gradient(rgba(255, 255, 255, 0.534) 50%, rgba(255, 0, 0, 0.551) 50% 100%);
|
||||
border-radius: var(--border-radius);
|
||||
}
|
||||
|
||||
body.poland-mode .header-content-special {
|
||||
font-size: 50px;
|
||||
color: red;
|
||||
}
|
||||
|
||||
body.poland-mode .header-content {
|
||||
background-color: var(--polska-section-color)
|
||||
}
|
||||
|
||||
body.poland-mode .header-content h1 {
|
||||
border-bottom-color: red;
|
||||
}
|
||||
|
||||
body.poland-mode .profile-image-cover {
|
||||
background: linear-gradient(185deg, transparent 40% 60%, var(--polska-section-color) 85%, var(--polska-section-color) 90%);
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
left: 0;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
|
||||
body.poland-mode .hamburger {
|
||||
color: white;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
/* body.poland-mode .nav-links {
|
||||
background-color: var(--polska-red);
|
||||
/*Ale oczopląs*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
body.poland-mode .section-stats {
|
||||
background: linear-gradient(to bottom, #bd4148, #dc1414);
|
||||
}
|
||||
|
||||
body.poland-mode .section-stats h2 {
|
||||
color: white;
|
||||
}
|
||||
|
||||
body.poland-mode .stat-box {
|
||||
border-color: white;
|
||||
background: linear-gradient(to bottom, #ff0000,#231212);
|
||||
}
|
||||
|
||||
body.poland-mode .stat-box h3 {
|
||||
color: white;
|
||||
}
|
||||
body.poland-mode .club-stats h2{
|
||||
background: linear-gradient(to bottom, #ff0000,#231212);
|
||||
border: 4px solid white;
|
||||
color: white;
|
||||
}
|
||||
body.poland-mode .about-section {
|
||||
background-color: var(--polska-section-color);
|
||||
color: white;
|
||||
}
|
||||
|
||||
body.poland-mode .about-section article h3 {
|
||||
background-color: var(--polska-red-dark);
|
||||
color: white;
|
||||
}
|
||||
|
||||
body.poland-mode .about-section article h4 {
|
||||
background-color: #ffcaca;
|
||||
color: black;
|
||||
border-radius: 5px;
|
||||
}
|
||||
body.poland-mode .general-stats-section h2 {
|
||||
background: var(--polska-section-color);
|
||||
}
|
||||
body.poland-mode .general-stats-section .grid article:nth-child(1){background-color: var(--polska-red-dark);}
|
||||
body.poland-mode .general-stats-section .grid article:nth-child(2){background-color: var(--yellow-highlight);}
|
||||
body.poland-mode .general-stats-section .grid article:nth-child(3){background-color: var(--barca-blue);}
|
||||
body.poland-mode .about-section-image::after{
|
||||
background:var(--polska-red-dark);
|
||||
}
|
||||
body.poland-mode .section__matches
|
||||
{
|
||||
background-color: white;
|
||||
}
|
||||
body.poland-mode .section__matches h2
|
||||
{
|
||||
background-color: var(--polska-red);
|
||||
color: white;
|
||||
}
|
||||
body.poland-mode .section__matches th
|
||||
{
|
||||
color: var(--barca-red)
|
||||
}
|
||||
body.poland-mode .section__matches tr:hover:has(:not(th))
|
||||
{
|
||||
background-color: #ff5959;
|
||||
}
|
||||
body.poland-mode select{
|
||||
background:var(--section-color);
|
||||
}
|
||||
/* Przyciski i elementy */
|
||||
|
||||
|
||||
/* Style dla listy meczów */
|
||||
.section-stats {
|
||||
background: linear-gradient(135deg, #002147, #A50044);
|
||||
color: white;
|
||||
border-radius: 20px;
|
||||
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
|
||||
padding: 2rem 2rem;
|
||||
max-width: 1000px;
|
||||
margin: 0 auto;
|
||||
text-align: center;
|
||||
margin-bottom: 10px;
|
||||
width: 100%;
|
||||
}
|
||||
.section-stats h1{
|
||||
font-size: 34px;
|
||||
color: var(--barca-red);
|
||||
}
|
||||
body.poland-mode .section-stats h1{
|
||||
color: white;
|
||||
}
|
||||
.section-stats-center
|
||||
{
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 30px;
|
||||
justify-content: center;
|
||||
}
|
||||
@media (max-width: 1400px) {
|
||||
|
||||
.section-stats-center
|
||||
{
|
||||
grid-template-columns: 1fr !important;
|
||||
}
|
||||
}
|
||||
.section-stats h2 {
|
||||
font-size: 2rem;
|
||||
margin-bottom: 1rem;
|
||||
color: var(--barca-red);
|
||||
}
|
||||
|
||||
.stats {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
text-align: center;
|
||||
margin-top: 2rem;
|
||||
gap: 2rem;
|
||||
}
|
||||
|
||||
.stat-box {
|
||||
background-color: rgba(255, 255, 255, 0.1);
|
||||
border: 2px solid var(--barca-gold);
|
||||
color: white;
|
||||
padding: 2rem;
|
||||
border-radius: 15px;
|
||||
width: 160px;
|
||||
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
|
||||
transition: transform 0.3s ease;
|
||||
}
|
||||
|
||||
.stat-box:hover {
|
||||
transform: scale(1.1, 1.1);
|
||||
}
|
||||
|
||||
.stat-box h3 {
|
||||
font-size: 2.5rem;
|
||||
margin-bottom: 0.5rem;
|
||||
color: var(--barca-gold);
|
||||
}
|
||||
|
||||
.stat-box p {
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
.choose-club
|
||||
{
|
||||
margin: 10px;
|
||||
padding: 20px;
|
||||
display: flex;
|
||||
gap: 20px;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.choose-club button {
|
||||
width: 100px;
|
||||
border: none;
|
||||
|
||||
background-color:transparent;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.choose-club button img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color:transparent;
|
||||
transition: transform 100ms ease;
|
||||
}
|
||||
|
||||
.choose-club button img:hover {
|
||||
transform: scale(1.3,1.3) translateY(-10px);
|
||||
}
|
||||
.club-stats h2{
|
||||
color: var(--barca-gold);
|
||||
text-align: center;
|
||||
border: 5px solid var(--barca-red);
|
||||
background-color: var(--barca-blue);
|
||||
padding: 20px;
|
||||
border-radius: var(--border-radius);
|
||||
}
|
||||
.stat-box
|
||||
{
|
||||
padding: 20px;
|
||||
background-color: var(--barca-blue);
|
||||
display: grid;
|
||||
grid-template-rows: 1fr 1fr;
|
||||
text-align: center;
|
||||
}
|
||||
.stat-box-special
|
||||
{text-align: center;
|
||||
display: block;
|
||||
font-size: 40px;
|
||||
color: var(--barca-gold);
|
||||
}
|
||||
.club-stats-grid
|
||||
{
|
||||
display: grid;
|
||||
margin-bottom: 50px;
|
||||
gap: 10px;
|
||||
grid-template-columns: 1fr 1fr 1fr;
|
||||
grid-template-rows: 1fr 1fr 1fr;
|
||||
}
|
||||
select
|
||||
{
|
||||
color: white;
|
||||
padding: 20px;
|
||||
margin: 10px;
|
||||
font-size: 24px;
|
||||
background-color: var(--barca-blue);
|
||||
border-radius: 10px;
|
||||
border: 2px solid white;
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
{% extends "layout.html" %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<h2>{{ title }}.</h2>
|
||||
<h3>{{ message }}</h3>
|
||||
|
||||
<p>Use this area to provide additional information.</p>
|
||||
|
||||
{% endblock %}
|
||||
@@ -1,42 +1,77 @@
|
||||
<!DOCTYPE html>
|
||||
<!DOCTYPE html>
|
||||
<html lang="pl">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{% block title %}Lewandowski Stats{% endblock %}</title>
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
|
||||
<meta property="og:title" content="Robert Lewandowski Stats">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:url" content="https://lewy.7o7.cx/">
|
||||
<meta property="og:description" content="Najnowsze informacje o meczach, golach, asystach i innych statystykach">
|
||||
<meta property="og:image" content="{{ url_for('static', filename='lewandowski.jpg') }}">
|
||||
<meta property="og:image:height" content="143">
|
||||
<meta property="og:image:width" content="100">
|
||||
</head>
|
||||
<body>
|
||||
<nav>
|
||||
<a href="/">🏠 Strona główna</a> |
|
||||
<a href="/mecze">📅 Mecze</a> |
|
||||
<a href="/statystyki">📊 Statystyki</a> |
|
||||
<button id="theme-toggle" onclick="toggleTheme()">🌙 / 🌞</button>
|
||||
</nav>
|
||||
|
||||
<header>
|
||||
<img src="{{ url_for('static', filename='lewandowski.jpg') }}" alt="Robert Lewandowski" style="width: 200px; height: auto; border-radius: 50%;">
|
||||
<h1>Statystyki Roberta Lewandowskiego</h1>
|
||||
<body>
|
||||
<header class="base-header">
|
||||
<nav class="navbar">
|
||||
<a class="logo-link" href="/"><div class="logo-text">Robert Lewandowski</div></a>
|
||||
<ul class="nav-links">
|
||||
<li><a href="/">Strona główna</a></li>
|
||||
<li><a href="/mecze">Mecze</a></li>
|
||||
<li><a href="/statystyki">Statystyki</a></li>
|
||||
<li><a href="/club">Kluby</a></li>
|
||||
<li><a href="/representation">Reprezentacja</a></li>
|
||||
<li><a href="/trophies">Trofea</a></li>
|
||||
<li><a href="/compare">Porównaj</a></li>
|
||||
<li><button id="theme-toggle" onclick="toggleTheme()"></button></li>
|
||||
</ul>
|
||||
<div class="hamburger">☰</div>
|
||||
</nav>
|
||||
|
||||
<div class="header-content">
|
||||
<div class="profile-image">
|
||||
<img src="{{ url_for('static', filename='lewandowski_no_bg.png') }}" alt="Robert Lewandowski">
|
||||
<div class="profile-image-cover"></div>
|
||||
</div>
|
||||
<h1>Statystyki <br><span class="header-content-special"> Roberta <br> Lewandowskiego</span></h1>
|
||||
</div>
|
||||
<div></div>
|
||||
</header>
|
||||
|
||||
<main>
|
||||
{% block content %}{% endblock %}
|
||||
</main>
|
||||
|
||||
<script>
|
||||
const hamburger = document.querySelector('.hamburger');
|
||||
const navLinks = document.querySelector('.nav-links');
|
||||
hamburger.addEventListener('click', () => {
|
||||
navLinks.classList.toggle('show');
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
function toggleTheme() {
|
||||
const currentMode = document.body.classList.contains('dark-mode') ? 'dark' : 'light';
|
||||
const newMode = currentMode === 'light' ? 'dark' : 'light';
|
||||
document.body.classList.toggle('dark-mode');
|
||||
const currentMode = document.body.classList.contains('poland-mode') ? 'poland' : 'fcb';
|
||||
const newMode = currentMode === 'fcb' ? 'poland' : 'fcb';
|
||||
document.body.classList.toggle('poland-mode');
|
||||
localStorage.setItem('theme', newMode);
|
||||
}
|
||||
|
||||
window.onload = function () {
|
||||
const savedTheme = localStorage.getItem('theme');
|
||||
if (savedTheme === 'dark') {
|
||||
document.body.classList.add('dark-mode');
|
||||
if (savedTheme === 'poland') {
|
||||
document.body.classList.add('poland-mode');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<!--!>Footer<-->
|
||||
<hr style='width: 50%' />
|
||||
{% block footer %}{% endblock %}
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
</html>
|
||||
64
FlaskWebProject/FlaskWebProject/templates/club.html
Normal file
@@ -0,0 +1,64 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Strona Główna{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<section class="choose-club">
|
||||
<a href="{{ url_for('clubs', club='FC Barcelona') }}">
|
||||
<button><img src="{{ url_for('static', filename='FC_Barcelona.png') }}"></button>
|
||||
</a>
|
||||
<a href="{{ url_for('clubs', club='Bayern Monachium') }}">
|
||||
<button><img src="{{ url_for('static', filename='FC_Bayern.png') }}"></button>
|
||||
</a>
|
||||
<a href="{{ url_for('clubs', club='Borussia Dortmund') }}">
|
||||
<button><img src="{{ url_for('static', filename='Borussia_Dortmund.png') }}"></button>
|
||||
</a>
|
||||
<!--Jak nie będzie statysytk dla lecha to usunać-->
|
||||
<a href="{{ url_for('clubs', club='Lech Poznan') }}">
|
||||
<button><img src="{{ url_for('static', filename='Lech_Poznan.png') }}"></button>
|
||||
</a>
|
||||
</section>
|
||||
|
||||
<!-- Wyświetlanie danych tylko dla wybranego klubu -->
|
||||
{% for stats in clubs %}
|
||||
{% if stats.club == selected_club %}
|
||||
<section class="club-stats">
|
||||
<h2>Statystyki dla {{selected_club}}</h2>
|
||||
<div class="wybrany{{selected_club}}"></div>
|
||||
<div class="club-stats-grid">
|
||||
<div class="stat-box">
|
||||
<p>Gole:</p> <span class="stat-box-special"> {{ stats.goals }} </span>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<p>Asysty:</p> <span class="stat-box-special"> {{ stats.assist }} </span>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<p>Występy:</p> <span class="stat-box-special"> {{ stats.matches }} </span>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<p>Łączny czas gry:</p> <span class="stat-box-special"> {{ stats.minutes_played }}</span>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<p>Żółte kartki:</p> <span class="stat-box-special"> {{ stats.yellow_card }}</span>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<p>Czerwone kartki:</p> <span class="stat-box-special"> {{ stats.red_card }}</span>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<p>Zwycięstwa:</p> <span class="stat-box-special"> {{ stats.wins }}</span>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<p>Remisy:</p> <span class="stat-box-special"> {{ stats.draws }}</span>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<p>Porażki:</p> <span class="stat-box-special"> {{ stats.lost }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
|
||||
{% block footer %}
|
||||
{{ commit_in_html | safe }}
|
||||
{% endblock %}
|
||||
63
FlaskWebProject/FlaskWebProject/templates/compare.html
Normal file
@@ -0,0 +1,63 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Statystyki{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<select onchange="location = this.value;">
|
||||
<option disabled selected>Wybierz zawodnika</option>
|
||||
<option value="{{ url_for('compare', player='Leo Messi') }}">Leo Messi</option>
|
||||
<option value="{{ url_for('compare', player='Cristiano Ronaldo') }}">Cristiano Ronaldo</option>
|
||||
<option value="{{ url_for('compare', player='Kylian Mbappé') }}">Kylian Mbappé</option>
|
||||
<option value="{{ url_for('compare', player='Zlatan Ibrahimović') }}">Zlatan Ibrahimović</option>
|
||||
<option value="{{ url_for('compare', player='Luis Suárez') }}">Luis Suárez</option>
|
||||
<option value="{{ url_for('compare', player='Erling Haaland') }}">Erling Haaland</option>
|
||||
<option value="{{ url_for('compare', player='Karim Benzema') }}">Karim Benzema</option>
|
||||
<option value="{{ url_for('compare', player='Sergio Agüero') }}">Sergio Agüero</option>
|
||||
</select>
|
||||
|
||||
{%for player in player2 %}
|
||||
{% if player.name == selected_player %}
|
||||
<section class="section-stats">
|
||||
<h1>Robert Lewandowski VS {{selected_player}}</h1>
|
||||
<h2>Gole</h2>
|
||||
<div class="stats">
|
||||
<div class="stat-box">
|
||||
<h3>{{ all_time_stats.goals }}</h3>
|
||||
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<h3>{{ player.goals}}</h3>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<h2>Asysty</h2>
|
||||
<div class="stats">
|
||||
<div class="stat-box">
|
||||
<h3>{{ all_time_stats.assists }}</h3>
|
||||
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<h3>{{ player.assists}}</h3>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h2>Wystąpienia</h2>
|
||||
<div class="stats">
|
||||
<div class="stat-box">
|
||||
<h3>{{ all_time_stats.matches }}</h3>
|
||||
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<h3>{{ player.assists}}</h3>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
{% endif %}
|
||||
{% endfor%}
|
||||
|
||||
{% endblock %}
|
||||
@@ -1,20 +0,0 @@
|
||||
{% extends "layout.html" %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<h2>{{ title }}.</h2>
|
||||
<h3>{{ message }}</h3>
|
||||
|
||||
<address>
|
||||
One Microsoft Way<br />
|
||||
Redmond, WA 98052-6399<br />
|
||||
<abbr title="Phone">P:</abbr>
|
||||
425.555.0100
|
||||
</address>
|
||||
|
||||
<address>
|
||||
<strong>Support:</strong> <a href="mailto:Support@example.com">Support@example.com</a><br />
|
||||
<strong>Marketing:</strong> <a href="mailto:Marketing@example.com">Marketing@example.com</a>
|
||||
</address>
|
||||
|
||||
{% endblock %}
|
||||
@@ -1,33 +1,63 @@
|
||||
{% extends "layout.html" %}
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Strona Główna{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="main-index">
|
||||
<h2>Witaj na stronie poświęconej <br> statystykom Roberta Lewandowskiego!</h2>
|
||||
<p>Tu znajdziesz najnowsze informacje o meczach, golach, asystach i innych statystykach.</p>
|
||||
<section class="about-section">
|
||||
<article class="article__how-it-works">
|
||||
<h3>Jak to działa?</h3>
|
||||
<h4>Pobieranie statystyk</h4>
|
||||
<p>Tu znajdziesz najświeższe statystyki, aktualizowane zaraz po zakończeniu meczu Lewego</p>
|
||||
<h4>Porównywanie zawodników</h4>
|
||||
<p>Robert Lewandowski jest uznawany za jednego z najlepszych zawodników na świecie, zobacz jak wypada w porównaniu do innych czołowych zawodników i sprawdź czy zasługuje na miano jednego z najlepszych napastników świata.</p>
|
||||
</article>
|
||||
<div class="about-section-image">
|
||||
<img src="{{ url_for('static', filename='gigabuła.png') }}">
|
||||
</div>
|
||||
<article>
|
||||
<h3>Mecze</h3>
|
||||
<p>Nie oglądałeś ostatniego meczu Barcelony? Wypadło Ci coś i nie widziałeś najnowszego spotkania reprezentacji Polski? Wejdź i sprawdź jak poradził sobie Robert.</p>
|
||||
<a href="/mecze">Zobacz mecze</a>
|
||||
</article>
|
||||
<article>
|
||||
<h3>Statystyki</h3>
|
||||
<p>Jesteś zainteresowany jak Robert radzi sobie na przestrzeni tylu lat gry? Jesteś ciekaw czy napastnik oprócz strzelania bramek lubi kolekcjonować kartki? Sprawdź u nas jak wygląda kariera Roberta Lewandowskiego na podstawie jego gry w kadrze Polski, klubach oraz Pucharach ligowych i międzynarodowych.</p>
|
||||
<a href="/statystyki">Zobacz statystyki</a>
|
||||
</article>
|
||||
<article>
|
||||
<h3>Trofea</h3>
|
||||
<p>Zastanawia Cie jakie było ostatnie trofeum Roberta? A może z kolegami sprawdzacie, który lepiej pamięta złote chwile w karierze naszego idola? Rozwiejcie wasze wątpliwości i zobaczcie wielką kolekcji zdobyczy pucharowych najlepszego polskiego zawodnika.</p>
|
||||
<a href="/club">Zobacz trofea</a>
|
||||
</article>
|
||||
</section>
|
||||
<!--
|
||||
<section class="general-stats-section">
|
||||
<h2>Ogólne statystyki:</h3>
|
||||
<div class="grid">
|
||||
|
||||
<div class="jumbotron">
|
||||
<h1>Flask</h1>
|
||||
<p class="lead">Flask is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.</p>
|
||||
<p><a href="http://flask.pocoo.org/" class="btn btn-primary btn-large">Learn more »</a></p>
|
||||
<article>
|
||||
<h3>Gole:</h3>
|
||||
<p>{{ goals }}</p>
|
||||
</article>
|
||||
<article>
|
||||
<h3>Asysty</h3>
|
||||
<p>{{ assists }}</p>
|
||||
</article>
|
||||
<article>
|
||||
<h3>Liczba meczów</h3>
|
||||
<p>{{ matches }}</p>
|
||||
</article>
|
||||
</div>
|
||||
</section>
|
||||
-->
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<h2>Getting started</h2>
|
||||
<p>
|
||||
Flask gives you a powerful, patterns-based way to build dynamic websites that
|
||||
enables a clean separation of concerns and gives you full control over markup
|
||||
for enjoyable, agile development.
|
||||
</p>
|
||||
<p><a class="btn btn-default" href="http://flask.pocoo.org/docs/">Learn more »</a></p>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<h2>Get more libraries</h2>
|
||||
<p>The Python Package Index is a repository of software for the Python programming language.</p>
|
||||
<p><a class="btn btn-default" href="https://pypi.python.org/pypi">Learn more »</a></p>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<h2>Microsoft Azure</h2>
|
||||
<p>You can easily publish to Microsoft Azure using Visual Studio. Find out how you can host your application using a free trial today.</p>
|
||||
<p><a class="btn btn-default" href="http://azure.microsoft.com">Learn more »</a></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block footer %}
|
||||
<!--
|
||||
{{ commit_in_html | safe }}
|
||||
-->
|
||||
{% endblock %}
|
||||
@@ -1,118 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="pl">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Statystyki Roberta Lewandowskiego</title>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Roboto&display=swap" rel="stylesheet">
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Roboto', sans-serif;
|
||||
background-color: #f2f2f2;
|
||||
margin: 0;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 960px;
|
||||
margin: auto;
|
||||
background-color: white;
|
||||
padding: 30px;
|
||||
border-radius: 15px;
|
||||
box-shadow: 0 0 15px rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
h1 {
|
||||
text-align: center;
|
||||
color: #d32f2f;
|
||||
}
|
||||
|
||||
.profile {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.profile img {
|
||||
border-radius: 50%;
|
||||
width: 180px;
|
||||
height: 180px;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.stats {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.stat {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.stat h2 {
|
||||
color: #333;
|
||||
margin: 5px 0;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
margin-top: 30px;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
th, td {
|
||||
padding: 12px;
|
||||
border-bottom: 1px solid #ccc;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
th {
|
||||
background-color: #e53935;
|
||||
color: white;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>Statystyki Roberta Lewandowskiego</h1>
|
||||
|
||||
<div class="profile">
|
||||
<img src="{{ url_for('static', filename='lewandowski.jpg') }}" alt="Robert Lewandowski">
|
||||
<p><strong>Napastnik</strong> - FC Barcelona / Polska Reprezentacja</p>
|
||||
</div>
|
||||
|
||||
<div class="stats">
|
||||
<div class="stat">
|
||||
<h2>{{ goals }}</h2>
|
||||
<p>Gole</p>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<h2>{{ assists }}</h2>
|
||||
<p>Asysty</p>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<h2>{{ matches }}</h2>
|
||||
<p>Mecze</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h2 style="margin-top: 40px;">Szczegóły Meczy</h2>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Data</th>
|
||||
<th>Przeciwnik</th>
|
||||
<th>Gole</th>
|
||||
<th>Asysty</th>
|
||||
<th>Minuty</th>
|
||||
</tr>
|
||||
{% for match in matches %}
|
||||
<tr>
|
||||
<td>{{ match.date }}</td>
|
||||
<td>{{ match.opponent }}</td>
|
||||
<td>{{ match.goals }}</td>
|
||||
<td>{{ match.assists }}</td>
|
||||
<td>{{ match.minutes }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,23 +1,54 @@
|
||||
{% extends 'base.html' %}
|
||||
{% block title %}Historia meczów{% endblock %}
|
||||
|
||||
{% block title %}Lista meczów{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h2>Historia ostatnich meczów</h2>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Data</th>
|
||||
<th>Przeciwnik</th>
|
||||
<th>Gole</th>
|
||||
<th>Asysty</th>
|
||||
<th>Minuty</th>
|
||||
</tr>
|
||||
{% for match in matches %}
|
||||
<tr>
|
||||
<td>{{ match.date }}</td>
|
||||
<td>{{ match.opponent }}</td>
|
||||
<td>{{ match.goals }}</td>
|
||||
<td>{{ match.assists }}</td>
|
||||
<td>{{ match.minutes }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
<select onchange="location = this.value;">
|
||||
<option disabled selected>Wybierz rok</option>
|
||||
<option value="{{ url_for('mecze', date='2025') }}">2025</option>
|
||||
<option value="{{ url_for('mecze', date='2024') }}">2024</option>
|
||||
<option value="{{ url_for('mecze', date='2023') }}">2023</option>
|
||||
<option value="{{ url_for('mecze', date='2022') }}">2022</option>
|
||||
<option value="{{ url_for('mecze', date='2021') }}">2021</option>
|
||||
<option value="{{ url_for('mecze', date='2020') }}">2020</option>
|
||||
<option value="{{ url_for('mecze', date='2019') }}">2019</option>
|
||||
<option value="{{ url_for('mecze', date='2018') }}">2018</option>
|
||||
<option value="{{ url_for('mecze', date='2017') }}">2017</option>
|
||||
<option value="{{ url_for('mecze', date='2016') }}">2016</option>
|
||||
<option value="{{ url_for('mecze', date='2015') }}">2015</option>
|
||||
<option value="{{ url_for('mecze', date='2014') }}">2014</option>
|
||||
</select>
|
||||
<section class="section__matches">
|
||||
<h2>📅 Mecze Roberta</h2>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Data</th>
|
||||
|
||||
<!--
|
||||
<th>Przeciwnik</th>
|
||||
<th>Gole</th>
|
||||
<th>Asysty</th>
|
||||
<th>Minuty</th>
|
||||
-->
|
||||
<th>Gospodarze</th>
|
||||
<th>Wynik</th>
|
||||
<th>Goście</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
{% for match in matches %}
|
||||
<tr>
|
||||
<td>{{ match.data }}</td>
|
||||
|
||||
<td>{{ match.gospodarze_pelna_nazwa }}</td>
|
||||
<td>{{ match.gosp_wynik }} : {{ match.gosc_wynik }}</td>
|
||||
<td>{{ match.goscie_pelna_nazwa }}</td>
|
||||
<!--
|
||||
<td>{{ match.goals }}</td>
|
||||
<td>{{ match.assists }}</td>
|
||||
<td>{{ match.minutes }}</td>
|
||||
-->
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</section>
|
||||
{% endblock %}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Statystyki{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<section class="club-stats club-stats-poland">
|
||||
<h2>Statystyki w reprezentacji Polski</h2>
|
||||
<div class="wybrany{{selected_club}}"></div>
|
||||
<div class="club-stats-grid">
|
||||
<div class="stat-box">
|
||||
<p>Gole:</p> <span class="stat-box-special"> {{ nation_stats.goals }} </span>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<p>Asysty:</p> <span class="stat-box-special"> {{ nation_stats.assists }} </span>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<p>Występy:</p> <span class="stat-box-special"> {{ nation_stats.matches }} </span>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<p>Łączny czas gry:</p> <span class="stat-box-special"> {{ nation_stats.minutes_played }}</span>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<p>Żółte kartki:</p> <span class="stat-box-special"> {{ nation_stats.yellow_card }}</span>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<p>Czerwone kartki:</p> <span class="stat-box-special"> {{ nation_stats.red_card }}</span>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<p>Zwycięstwa:</p> <span class="stat-box-special"> {{ nation_stats.wins }}</span>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<p>Remisy:</p> <span class="stat-box-special"> {{ nation_stats.draws }}</span>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<p>Porażki:</p> <span class="stat-box-special"> {{ nation_stats.lost }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{% endblock %}
|
||||
@@ -3,10 +3,104 @@
|
||||
{% block title %}Statystyki{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h2>Statystyki Roberta Lewandowskiego</h2>
|
||||
<ul>
|
||||
<li>Gole: {{ stats.goals }}</li>
|
||||
<li>Asysty: {{ stats.assists }}</li>
|
||||
<li>Mecze: {{ stats.matches }}</li>
|
||||
</ul>
|
||||
{% endblock %}
|
||||
<div class="section-stats-center">
|
||||
|
||||
<section class="section-stats">
|
||||
<h2>Ogólne statystyki</h2>
|
||||
<div class="stats">
|
||||
<div class="stat-box">
|
||||
<h3>{{ all_time_stats.goals }}</h3>
|
||||
<p>Gole</p>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<h3>{{ all_time_stats.assists }}</h3>
|
||||
<p>Asysty</p>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<h3>{{ all_time_stats.matches }}</h3>
|
||||
<p>Występy</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="section-stats">
|
||||
<h2>Klubowe statystyki</h2>
|
||||
<div class="stats">
|
||||
<div class="stat-box">
|
||||
<h3>{{ club_stats.goals }}</h3>
|
||||
<p>Gole</p>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<h3>{{ club_stats.assists }}</h3>
|
||||
<p>Asysty</p>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<h3>{{ club_stats.matches }}</h3>
|
||||
<p>Występy</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="section-stats">
|
||||
<h2>Reprezentacja statystyki</h2>
|
||||
<div class="stats">
|
||||
<div class="stat-box">
|
||||
<h3>{{ nation_stats.goals }}</h3>
|
||||
<p>Gole</p>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<h3>{{ nation_stats.assists }}</h3>
|
||||
<p>Asysty</p>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<h3>{{ nation_stats.matches }}</h3>
|
||||
<p>Występy</p>
|
||||
</div>
|
||||
</section>
|
||||
<section class="section-stats">
|
||||
<h2>Puchary międzynarodowe</h2>
|
||||
<div class="stats">
|
||||
<div class="stat-box">
|
||||
<h3>{{ international_cups.goals }}</h3>
|
||||
<p>Gole</p>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<h3>{{ international_cups.assists }}</h3>
|
||||
<p>Asysty</p>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<h3>{{ international_cups.matches }}</h3>
|
||||
<p>Występy</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="section-stats">
|
||||
<h2>Puchary krajowe</h2>
|
||||
<div class="stats">
|
||||
<div class="stat-box">
|
||||
<h3>{{ national_cups.goals }}</h3>
|
||||
<p>Gole</p>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<h3>{{ national_cups.assists }}</h3>
|
||||
<p>Asysty</p>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<h3>{{ national_cups.matches }}</h3>
|
||||
<p>Występy</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="section-stats">
|
||||
<h2>Kartki</h2>
|
||||
<div class="stats">
|
||||
<div class="stat-box">
|
||||
<h3>{{ cards.yellow }}</h3>
|
||||
<p>Żółte</p>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<h3>{{ cards.red }}</h3>
|
||||
<p>Czerwone</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{% endblock %}
|
||||
28
FlaskWebProject/FlaskWebProject/templates/trophies.html
Normal file
@@ -0,0 +1,28 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Statystyki{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<section class="section__matches">
|
||||
<h2>🏆 Trofea</h2>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Nazwa</th>
|
||||
<th>Data/Sezon</th>
|
||||
</tr>
|
||||
{% for trophy in trophy %}
|
||||
|
||||
<tr>
|
||||
<td>{{ trophy.name }}</td>
|
||||
{% if trophy.year == NULL %}
|
||||
<td>{{ trophy.sezon }}</td>
|
||||
{% endif %}
|
||||
{% if trophy.sezon == NULL %}
|
||||
<td>{{ trophy.year }}</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</section>
|
||||
|
||||
{% endblock %}
|
||||
@@ -1,37 +0,0 @@
|
||||
"""
|
||||
Routes and views for the flask application.
|
||||
"""
|
||||
|
||||
from datetime import datetime
|
||||
from flask import render_template
|
||||
from FlaskWebProject import app
|
||||
|
||||
@app.route('/')
|
||||
@app.route('/home')
|
||||
def home():
|
||||
"""Renders the home page."""
|
||||
return render_template(
|
||||
'index.html',
|
||||
title='Home Page',
|
||||
year=datetime.now().year,
|
||||
)
|
||||
|
||||
@app.route('/contact')
|
||||
def contact():
|
||||
"""Renders the contact page."""
|
||||
return render_template(
|
||||
'contact.html',
|
||||
title='Contact',
|
||||
year=datetime.now().year,
|
||||
message='Your contact page.'
|
||||
)
|
||||
|
||||
@app.route('/about')
|
||||
def about():
|
||||
"""Renders the about page."""
|
||||
return render_template(
|
||||
'about.html',
|
||||
title='About',
|
||||
year=datetime.now().year,
|
||||
message='Your application description page.'
|
||||
)
|
||||
BIN
FlaskWebProject/instance/lewangoalski.sqlite
Normal file
@@ -1 +1,7 @@
|
||||
Flask>=2.2.3
|
||||
Flask~=2.2.3
|
||||
gitpython~=3.1.44
|
||||
Flask-SQLAlchemy~=3.1.1
|
||||
psycopg2~=2.9.10
|
||||
Flask-APScheduler~=1.13.1
|
||||
requests~=2.32.3
|
||||
toml~=0.10.2
|
||||
@@ -1,14 +1,5 @@
|
||||
"""
|
||||
This script runs the FlaskWebProject application using a development server.
|
||||
Please see README.md for more tips on how to get your server running.
|
||||
"""
|
||||
|
||||
from os import environ
|
||||
from FlaskWebProject import app
|
||||
|
||||
if __name__ == '__main__':
|
||||
HOST = environ.get('SERVER_HOST', 'localhost')
|
||||
try:
|
||||
PORT = int(environ.get('SERVER_PORT', '5555'))
|
||||
except ValueError:
|
||||
PORT = 5555
|
||||
app.run(HOST, PORT)
|
||||
print("runserver.py is obsolete. Please run your server with lewy.py.")
|
||||
235
LICENSE
Normal file
@@ -0,0 +1,235 @@
|
||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you legal permission to copy, distribute and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation. However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available to the community. It requires the operator of a network server to provide the source code of the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
"Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the work with which it is combined will remain governed by version 3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of the GNU Affero General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU Affero General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU Affero General Public License, you may choose any version ever published by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future versions of the GNU Affero General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
lewangoalski
|
||||
Copyright (C) 2025 roberteam
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If your software can interact with users remotely through a computer network, you should also make sure that it provides a way for users to get its source. For example, if your program is a web application, its interface could display a "Source" link that leads users to an archive of the code. There are many ways you could offer source, and different solutions will be better for different programs; see section 13 for the specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see <http://www.gnu.org/licenses/>.
|
||||
56
README.md
Normal file
@@ -0,0 +1,56 @@
|
||||
# lewangoalski
|
||||
|
||||
## Uruchamianie projektu:
|
||||
- Zacznij od pobrania plików projektu lub sklonuj repozytorium, używając git:
|
||||
```
|
||||
git clone https://gitea.7o7.cx/roberteam/lewangoalski.git
|
||||
```
|
||||
|
||||
- Przejdź do katalogu z plikami projektu:
|
||||
```
|
||||
cd lewangoalski
|
||||
```
|
||||
|
||||
- Stwórz wirtualne środowisko:
|
||||
```
|
||||
python -m venv .venv
|
||||
```
|
||||
Powyższe polecenie stworzy ukryty folder o nazwie *.venv*.
|
||||
|
||||
- Aby aktywować to wirtualne środowisko należy użyć:
|
||||
- na Linuxie (bash):
|
||||
```
|
||||
source .venv/bin/activate
|
||||
```
|
||||
- na Windowsie (cmd):
|
||||
```
|
||||
.venv\Scripts\activate
|
||||
```
|
||||
|
||||
- Zainstaluj niezbędne pakiety w świeżo utworzonym środowisku wirtualnym:
|
||||
```
|
||||
pip install -r FlaskWebProject\requirements.txt
|
||||
```
|
||||
|
||||
- Wejdź do katalogu ze skryptem:
|
||||
```
|
||||
cd FlaskWebProject/FlaskWebProject
|
||||
```
|
||||
|
||||
- Uruchom skrypt:
|
||||
- w sposób ciągły:
|
||||
```
|
||||
python lewy.py
|
||||
```
|
||||
- z automatycznym przeładowaniem (kod zostanie przeładowany po zmianie w bazie kodu):
|
||||
```
|
||||
flask --app lewy run --debug
|
||||
```
|
||||
|
||||
## Przydatne do rozruchu parametry:
|
||||
```
|
||||
python lewy.py -h
|
||||
```
|
||||
|
||||
## Konfiguracja
|
||||
Przykładowa konfiguracja została umieszczona w pliku config.example.toml. Skopiuj go, a następnie zmień jego nazwę na config.toml, aby móc swobodnie nanieść swoje zmiany.
|
||||