Compare commits
237
Commits
c698008b0c
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
27f6b663ab | ||
|
|
c8ec6f1846 | ||
|
|
2055c15906 | ||
|
|
3461b61e27 | ||
|
|
04dca24513 | ||
|
|
b0110e1bc8 | ||
|
|
32ef2656f7 | ||
|
|
d19fc04140 | ||
|
|
04120d77e8 | ||
|
|
e433dbe9e3 | ||
|
|
13468de37c | ||
|
|
197b5532c7 | ||
|
|
b09dd6b32b | ||
|
|
09ab9650c8 | ||
|
|
cd543c9223 | ||
|
|
733cc25196 | ||
|
|
c2fb53f1cf | ||
|
|
6feffaa6e0 | ||
|
|
a0ee841573 | ||
|
|
a71330a4da | ||
|
|
fd47798209 | ||
|
|
553a013601 | ||
|
|
870e278049 | ||
|
|
73a170bd07 | ||
|
|
ed2131a847 | ||
|
|
979a03178a | ||
|
|
30eea96662 | ||
|
|
0a50f120e3 | ||
|
|
7126f2de40 | ||
|
|
0e893b9c50 | ||
|
|
828d1dc4d8 | ||
|
|
d644c8f698 | ||
|
|
68892d9d6c | ||
|
|
d8a00acb2d | ||
|
|
c083aa9c7c | ||
|
|
c054f268b0 | ||
|
|
f22b9545d3 | ||
|
|
59fab74a01 | ||
|
|
3539b23943 | ||
|
|
2d8e418d66 | ||
|
|
9b5b50f174 | ||
|
|
d426c2b75f | ||
|
|
5009146a04 | ||
|
|
df4a69f567 | ||
|
|
81a421ebd3 | ||
|
|
f5735721e2 | ||
|
|
31d33aa0f8 | ||
|
|
e1a0736e1c | ||
|
|
fbfbac8ae2 | ||
|
|
bb1bb8568e | ||
|
|
a6fbac60a2 | ||
|
|
5adb9fb822 | ||
|
|
7d4f66c113 | ||
|
|
738d0427d9 | ||
|
|
6604b0310f | ||
|
|
d828c9f0b2 | ||
|
|
5502607f3c | ||
|
|
f4748d2874 | ||
|
|
a8e9327d3d | ||
|
|
0bf72d686b | ||
|
|
3215493ac7 | ||
|
|
055e4d3d4a | ||
|
|
29e4bfbb0b | ||
|
|
72a51bf1f9 | ||
|
|
bd39227f6d | ||
|
|
4c2650454b | ||
|
|
d19cb5561b | ||
|
|
1127d9d845 | ||
|
|
fc73ce8b27 | ||
|
|
813c16fcbb | ||
|
|
0a2cc9f881 | ||
|
|
cce004230d | ||
|
|
acb1ea6f5a | ||
|
|
5015c61864 | ||
|
|
4c643404d8 | ||
|
|
15e2f65c43 | ||
|
|
02cae28986 | ||
|
|
44e458a21d | ||
|
|
5b76f0384b | ||
|
|
4d4b6f726a | ||
|
|
119097d101 | ||
|
|
281ac3f2f7 | ||
|
|
a40b47f469 | ||
|
|
9e80cb01e2 | ||
|
|
9178a97b45 | ||
|
|
cccd93e6db | ||
|
|
db06d62fba | ||
|
|
c0ddebf971 | ||
|
|
af0047136a | ||
|
|
5000e83012 | ||
|
|
82d12ea921 | ||
|
|
a2360a3938 | ||
|
|
e374de61ae | ||
|
|
c7c1002fb0 | ||
|
|
2cb0e754ed | ||
|
|
edcd8e5f35 | ||
|
|
cca81177a5 | ||
|
|
f5f140a2a8 | ||
|
|
49a6458d03 | ||
|
|
71d57e8977 | ||
|
|
b2174f00d8 | ||
|
|
9f97b31e0f | ||
|
|
22d30db20d | ||
|
|
2f6c4f3c3c | ||
|
|
a19c2124aa | ||
|
|
6026f48a51 | ||
|
|
96b4a8cda2 | ||
|
|
a641824c70 | ||
|
|
39cfa9403f | ||
|
|
84208dc256 | ||
|
|
ad5fbcaab1 | ||
|
|
5d008fdf54 | ||
|
|
bf5b6727f4 | ||
|
|
883c2dc55a | ||
|
|
adf1c3e7e2 | ||
|
|
644cff5adf | ||
|
|
ee8218c815 | ||
|
|
33a5a7d531 | ||
|
|
9bd51dc8db | ||
|
|
5d3ae8438b | ||
|
|
5d5eb48fa7 | ||
|
|
7f258ed16f | ||
|
|
2fad736e41 | ||
|
|
d72ae3a51d | ||
|
|
086fa71f05 | ||
|
|
3df202bc84 | ||
|
|
d2abacb0c4 | ||
|
|
64f723f619 | ||
|
|
599e781122 | ||
|
|
fcff894678 | ||
|
|
67a99946f2 | ||
|
|
f7d4742ec8 | ||
|
|
1136874a3c | ||
|
|
903963c951 | ||
|
|
6e377335c1 | ||
|
|
af1d1dd616 | ||
|
|
274f602aab | ||
|
|
3b3ddc5ab5 | ||
|
|
3437d52322 | ||
|
|
2e3f494db5 | ||
|
|
d91f1a279d | ||
|
|
e36a2d97d9 | ||
|
|
27c5799178 | ||
|
|
b1549649c3 | ||
|
|
95b8492622 | ||
|
|
2036ded735 | ||
|
|
5b2720d532 | ||
|
|
da76c094ff | ||
|
|
7604538d50 | ||
|
|
2e848fb726 | ||
|
|
ee508728e9 | ||
|
|
8a8695e7f5 | ||
|
|
f2548498d7 | ||
|
|
9cde1290f7 | ||
|
|
74d8c26385 | ||
|
|
284724a6ef | ||
|
|
7efafd5528 | ||
|
|
475ad08c81 | ||
|
|
d573e74fa9 | ||
|
|
fa8069b7b7 | ||
|
|
6c9b86db09 | ||
|
|
9937208c5e | ||
|
|
3cd6b8b57e | ||
|
|
370944814c | ||
|
|
45976d7e91 | ||
|
|
b6bd614f05 | ||
|
|
5ac7bd4b67 | ||
|
|
01f614de96 | ||
|
|
e6b1198ca9 | ||
|
|
1441009e31 | ||
|
|
a5728d8c3c | ||
|
|
d5af4e999a | ||
|
|
c2bc116969 | ||
|
|
712c53a4cf | ||
|
|
dae3d657e4 | ||
|
|
cb5fd198ba | ||
|
|
074ce3254e | ||
|
|
9fdaa23943 | ||
|
|
82f5c32566 | ||
|
|
3167e28b82 | ||
|
|
04f771a598 | ||
|
|
d1de6a4353 | ||
|
|
cbe60c3f9a | ||
|
|
0a5589f110 | ||
|
|
4b8e10b97c | ||
|
|
921640a200 | ||
|
|
90a5aa1a5d | ||
|
|
f4567bad00 | ||
|
|
e43cc192cd | ||
|
|
f60fd91249 | ||
|
|
5c1c38ae8d | ||
|
|
d13628759a | ||
|
|
998998479b | ||
|
|
3b856386fc | ||
|
|
a00cf1e408 | ||
|
|
0b63b6e13d | ||
|
|
4119163c4c | ||
|
|
633b633e2b | ||
|
|
29b3707ee8 | ||
|
|
1afa64b29b | ||
|
|
c0424eaa94 | ||
|
|
6d8ced5103 | ||
|
|
dae85edde2 | ||
|
|
eed4816f9b | ||
|
|
8a0fd92b49 | ||
|
|
06500dc5c1 | ||
|
|
9026d1c37a | ||
|
|
f85ecdc357 | ||
|
|
be6253c15e | ||
|
|
87c25cf8b4 | ||
|
|
5609580094 | ||
|
|
915daad6ee | ||
|
|
ec8c487022 | ||
|
|
5f87666201 | ||
|
|
d922f1a842 | ||
|
|
da170f9dd0 | ||
|
|
43fb464f73 | ||
|
|
d751f6e4ed | ||
|
|
9c10c2009c | ||
|
|
1b28d37778 | ||
|
|
eaf7a4ec22 | ||
|
|
11f5f8e088 | ||
|
|
893fc75243 | ||
|
|
8c7b082867 | ||
|
|
9e50c1a37e | ||
|
|
4df4436772 | ||
|
|
d7b2d192d8 | ||
|
|
285ec1074a | ||
|
|
f997b9bf46 | ||
|
|
45da769ab5 | ||
|
|
d454ed4d9e | ||
|
|
c83389fcd3 | ||
|
|
71bfba0638 | ||
|
|
209ea3ba76 | ||
|
|
9340118622 | ||
|
|
8144831b6e | ||
|
|
d18100eb2d |
+5
-2
@@ -1,6 +1,9 @@
|
||||
/.gradle/
|
||||
/.gradle
|
||||
/.idea/
|
||||
/.settings/
|
||||
/build/
|
||||
/gradle/
|
||||
/target/
|
||||
src/main/main.iml
|
||||
src/test/test.iml
|
||||
bin
|
||||
.env
|
||||
Vendored
+72
@@ -0,0 +1,72 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "java",
|
||||
"name": "APIFootballUpdater",
|
||||
"request": "launch",
|
||||
"mainClass": "de.jeyp91.App",
|
||||
"envFile": "${workspaceFolder}/.env",
|
||||
"args": ["--mode", "APIFootballUpdater", "--season", "2027", "--league", "1", "--configFile", "Tippliga"]
|
||||
},
|
||||
{
|
||||
"type": "java",
|
||||
"name": "MatchesCreatorFootball",
|
||||
"request": "launch",
|
||||
"mainClass": "de.jeyp91.App",
|
||||
"envFile": "${workspaceFolder}/.env",
|
||||
"args": ["--mode", "MatchesCreatorFootball", "--season", "2027", "--league", "1", "--configFile", "Tippliga"]
|
||||
},
|
||||
{
|
||||
"type": "java",
|
||||
"name": "MatchesUpdaterFootball",
|
||||
"request": "launch",
|
||||
"mainClass": "de.jeyp91.App",
|
||||
"envFile": "${workspaceFolder}/.env",
|
||||
"args": ["--mode", "MatchesUpdaterFootball", "--season", "2027", "--league", "1", "--configFile", "Tippliga"]
|
||||
},
|
||||
{
|
||||
"type": "java",
|
||||
"name": "MatchdaysUpdater",
|
||||
"request": "launch",
|
||||
"mainClass": "de.jeyp91.App",
|
||||
"envFile": "${workspaceFolder}/.env",
|
||||
"args": ["--mode", "MatchdaysUpdater", "--season", "2027", "--league", "1", "--configFile", "Tippliga"]
|
||||
},
|
||||
{
|
||||
"type": "java",
|
||||
"name": "MatchesResultsUpdater",
|
||||
"request": "launch",
|
||||
"mainClass": "de.jeyp91.App",
|
||||
"envFile": "${workspaceFolder}/.env",
|
||||
"args": ["--mode", "MatchesResultsUpdater", "--season", "2027", "--league", "1", "--configFile", "Tippliga"]
|
||||
},
|
||||
{
|
||||
"type": "java",
|
||||
"name": "MatchesListGistUpdater",
|
||||
"request": "launch",
|
||||
"mainClass": "de.jeyp91.App",
|
||||
"envFile": "${workspaceFolder}/.env",
|
||||
"args": ["--mode", "MatchesListGistUpdater", "--season", "2027", "--league", "1", "--configFile", "Tippliga"]
|
||||
},
|
||||
{
|
||||
"type": "java",
|
||||
"name": "TeamsUpdater",
|
||||
"request": "launch",
|
||||
"mainClass": "de.jeyp91.App",
|
||||
"envFile": "${workspaceFolder}/.env",
|
||||
"args": ["--mode", "TeamsUpdater", "--season", "2027", "--league", "1", "--configFile", "Tippliga"]
|
||||
},
|
||||
{
|
||||
"type": "java",
|
||||
"name": "SeasonPreparation",
|
||||
"request": "launch",
|
||||
"mainClass": "de.jeyp91.App",
|
||||
"envFile": "${workspaceFolder}/.env",
|
||||
"args": ["--mode", "SeasonPreparation", "--season", "2027", "--league", "0", "--configFile", "Dummy"]
|
||||
}
|
||||
]
|
||||
}
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"java.compile.nullAnalysis.mode": "automatic",
|
||||
"java.configuration.updateBuildConfiguration": "interactive",
|
||||
"java.test.config": {
|
||||
"envFile": "${workspaceFolder}/.env"
|
||||
},
|
||||
"java.debug.settings.onBuildFailureProceed": true,
|
||||
"jdk.jdkhome": "/Users/julian/.local/share/mise/installs/java/22.0.2",
|
||||
"java.debug.settings.console": "internalConsole"
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
<!-- headroom:rtk-instructions -->
|
||||
# RTK (Rust Token Killer) - Token-Optimized Commands
|
||||
|
||||
When running shell commands, **always prefix with `rtk`**. This reduces context
|
||||
usage by 60-90% with zero behavior change. If rtk has no filter for a command,
|
||||
it passes through unchanged — so it is always safe to use.
|
||||
|
||||
## Key Commands
|
||||
```bash
|
||||
# Git (59-80% savings)
|
||||
rtk git status rtk git diff rtk git log
|
||||
|
||||
# Files & Search (60-75% savings)
|
||||
rtk ls <path> rtk read <file> rtk grep <pattern>
|
||||
rtk find <pattern> rtk diff <file>
|
||||
|
||||
# Build (80-90% savings) — shows errors only
|
||||
rtk ./gradlew build rtk ./gradlew compileJava
|
||||
|
||||
# Test (90-99% savings) — shows failures only
|
||||
rtk ./gradlew test
|
||||
|
||||
# Analysis (70-90% savings)
|
||||
rtk err <cmd> rtk log <file> rtk json <file>
|
||||
rtk summary <cmd> rtk deps rtk env
|
||||
|
||||
# GitHub (26-87% savings)
|
||||
rtk gh pr view <n> rtk gh run list rtk gh issue list
|
||||
|
||||
# Infrastructure (85% savings)
|
||||
rtk docker ps rtk kubectl get rtk docker logs <c>
|
||||
```
|
||||
|
||||
## Rules
|
||||
- In command chains, prefix each segment: `rtk git add . && rtk git commit -m "msg"`
|
||||
- For debugging, use raw command without rtk prefix
|
||||
- `rtk proxy <cmd>` runs command without filtering but tracks usage
|
||||
<!-- /headroom:rtk-instructions -->
|
||||
|
||||
---
|
||||
|
||||
# TLW Database Tool — Agent Guide
|
||||
|
||||
## Project Overview
|
||||
Java CLI tool managing the Tippliga Würzburg football prediction league. Syncs match data from API-Football, manages MySQL database (phpBB forum), pushes Google Calendar events, sends WhatsApp reminders via OpenAI-generated messages, and uploads fixtures to S3.
|
||||
|
||||
## Build & Test
|
||||
```bash
|
||||
./gradlew build # compile + test + jar
|
||||
./gradlew test # run all tests
|
||||
./gradlew clean test # clean build + test
|
||||
./gradlew jar # build fat JAR (all deps bundled)
|
||||
./gradlew dependencies # list dependency tree
|
||||
```
|
||||
|
||||
## Run Modes (CLI)
|
||||
```
|
||||
-m MatchdaysUpdater - Update delivery dates from match times
|
||||
-m MatchesCreatorFootball - Create match schedule from API-Football
|
||||
-m MatchesUpdaterFootball - Update match team/datetime from API-Football
|
||||
-m MatchesResultsUpdater - Push match results to website
|
||||
-m TeamsUpdater - Add missing teams to DB
|
||||
-m APIFootballUpdater - Fetch fixtures/rounds from API-Football → S3
|
||||
-m MatchesListGistUpdater - Update forum posts with fixture lists
|
||||
-m PostChecksum - Print checksum of a config post
|
||||
-m WhatsAppNotifier - Send WhatsApp reminders for missing bets
|
||||
```
|
||||
Required: `-s <season> -l <league> -c <configFile>`
|
||||
|
||||
## Architecture
|
||||
```
|
||||
App.java (CLI entry)
|
||||
├── apifootball/ — API-Football HTTP client, match model, S3 caching
|
||||
├── googlecalendar/ — Google Calendar API CRUD for matchday events
|
||||
├── teamidmatcher/ — BiMap: Tippliga team ID ↔ API-Football team ID
|
||||
├── tippliga/ — Domain models & operations (match, matchday, team, league)
|
||||
├── tippligaforum/ — MySQL DB connector, phpBB forum post management
|
||||
└── whatsapp/ — OpenAI-generated reminders, WhatsApp API sender
|
||||
```
|
||||
|
||||
## Code Conventions
|
||||
- Package: `de.jeyp91.*`
|
||||
- SQL columns referenced by ordinal position (constants like `final int SEASON = 1`)
|
||||
- Logger via SLF4J: `LoggerFactory.getLogger(Class.class)`
|
||||
- Config stored as JSON in phpBB forum posts (not local files)
|
||||
- API keys / secrets in environment variables
|
||||
|
||||
## Testing
|
||||
- JUnit 4 + TestNG
|
||||
- Tests in `src/test/java/de/jeyp91/`
|
||||
- Run single test: `./gradlew test --tests "de.jeyp91.apifootball.APIFootballMatchTest"`
|
||||
@@ -0,0 +1,136 @@
|
||||
# TLW Database Tool
|
||||
|
||||
CLI tool for **Tippliga Würzburg** football prediction league administration. Syncs match data from [API-Football](https://www.api-football.com/), manages a MySQL database backing a phpBB forum, pushes Google Calendar events, sends WhatsApp reminders with AI-generated messages via OpenAI, and uploads fixture data to S3.
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
App.java (CLI entry with argparse4j)
|
||||
├── apifootball/ — API-Football HTTP client, match model, S3 caching
|
||||
│ ├── APIFootballUpdater Fetch raw fixtures/rounds → S3
|
||||
│ ├── APIFootballConnector Singleton, reads cached S3 data, resolves matchdays
|
||||
│ ├── APIFootballMatch API-Football match model (extends BaseMatch)
|
||||
│ └── APIFootballMatchesProvider Resolves config entries to match lists
|
||||
├── googlecalendar/ — Google Calendar API CRUD
|
||||
│ ├── GoogleCalendarConnector OAuth2 + service setup
|
||||
│ ├── CalendarConfigProvider Reads calendar ID/URL from JSON resource
|
||||
│ └── TippligaGoogleEventManager Create/update/delete matchday events
|
||||
├── teamidmatcher/ — Bi-directional ID mapping
|
||||
│ ├── TeamIDMatcher HashBiMap: Tippliga team ID ↔ API-Football ID
|
||||
│ └── TeamIDMatcherTemplateCreator Generates config template from API teams
|
||||
├── tippliga/ — Domain models & operations
|
||||
│ ├── TLWMatch / TLWMatchday / TLWTeam / TLWLeague (DB-mapped models)
|
||||
│ ├── TLWMatchesCreatorFootball Build match schedule from API data
|
||||
│ ├── TLWMatchesCreatorTipperLeague Build tipper-vs-tipper league matches
|
||||
│ ├── TLWMatchesCreatorTipperPokal Build knockout tournament matches
|
||||
│ ├── TLWMatchesUpdaterFootball Update teams/datetimes from API
|
||||
│ ├── TLWMatchesResultsUpdater Push finished match results to website
|
||||
│ ├── TLWMatchdaysCreator Compute delivery dates from match times
|
||||
│ ├── TLWMatchdaysUpdater Write delivery date updates to DB + Calendar
|
||||
│ ├── TLWTeamsCreator / TLWTeamsUpdater Team management
|
||||
│ └── TLWMatchesManagerBase Shared helpers (date math, match matching)
|
||||
├── tippligaforum/ — MySQL + phpBB integration
|
||||
│ ├── TippligaSQLConnector Singleton JDBC connector (all queries)
|
||||
│ ├── TippligaConfigProvider Reads JSON config from forum posts
|
||||
│ ├── TippligaWebsiteConnector HTTP client for admin result updates
|
||||
│ └── MatchesListCreator / MatchesListForumUpdater Fixture list posts
|
||||
└── whatsapp/ — WhatsApp reminder system
|
||||
├── WhatsAppNotifier Sends messages via WhatsApp API
|
||||
├── OpenAIConnector Generates reminder text via GPT-3.5
|
||||
└── WhatsAppReminder Record: user, matchday, missing bets
|
||||
|
||||
BaseMatch — Abstract match with status/comparison/shared fields
|
||||
S3Provider — AWS S3 read/write for cached API-Football JSON
|
||||
ResourceProvider — Reads JSON config files from classpath resources
|
||||
StatusHolder — Global error flag
|
||||
```
|
||||
|
||||
## Setup
|
||||
|
||||
### Prerequisites
|
||||
- Java 17+
|
||||
- MySQL database (phpBB with Tippliga extension)
|
||||
- API-Football API key (free tier)
|
||||
- Google Calendar API service account + credentials file
|
||||
- AWS S3 bucket for fixture caching
|
||||
- WhatsApp API endpoint
|
||||
|
||||
### Environment Variables
|
||||
| Variable | Description |
|
||||
|---|---|
|
||||
| `TLW_DATABASE_USERNAME` | MySQL username |
|
||||
| `TLW_DATABASE_PASSWORD` | MySQL password |
|
||||
| `FORUM_USERNAME` | phpBB admin username (for website connector) |
|
||||
| `FORUM_PASSWORD` | phpBB admin password |
|
||||
| `OPENAI_TOKEN` | OpenAI API token (GPT reminders) |
|
||||
| `TLW_WHATSAPP_HOST` | WhatsApp API host |
|
||||
| `TLW_WHATSAPP_PORT` | WhatsApp API port |
|
||||
| `TLW_WHATSAPP_API_KEY` | WhatsApp API key |
|
||||
| `AWS_ACCESS_KEY_ID` | AWS credentials (S3) |
|
||||
| `AWS_SECRET_ACCESS_KEY` | AWS credentials (S3) |
|
||||
|
||||
### Resources
|
||||
Place these in `src/main/resources/`:
|
||||
- `Tippliga/Team_ID_Matcher_Config.json` — team ID mapping
|
||||
- `Tippliga/Ligen_v3.json` — league definitions
|
||||
- `Google_Calendar_Config.json` — calendar IDs
|
||||
- `Tippliga_Configs/<config>.json` — per-season match configs
|
||||
|
||||
Configs are stored as phpBB forum posts (JSON wrapped in `[code]` BBCode).
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
# Build fat JAR
|
||||
./gradlew jar
|
||||
|
||||
# Run modes (all require -s <season> -l <league> -c <configFile>)
|
||||
java -jar build/libs/tlw-database-tool-1.0.jar -m MatchdaysUpdater -s 2025 -l 1 -c tl_2025
|
||||
```
|
||||
|
||||
### CLI Modes
|
||||
|
||||
| Mode | Function |
|
||||
|---|---|
|
||||
| `MatchdaysUpdater` | Update delivery dates from match times, sync Google Calendar |
|
||||
| `MatchesCreatorFootball` | Create match schedule from API-Football |
|
||||
| `MatchesUpdaterFootball` | Update match teams/datetimes from API-Football |
|
||||
| `MatchesResultsUpdater` | Push finished results to website |
|
||||
| `TeamsUpdater` | Add missing teams to DB |
|
||||
| `APIFootballUpdater` | Fetch raw fixtures/rounds → S3 |
|
||||
| `MatchesListGistUpdater` | Update forum posts with fixture lists |
|
||||
| `PostChecksum` | Print MD5 checksum of a config post |
|
||||
| `WhatsAppNotifier` | Send WhatsApp reminders for missing bets |
|
||||
|
||||
### Build Commands
|
||||
```bash
|
||||
./gradlew build # compile + test + jar
|
||||
./gradlew test # run all tests
|
||||
./gradlew clean test # clean build + test
|
||||
./gradlew jar # build fat JAR
|
||||
./gradlew dependencies # list dependency tree
|
||||
```
|
||||
|
||||
## Code Conventions
|
||||
- Package: `de.jeyp91.*`
|
||||
- SQL columns referenced by ordinal position in ResultSet (constants like `final int SEASON = 1`)
|
||||
- Logger via SLF4J: `LoggerFactory.getLogger(Class.class)`
|
||||
- Match status constants inherited from `BaseMatch`
|
||||
- Config JSON stored in phpBB forum posts, loaded via `TippligaConfigProvider`
|
||||
- Secrets in environment variables only
|
||||
|
||||
## Testing
|
||||
- JUnit 4 + TestNG
|
||||
- Tests under `src/test/java/de/jeyp91/`
|
||||
- Run single test: `./gradlew test --tests "de.jeyp91.apifootball.APIFootballMatchTest"`
|
||||
|
||||
## How It Works (Data Flow)
|
||||
|
||||
1. **APIFootballUpdater** fetches fixtures/rounds from API-Football → caches in S3
|
||||
2. **APIFootballConnector** reads cached S3 data, resolves API matchdays to Tippliga matchdays
|
||||
3. **TLWMatchesCreatorFootball** config on which API matches map to which Tippliga matchdays → SQL INSERT
|
||||
4. **TLWMatchdaysCreator** computes delivery deadlines from match times
|
||||
5. **TLWMatchdaysUpdater** writes deadlines to DB + creates/updates Google Calendar events
|
||||
6. **TLWMatchesUpdaterFootball** updates team IDs, datetimes from latest API data
|
||||
7. **TLWMatchesResultsUpdater** pushes finished match results to the website via HTTP
|
||||
8. **WhatsAppNotifier** queries DB for users with missing bets, generates GPT reminders, sends via WhatsApp API
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* This file was generated by the Gradle 'init' task.
|
||||
*/
|
||||
|
||||
plugins {
|
||||
id 'com.github.ben-manes.versions' version '0.52.0'
|
||||
id 'java'
|
||||
id 'application'
|
||||
}
|
||||
|
||||
mainClassName = 'App'
|
||||
version = '1.0'
|
||||
compileJava.options.encoding = 'UTF-8'
|
||||
compileTestJava.options.encoding = 'UTF-8'
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'mysql:mysql-connector-java:8.0.33'
|
||||
implementation 'org.apache.httpcomponents:httpclient:4.5.14'
|
||||
implementation 'com.googlecode.json-simple:json-simple:1.1.1'
|
||||
implementation 'com.google.code.gson:gson:2.11.0'
|
||||
implementation 'com.google.auth:google-auth-library-oauth2-http:1.31.0'
|
||||
implementation 'com.google.api-client:google-api-client:2.7.2'
|
||||
implementation 'com.google.apis:google-api-services-calendar:v3-rev20250115-2.0.0'
|
||||
implementation 'com.google.guava:guava:33.4.0-jre'
|
||||
implementation 'commons-cli:commons-cli:1.9.0'
|
||||
implementation 'net.sourceforge.argparse4j:argparse4j:0.9.0'
|
||||
implementation 'org.slf4j:slf4j-api:1.6.1'
|
||||
implementation 'org.slf4j:slf4j-simple:1.6.1'
|
||||
implementation 'javax.xml.bind:jaxb-api:2.4.0-b180830.0359'
|
||||
implementation 'software.amazon.awssdk:s3:2.30.6'
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
testImplementation 'org.testng:testng:7.10.2'
|
||||
}
|
||||
|
||||
def envFile = file('.env')
|
||||
if (envFile.exists()) {
|
||||
def envVars = [:]
|
||||
envFile.readLines().each { line ->
|
||||
def trimmed = line.trim()
|
||||
if (trimmed && !trimmed.startsWith('#')) {
|
||||
def parts = trimmed.split('=', 2)
|
||||
if (parts.size() == 2) {
|
||||
def key = parts[0].trim()
|
||||
def value = parts[1].trim()
|
||||
if (value.startsWith('"') && value.endsWith('"')) {
|
||||
value = value.substring(1, value.length() - 1)
|
||||
}
|
||||
envVars[key] = value
|
||||
}
|
||||
}
|
||||
}
|
||||
test { environment envVars }
|
||||
}
|
||||
|
||||
jar {
|
||||
manifest {
|
||||
attributes(
|
||||
'Main-Class': 'de.jeyp91.App'
|
||||
)
|
||||
}
|
||||
manifest.attributes(
|
||||
'Multi-Release': 'true'
|
||||
)
|
||||
from {
|
||||
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
|
||||
}
|
||||
duplicatesStrategy = DuplicatesStrategy.INCLUDE
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
# apifootball — API-Football Integration
|
||||
|
||||
Fetches, caches, and serves match data from [API-Football](https://www.api-football.com/). Raw JSON is cached in S3 to avoid repeated API calls.
|
||||
|
||||
## Classes
|
||||
|
||||
### APIFootballUpdater
|
||||
HTTP client that fetches raw JSON from API-Football and writes to S3.
|
||||
|
||||
- `updateAllFixtures(season)` — fetches all leagues' fixtures
|
||||
- `updateAllRounds(season)` — fetches all leagues' round metadata
|
||||
- `getRawData(requestPath, season, league)` — calls API-Football with rate-limit retry
|
||||
- `getLeagues()` — reads league IDs from `Ligen_v3.json` resource
|
||||
|
||||
Handles the Tippliga↔API-Football season offset: for most leagues, Tippliga season N corresponds to API-Football season N-1 (except World Cup `league=1` and Euro `league=4`).
|
||||
|
||||
### APIFootballConnector
|
||||
Singleton that reads cached S3 JSON and resolves API data into `APIFootballMatch` objects.
|
||||
|
||||
- `getMatchDataByLeagueAndMatchday(league, matchday)` — all matches for a matchday
|
||||
- `getMatchDataByLeagueAndMatchID(league, id)` — single match by API fixture ID
|
||||
- `getMatchdays(leagueId)` — round metadata from S3
|
||||
- `getTeamsForLeague(season, league)` — live team list from API
|
||||
|
||||
### APIFootballMatch
|
||||
Extends `BaseMatch`. Parses a raw API-Football JSON fixture object.
|
||||
|
||||
Parses: fixture ID, league ID, team IDs + names, round string, datetime, status, fulltime/extratime/penalty scores.
|
||||
|
||||
Key method: `getMatchdayFromRoundString(season, round, leagueId)` — converts API round names (e.g. `"Regular Season - 1"`) to Tippliga matchday numbers. Falls back to the rounds JSON for non-regular-season formats.
|
||||
|
||||
### APIFootballMatchesProvider
|
||||
High-level resolver that reads matchday config (from the JSON config file) and returns flat `APIFootballMatch` lists.
|
||||
|
||||
Supports two config entry types:
|
||||
- `AllMatchesOfMatchday` — fetch all matches for a given API league+matchday
|
||||
- `SingleMatch` — fetch a specific match by API league+fixture ID
|
||||
|
||||
Honors `showTable` and `ko` flags from config.
|
||||
@@ -0,0 +1,29 @@
|
||||
# googlecalendar — Google Calendar Integration
|
||||
|
||||
Manages matchday deadline events in Google Calendar. Each matchday can have up to 3 delivery deadlines (1st, 2nd, 3rd chance).
|
||||
|
||||
## Classes
|
||||
|
||||
### GoogleCalendarConnector
|
||||
Sets up the Google Calendar API service using a service account.
|
||||
|
||||
- Reads service account credentials from `tippliga-4e0def9ef447.json` (classpath resource)
|
||||
- Uses `CalendarScopes.CALENDAR` scope
|
||||
- Returns authenticated `com.google.api.services.calendar.Calendar` service
|
||||
|
||||
### CalendarConfigProvider
|
||||
Reads calendar ID and URL from `Google_Calendar_Config.json` resource. Currently hardcoded to league 1.
|
||||
|
||||
### TippligaGoogleEventManager
|
||||
CRUD operations for matchday deadline events.
|
||||
|
||||
- `createOrUpdateEventsForMatchday(matchday)` — creates/updates up to 3 events per matchday
|
||||
- `createNewEvent()` / `updateEvent()` / `deleteEvent()` — individual event operations
|
||||
- `deleteAllEvents(season)` — wipe all events for a season
|
||||
- `updateAllMatchdays(matchdays)` — batch update; automatically deletes events for removed delivery dates
|
||||
|
||||
Event details:
|
||||
- **Summary**: `"Tippliga Spieltag N tippen!"` (or custom matchday name)
|
||||
- **Description**: season, league, matchday, delivery deadline number
|
||||
- **Location**: `https://tippliga-wuerzburg.de/app.php/football/bet`
|
||||
- **Time**: delivery deadline datetime, Europe/Berlin timezone
|
||||
@@ -0,0 +1,25 @@
|
||||
# teamidmatcher — Team ID Mapping
|
||||
|
||||
Maintains a bi-directional mapping between Tippliga (phpBB) team IDs and API-Football team IDs. Uses a Guava `HashBiMap` loaded from `Team_ID_Matcher_Config.json`.
|
||||
|
||||
## Classes
|
||||
|
||||
### TeamIDMatcher
|
||||
Singleton `HashBiMap<Integer, Integer>` mapping Tippliga IDs ↔ API-Football IDs.
|
||||
|
||||
- `getApiFootballIdFromTippligaId(id)` — Tippliga → API-Football
|
||||
- `getTippligaIdFromApiFootballId(match, homeguest)` — API-Football → Tippliga, for a given match and team side
|
||||
- `getTeamNameFromTippligaId(id)` — human-readable team name
|
||||
|
||||
Sets `StatusHolder.setError()` if a lookup fails. Used by `TLWMatch`, `TLWMatchesUpdaterFootball`, `TLWMatchesResultsUpdater`.
|
||||
|
||||
Config format (`Team_ID_Matcher_Config.json`):
|
||||
```json
|
||||
[
|
||||
{ "tippligaID": 1, "teamname": "Team Name", "apiFootballID": 12345 },
|
||||
...
|
||||
]
|
||||
```
|
||||
|
||||
### TeamIDMatcherTemplateCreator
|
||||
Utility that fetches teams from API-Football for a given league and generates a JSON config template. Useful when setting up new seasons — outputs skeleton entries with `apiFootballID` pre-filled, `tippligaID` left blank.
|
||||
@@ -0,0 +1,99 @@
|
||||
# tippliga — Domain Models & Operations
|
||||
|
||||
Core domain package with match, matchday, team, and league models plus operations for creating, updating, and managing the prediction league schedule. All extend `TLWMatchesManagerBase` or `TLWMatchesCreatorBase`.
|
||||
|
||||
## Base Classes
|
||||
|
||||
### BaseMatch (`de.jeyp91.BaseMatch`)
|
||||
Abstract class with shared match state: team IDs, goals (home/guest/overtime/penalty), datetime, status, KO flag, show-table flag, and a `COMPARISON` enum (`IDENTICAL`, `DIFFERENT`, `DIFFERENT_DATETIME`, `DIFFERENT_RESULT`).
|
||||
|
||||
Status constants:
|
||||
- `STATUS_NOTSTARTED = 0`
|
||||
- `STATUS_STARTED = 1`
|
||||
- `STATUS_PROVISIONAL_RESULT_AVAILABLE = 2`
|
||||
- `STATUS_FINISHED = 3`
|
||||
- `STATUS_NOT_EVALUATED = 4`
|
||||
|
||||
### TLWMatchesCreatorBase
|
||||
Abstract creator with `TLWMatches` list, `getSQLInsertString()` generating `REPLACE INTO` queries, `getMatchesForMatchday()`, and `getNumberOfMatchdays()`.
|
||||
|
||||
### TLWMatchesManagerBase
|
||||
Shared helpers used by updaters:
|
||||
- Date parsing from TLW (`yyyy-MM-dd HH:mm:ss`) and API-Football (`yyyy-MM-dd'T'HH:mm:ss`) formats
|
||||
- `getFirstMatchtimeTLW()` / `getFirstMatchtimeAPIFootball()` — earliest match in a list
|
||||
- `getDaysDifference()` — calendar day diff
|
||||
- `getMatchesStartingFromSecondDay()` / `getMatchesStartingFromSecondWeek()` — filter helpers for delivery date computation
|
||||
- `getMatchingMatch()` — matches an API match to a TLW match by home/guest team IDs
|
||||
|
||||
## Domain Models
|
||||
|
||||
### TLWMatch (extends BaseMatch)
|
||||
Full match model mapped from `phpbb_footb_matches` table. Multiple constructors:
|
||||
- From `ResultSet` (DB query)
|
||||
- From `APIFootballMatch` + `TeamIDMatcher` (API sync)
|
||||
- Manual constructors for creators
|
||||
- Copy constructor
|
||||
|
||||
Key methods:
|
||||
- `getSQLQueryInsert()` / `getSQLQueryReplace()` — generates SQL values
|
||||
- `updateMatch(APIFootballMatch)` — updates teams, goals, datetime from API data
|
||||
- `isSameMatchPlaceholder()` — matches placeholder config entries to existing matches
|
||||
|
||||
### TLWMatchday
|
||||
Mapped from `phpbb_footb_matchdays`. Fields: season, league, matchday, status, 3 delivery dates, matchday name, match count.
|
||||
|
||||
### TLWTeam
|
||||
Mapped from `phpbb_footb_teams`. Fields: season, league, team ID, name, short name, symbol, group ID, matchday.
|
||||
|
||||
### TLWLeague
|
||||
Mapped from `phpbb_footb_leagues`. Fields: season, league ID, league name, short name.
|
||||
|
||||
## Operations
|
||||
|
||||
### TLWMatchesCreatorFootball
|
||||
Builds match schedule from API-Football data and JSON config. For each matchday config entry:
|
||||
1. Resolves API matches via `APIFootballMatchesProvider`
|
||||
2. Creates `TLWMatch` objects with team IDs matched via `TeamIDMatcher`
|
||||
3. Fills remaining slots with placeholder matches (empty teams)
|
||||
|
||||
Handles `deliveryDateMode`: in `"single"` mode, matches beyond the first day get `status = -1` to prevent early betting on later matches.
|
||||
|
||||
### TLWMatchesCreatorTipperLeague
|
||||
Creates matches for tipper-vs-tipper leagues (where tippers are "teams"). Reads pairing config from `Tipper_Match_Pair_Config.json` and tipper-team mapping from `Tipper_Team_Config.json`.
|
||||
|
||||
### TLWMatchesCreatorTipperPokal
|
||||
Creates single-matchday knockout tournament matches from a tipper list config. Each pair of tippers is one match with `koMatch = 1` and `showTable = false`.
|
||||
|
||||
### TLWMatchesUpdaterFootball
|
||||
Compares current DB matches with latest API data and generates SQL UPDATE statements. Only operates on matchdays where the first match is still in the future. Updates:
|
||||
- Team IDs (via `TeamIDMatcher`)
|
||||
- Match datetimes
|
||||
- Status flags (0 = current matchday, -1 = next-day match, -2 = later)
|
||||
- `show_table` / `ko_match` flags
|
||||
|
||||
Also handles:
|
||||
- `addMissingMatches()` — inserts API matches not yet in DB (finds placeholder slots by datetime/formula)
|
||||
- `addPlaceholderMatches()` — adds config-defined placeholders for TBD matchups
|
||||
|
||||
### TLWMatchesResultsUpdater
|
||||
For finished matches, compares DB goals with API goals and pushes updates to the website via `TippligaWebsiteConnector`. Detects changes to:
|
||||
- Full-time goals
|
||||
- Overtime goals (for KO matches with `betKOType = 2`)
|
||||
- Penalty → overtime mapping (for `betKOType = 1` or `3`)
|
||||
- Status transitions from provisional to confirmed
|
||||
|
||||
### TLWMatchdaysCreator
|
||||
Computes delivery dates (betting deadlines) from match times. Supports two modes:
|
||||
- **"single"**: one deadline = first match time
|
||||
- **"multiple"** (default): 3 deadlines — first match, first match of second day, first match of second week
|
||||
|
||||
Also handles `additionalDeliveryDate` config flags for special matchday events.
|
||||
|
||||
### TLWMatchdaysUpdater
|
||||
Compares original DB matchdays with recomputed deadlines and generates SQL UPDATEs and Google Calendar syncs. Only updates future matchdays (deadline in the past is skipped).
|
||||
|
||||
### TLWTeamsCreator
|
||||
Extracts unique team IDs from a list of matches and generates `REPLACE INTO phpbb_footb_teams` SQL, preserving group and matchday info from match data.
|
||||
|
||||
### TLWTeamsUpdater
|
||||
Detects teams referenced in matches but not yet present in the league's team table. Generates INSERT SQL to add them (copies team metadata from existing entries in other seasons/leagues).
|
||||
@@ -0,0 +1,48 @@
|
||||
# tippligaforum — MySQL & phpBB Integration
|
||||
|
||||
Database connector, config loader, website HTTP client, and forum post management.
|
||||
|
||||
## Classes
|
||||
|
||||
### TippligaSQLConnector
|
||||
Singleton JDBC connector to the phpBB MySQL database (`d0144ddb`). Connects to production via credentials from environment variables, with a fallback to localhost.
|
||||
|
||||
All major queries in one class:
|
||||
- `getTeams()`, `getMatches()`, `getMatchdays()`, `getLeague()` — read domain objects
|
||||
- `getUpdatedMatchdaysBasedOnMatches()` — complex SQL that computes delivery deadlines from match times (uses `DATEDIFF` to split deadlines across days/weeks)
|
||||
- `getNextWhatsAppReminders(hours)` — multi-table query finding users with missing bets on upcoming matchdays, joins with reminder tracking to avoid duplicates
|
||||
- `updatePost()` / `getPost()` / `getChecksumOfPost()` — phpBB post CRUD
|
||||
- `executeQuery()` / `executeUpdate()` — raw SQL access
|
||||
- `markWhatsAppReminderAsSent()` — logs sent reminders
|
||||
|
||||
Post updates use the phpBB checksum mechanism: `post_checksum` = MD5 of XML-escaped post text.
|
||||
|
||||
### TippligaConfigProvider
|
||||
Reads JSON configuration from phpBB forum posts. Configs are stored as topics under the `Admin → Tippliga-Config → <season>` forum hierarchy.
|
||||
|
||||
- `getTippligaConfig(config)` — fetches post, strips `[code]` BBCode wrapper, parses JSON
|
||||
- `getChecksumOfConfigPost(configFile)` — reads post checksum for integrity verification
|
||||
|
||||
### TippligaWebsiteConnector
|
||||
HTTP client that logs into the phpBB frontend + admin panel and submits match results. Used by `TLWMatchesResultsUpdater`.
|
||||
|
||||
Login flow:
|
||||
1. GET login page → extract `creation_time`, `form_token`, `sid` from hidden fields
|
||||
2. POST credentials → capture session cookies
|
||||
3. GET admin panel → extract admin credential token
|
||||
4. POST admin login with `password_<credential>` parameter
|
||||
|
||||
Result submission:
|
||||
1. GET results management page → extract CSRF tokens
|
||||
2. POST form with season, league, matchday, match scores (home, guest, overtime)
|
||||
|
||||
### MatchesListCreator
|
||||
Generates a JSON match list config from raw API-Football fixture data (read from S3). Creates `SingleMatch` config entries with matchday, matchtime, team names, and fixture IDs. Used by `MatchesListForumUpdater` to create fixture list forum posts.
|
||||
|
||||
### MatchesListForumUpdater
|
||||
For each league:
|
||||
1. Creates `MatchesListCreator` from S3 fixture data
|
||||
2. Formats as pretty-printed JSON
|
||||
3. Wraps in `[code]` BBCode
|
||||
4. Finds the correct forum post (under `Admin → Tippliga-Config → <season> → Ligen → <country> <league>`)
|
||||
5. Updates the post text via `TippligaSQLConnector`
|
||||
@@ -0,0 +1,40 @@
|
||||
# whatsapp — WhatsApp Reminder System
|
||||
|
||||
Sends personalized WhatsApp reminders to users who haven't submitted their bets before the deadline. Uses OpenAI GPT-3.5 to generate natural-language reminder messages.
|
||||
|
||||
## Classes
|
||||
|
||||
### WhatsAppNotifier
|
||||
Orchestrates the reminder workflow:
|
||||
|
||||
1. Queries DB for upcoming reminders at 2 checkpoints: **24 hours** and **2 hours** before deadline
|
||||
2. For each reminder, generates a message via `OpenAIConnector`
|
||||
3. Sends via WhatsApp API (HTTP POST to configurable host:port)
|
||||
4. Marks sent reminders in DB to avoid duplicates
|
||||
|
||||
Requires env vars: `TLW_WHATSAPP_HOST`, `TLW_WHATSAPP_PORT`, `TLW_WHATSAPP_API_KEY`.
|
||||
|
||||
### OpenAIConnector
|
||||
Caches and generates reminder text via OpenAI Chat Completions API (model `gpt-3.5-turbo-0125`).
|
||||
|
||||
Prompt structure:
|
||||
- **System prompt** (German): "Generate a message reminding someone to submit missing tips. Must sound like a friend. Use correct singular/plural."
|
||||
- **User input**: JSON with league name, matchday name, delivery day, time
|
||||
- **Output template** has 2 variants — 24h deadline uses a friendly intro, 2h deadline emphasizes urgency
|
||||
|
||||
Message format:
|
||||
```
|
||||
Hey <username>,
|
||||
<AI-generated intro>
|
||||
Bitte gib die fehlenden Tipps bis <today/morgen> um <HH:MM> ab.
|
||||
Du kannst deine Tipps wie immer unter https://tippliga-wuerzburg.de/app.php/football/bet abgeben.
|
||||
Viele Grüße
|
||||
Die Tippliga Admins
|
||||
```
|
||||
|
||||
Messages are cached per (league + matchday + delivery) key to avoid repeated API calls.
|
||||
|
||||
### WhatsAppReminder
|
||||
Java `record` with fields: season, league, leagueName, matchday, matchdayName, deliveryDate, todayTomorrow, time, remainingHours, userId, username, phoneNumber, missingBets.
|
||||
|
||||
Maps directly to the SQL query result from `TippligaSQLConnector.getNextWhatsAppReminders()`.
|
||||
@@ -0,0 +1,2 @@
|
||||
#This file is generated by updateDaemonJvm
|
||||
toolchainVersion=22
|
||||
Vendored
BIN
Binary file not shown.
+6
@@ -0,0 +1,6 @@
|
||||
#Tue May 26 17:58:07 CEST 2020
|
||||
distributionUrl=https://services.gradle.org/distributions/gradle-8.12.1-bin.zip
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStorePath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
@@ -0,0 +1,185 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=`save "$@"`
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
Vendored
+104
@@ -0,0 +1,104 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
stages {
|
||||
stage('Restore tlw-database-tool') {
|
||||
steps {
|
||||
copyArtifacts filter: '**/tlw-database-tool-1.0.jar', fingerprintArtifacts: true, projectName: 'build tlw-database-tool', selector: lastSuccessful(), target: '.'
|
||||
}
|
||||
}
|
||||
stage('Execute') {
|
||||
steps {
|
||||
script {
|
||||
String jdkPath = tool name: 'OpenJDK22', type: 'jdk'
|
||||
withCredentials([
|
||||
usernamePassword(credentialsId: 'aws', usernameVariable: 'AWS_ACCESS_KEY_ID', passwordVariable: 'AWS_SECRET_ACCESS_KEY'),
|
||||
usernamePassword(credentialsId: 'forum_database', usernameVariable: 'TLW_DATABASE_USERNAME', passwordVariable: 'TLW_DATABASE_PASSWORD'),
|
||||
usernamePassword(credentialsId: 'forum_user', usernameVariable: 'FORUM_USERNAME', passwordVariable: 'FORUM_PASSWORD')
|
||||
]) {
|
||||
withEnv([
|
||||
"JAVA_HOME=${jdkPath}/jdk-22.0.2"
|
||||
]) {
|
||||
try {
|
||||
sh "java --version"
|
||||
sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode APIFootballUpdater --season ${season} --league 1 --configFile Tippliga >> log.txt 2>&1"
|
||||
sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode MatchesListGistUpdater --season ${season} --league 1 --configFile Tippliga >> log.txt 2>&1"
|
||||
} catch (Exception e) {
|
||||
telegramSendManual("TLW-Database-Tool crashed in APIFootballUpdater!")
|
||||
}
|
||||
String outputString = readFile 'log.txt'
|
||||
if(outputString != "") {
|
||||
ArrayList<String> outputList = outputString.replace("\n\n", "\n").split('\n').toList()
|
||||
outputList = clean(outputList)
|
||||
outputList.each {
|
||||
telegramSendManual(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Trigger Tool') {
|
||||
steps {
|
||||
echo 'Trigger jobs'
|
||||
build wait: false, job: 'TippligaUpdater'
|
||||
build wait: false, job: 'WTLPokalUpdater'
|
||||
build wait: false, job: 'SupercupUpdater'
|
||||
build wait: false, job: 'RelegationUpdater'
|
||||
build wait: false, job: 'LigaCupUpdater'
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
deleteDir()
|
||||
}
|
||||
failure {
|
||||
telegramSendManual("Build failed!\n${env.BUILD_URL}console")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ArrayList<String> clean(ArrayList<String> orig) {
|
||||
ArrayList<String> cleaned = new ArrayList<String>()
|
||||
orig.each{line ->
|
||||
if(line.indexOf(" [main] INFO de.jeyp91 - ") >= 0) {
|
||||
line = line.substring(20, line.size())
|
||||
}
|
||||
|
||||
if(line.indexOf(" [main] ERROR de.jeyp91") >= 0) {
|
||||
line = line.substring(20, line.size())
|
||||
}
|
||||
cleaned.add(line)
|
||||
}
|
||||
return cleaned.unique()
|
||||
}
|
||||
|
||||
def telegramSendManual(String text) {
|
||||
def encodedMessage = URLEncoder.encode(text, "UTF-8")
|
||||
println encodedMessage
|
||||
httpRequest(
|
||||
httpMode: 'GET',
|
||||
contentType: 'APPLICATION_JSON',
|
||||
responseHandle: 'NONE',
|
||||
url: "https://api.telegram.org/bot1298223079:AAEplcQpfzFG59qNYAYuSbJKtB9HMXCCE_U/sendMessage?text=$encodedMessage&chat_id=459231986&disable_web_page_preview=true",
|
||||
wrapAsMultipart: false,
|
||||
consoleLogResponseBody: true
|
||||
)
|
||||
sleep 1
|
||||
}
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
stages {
|
||||
stage('Restore tlw-database-tool') {
|
||||
steps {
|
||||
copyArtifacts filter: '**/tlw-database-tool-1.0.jar', fingerprintArtifacts: true, projectName: 'build tlw-database-tool', selector: lastSuccessful(), target: '.'
|
||||
}
|
||||
}
|
||||
stage('GetAndWriteChecksum') {
|
||||
steps {
|
||||
script {
|
||||
String jdkPath = tool name: 'OpenJDK22', type: 'jdk'
|
||||
withCredentials([
|
||||
usernamePassword(credentialsId: 'aws', usernameVariable: 'AWS_ACCESS_KEY_ID', passwordVariable: 'AWS_SECRET_ACCESS_KEY'),
|
||||
usernamePassword(credentialsId: 'forum_database', usernameVariable: 'TLW_DATABASE_USERNAME', passwordVariable: 'TLW_DATABASE_PASSWORD'),
|
||||
usernamePassword(credentialsId: 'forum_user', usernameVariable: 'FORUM_USERNAME', passwordVariable: 'FORUM_PASSWORD')
|
||||
]) {
|
||||
withEnv([
|
||||
"JAVA_HOME=${jdkPath}/jdk-22.0.2"
|
||||
]) {
|
||||
String checksum_tippliga = sh returnStdout: true, script: "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode PostChecksum --season ${season} --league 1 --configFile Tippliga 2>&1"
|
||||
writeFile file: 'checksum_tippliga.txt', text: checksum_tippliga
|
||||
archiveArtifacts artifacts: 'checksum_tippliga.txt', followSymlinks: false
|
||||
String checksum_wtlpokal = sh returnStdout: true, script: "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode PostChecksum --season ${season} --league 1 --configFile WTL-Pokal 2>&1"
|
||||
writeFile file: 'checksum_wtlpokal.txt', text: checksum_wtlpokal
|
||||
archiveArtifacts artifacts: 'checksum_wtlpokal.txt', followSymlinks: false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('CompareChecksums') {
|
||||
steps {
|
||||
copyArtifacts filter: 'checksum*', fingerprintArtifacts: true, projectName: 'CheckGistUpdates', selector: lastWithArtifacts(), target: 'last'
|
||||
script {
|
||||
String checksumTippliga = readFile 'checksum_tippliga.txt'
|
||||
String lastChecksumTippliga = readFile 'last/checksum_tippliga.txt'
|
||||
String checksumWTLPokal = readFile 'checksum_wtlpokal.txt'
|
||||
String lastChecksumWTLPokal = readFile 'last/checksum_wtlpokal.txt'
|
||||
if(!checksumTippliga.equals(lastChecksumTippliga)){
|
||||
telegramSendManual('Tippliga Update')
|
||||
build wait: false, job: 'TippligaUpdater'
|
||||
}
|
||||
if(!checksumWTLPokal.equals(lastChecksumWTLPokal)){
|
||||
telegramSendManual('WTL-Pokal Update')
|
||||
build wait: false, job: 'WTLPokalUpdater'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
failure {
|
||||
telegramSendManual("Build failed!\n${env.BUILD_URL}console")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def telegramSendManual(String text) {
|
||||
sleep 1
|
||||
def encodedMessage = URLEncoder.encode(text, "UTF-8")
|
||||
println encodedMessage
|
||||
httpRequest(
|
||||
httpMode: 'GET',
|
||||
contentType: 'APPLICATION_JSON',
|
||||
responseHandle: 'NONE',
|
||||
url: "https://api.telegram.org/bot1298223079:AAEplcQpfzFG59qNYAYuSbJKtB9HMXCCE_U/sendMessage?text=$encodedMessage&chat_id=459231986&disable_web_page_preview=true",
|
||||
wrapAsMultipart: false,
|
||||
consoleLogResponseBody: true
|
||||
)
|
||||
}
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
stages {
|
||||
stage('Restore tlw-database-tool') {
|
||||
steps {
|
||||
copyArtifacts filter: '**/tlw-database-tool-1.0.jar', fingerprintArtifacts: true, projectName: 'build tlw-database-tool', selector: lastSuccessful(), target: '.'
|
||||
}
|
||||
}
|
||||
stage('Execute') {
|
||||
steps {
|
||||
script {
|
||||
String jdkPath = tool name: 'OpenJDK22', type: 'jdk'
|
||||
withCredentials([
|
||||
usernamePassword(credentialsId: 'aws', usernameVariable: 'AWS_ACCESS_KEY_ID', passwordVariable: 'AWS_SECRET_ACCESS_KEY'),
|
||||
usernamePassword(credentialsId: 'forum_database', usernameVariable: 'TLW_DATABASE_USERNAME', passwordVariable: 'TLW_DATABASE_PASSWORD'),
|
||||
usernamePassword(credentialsId: 'forum_user', usernameVariable: 'FORUM_USERNAME', passwordVariable: 'FORUM_PASSWORD'),
|
||||
string(credentialsId: 'google_calendar_private_key_id', variable: 'GOOGLE_CALENDAR_TIPPLIGA_SERVICE_ACCOUNT_PRIVATE_KEY_ID'),
|
||||
string(credentialsId: 'google_calendar_private_key', variable: 'GOOGLE_CALENDAR_TIPPLIGA_SERVICE_ACCOUNT_PRIVATE_KEY')
|
||||
]) {
|
||||
withEnv([
|
||||
"JAVA_HOME=${jdkPath}/jdk-22.0.2"
|
||||
]) {
|
||||
try {
|
||||
sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode MatchesResultsUpdater --season ${season} --league 49 --configFile WM-Tippspiel >> log.txt 2>&1"
|
||||
sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode MatchesUpdaterFootball --season ${season} --league 49 --configFile WM-Tippspiel >> log.txt 2>&1"
|
||||
sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode MatchdaysUpdater --season ${season} --league 49 --configFile WM-Tippspiel >> log.txt 2>&1"
|
||||
sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode TeamsUpdater --season ${season} --league 49 --configFile WM-Tippspiel >> log.txt 2>&1"
|
||||
} catch (Exception e) {
|
||||
telegramSendManual("TLW-Database-Tool crashed in LigaCupUpdater!")
|
||||
}
|
||||
String outputString = readFile 'log.txt'
|
||||
if(outputString != "") {
|
||||
ArrayList<String> outputList = outputString.replace("\n\n", "\n").split('\n').toList()
|
||||
outputList = clean(outputList)
|
||||
outputList.each {
|
||||
telegramSendManual(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
deleteDir()
|
||||
}
|
||||
failure {
|
||||
telegramSendManual("Build failed!\n${env.BUILD_URL}console")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ArrayList<String> clean(ArrayList<String> orig) {
|
||||
ArrayList<String> cleaned = new ArrayList<String>()
|
||||
orig.each{line ->
|
||||
if(line.indexOf(" [main] INFO de.jeyp91 - ") >= 0) {
|
||||
line = line.substring(20, line.size())
|
||||
}
|
||||
|
||||
if(line.indexOf(" [main] ERROR de.jeyp91") >= 0) {
|
||||
line = line.substring(20, line.size())
|
||||
}
|
||||
cleaned.add(line)
|
||||
}
|
||||
return cleaned.unique()
|
||||
}
|
||||
|
||||
def telegramSendManual(String text) {
|
||||
def encodedMessage = URLEncoder.encode(text, "UTF-8")
|
||||
println encodedMessage
|
||||
httpRequest(
|
||||
httpMode: 'GET',
|
||||
contentType: 'APPLICATION_JSON',
|
||||
responseHandle: 'NONE',
|
||||
url: "https://api.telegram.org/bot1298223079:AAEplcQpfzFG59qNYAYuSbJKtB9HMXCCE_U/sendMessage?text=$encodedMessage&chat_id=459231986&disable_web_page_preview=true",
|
||||
wrapAsMultipart: false,
|
||||
consoleLogResponseBody: true
|
||||
)
|
||||
}
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
stages {
|
||||
stage('Restore tlw-database-tool') {
|
||||
steps {
|
||||
copyArtifacts filter: '**/tlw-database-tool-1.0.jar', fingerprintArtifacts: true, projectName: 'build tlw-database-tool', selector: lastSuccessful(), target: '.'
|
||||
}
|
||||
}
|
||||
stage('Execute') {
|
||||
steps {
|
||||
script {
|
||||
String jdkPath = tool name: 'OpenJDK22', type: 'jdk'
|
||||
withCredentials([
|
||||
usernamePassword(credentialsId: 'aws', usernameVariable: 'AWS_ACCESS_KEY_ID', passwordVariable: 'AWS_SECRET_ACCESS_KEY'),
|
||||
usernamePassword(credentialsId: 'forum_database', usernameVariable: 'TLW_DATABASE_USERNAME', passwordVariable: 'TLW_DATABASE_PASSWORD'),
|
||||
usernamePassword(credentialsId: 'forum_user', usernameVariable: 'FORUM_USERNAME', passwordVariable: 'FORUM_PASSWORD'),
|
||||
string(credentialsId: 'google_calendar_private_key_id', variable: 'GOOGLE_CALENDAR_TIPPLIGA_SERVICE_ACCOUNT_PRIVATE_KEY_ID'),
|
||||
string(credentialsId: 'google_calendar_private_key', variable: 'GOOGLE_CALENDAR_TIPPLIGA_SERVICE_ACCOUNT_PRIVATE_KEY')
|
||||
]) {
|
||||
withEnv([
|
||||
"JAVA_HOME=${jdkPath}/jdk-22.0.2"
|
||||
]) {
|
||||
try {
|
||||
sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode MatchesResultsUpdater --season ${season} --league 47 --configFile Relegation >> log.txt 2>&1"
|
||||
sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode MatchesUpdaterFootball --season ${season} --league 47 --configFile Relegation >> log.txt 2>&1"
|
||||
sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode MatchdaysUpdater --season ${season} --league 47 --configFile Relegation >> log.txt 2>&1"
|
||||
sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode TeamsUpdater --season ${season} --league 47 --configFile Relegation >> log.txt 2>&1"
|
||||
} catch (Exception e) {
|
||||
telegramSendManual("TLW-Database-Tool crashed in RelegationUpdater!")
|
||||
}
|
||||
String outputString = readFile 'log.txt'
|
||||
if(outputString != "") {
|
||||
ArrayList<String> outputList = outputString.replace("\n\n", "\n").split('\n').toList()
|
||||
outputList = clean(outputList)
|
||||
outputList.each {
|
||||
telegramSendManual(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
deleteDir()
|
||||
}
|
||||
failure {
|
||||
telegramSendManual("Build failed!\n${env.BUILD_URL}console")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ArrayList<String> clean(ArrayList<String> orig) {
|
||||
ArrayList<String> cleaned = new ArrayList<String>()
|
||||
orig.each{line ->
|
||||
if(line.indexOf(" [main] INFO de.jeyp91 - ") >= 0) {
|
||||
line = line.substring(20, line.size())
|
||||
}
|
||||
|
||||
if(line.indexOf(" [main] ERROR de.jeyp91") >= 0) {
|
||||
line = line.substring(20, line.size())
|
||||
}
|
||||
cleaned.add(line)
|
||||
}
|
||||
return cleaned.unique()
|
||||
}
|
||||
|
||||
def telegramSendManual(String text) {
|
||||
def encodedMessage = URLEncoder.encode(text, "UTF-8")
|
||||
println encodedMessage
|
||||
httpRequest(
|
||||
httpMode: 'GET',
|
||||
contentType: 'APPLICATION_JSON',
|
||||
responseHandle: 'NONE',
|
||||
url: "https://api.telegram.org/bot1298223079:AAEplcQpfzFG59qNYAYuSbJKtB9HMXCCE_U/sendMessage?text=$encodedMessage&chat_id=459231986&disable_web_page_preview=true",
|
||||
wrapAsMultipart: false,
|
||||
consoleLogResponseBody: true
|
||||
)
|
||||
}
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
stages {
|
||||
stage('Restore tlw-database-tool') {
|
||||
steps {
|
||||
copyArtifacts filter: '**/tlw-database-tool-1.0.jar', fingerprintArtifacts: true, projectName: 'build tlw-database-tool', selector: lastSuccessful(), target: '.'
|
||||
}
|
||||
}
|
||||
stage('Execute') {
|
||||
steps {
|
||||
script {
|
||||
String jdkPath = tool name: 'OpenJDK22', type: 'jdk'
|
||||
withCredentials([
|
||||
usernamePassword(credentialsId: 'aws', usernameVariable: 'AWS_ACCESS_KEY_ID', passwordVariable: 'AWS_SECRET_ACCESS_KEY'),
|
||||
usernamePassword(credentialsId: 'forum_database', usernameVariable: 'TLW_DATABASE_USERNAME', passwordVariable: 'TLW_DATABASE_PASSWORD'),
|
||||
usernamePassword(credentialsId: 'forum_user', usernameVariable: 'FORUM_USERNAME', passwordVariable: 'FORUM_PASSWORD'),
|
||||
string(credentialsId: 'google_calendar_private_key_id', variable: 'GOOGLE_CALENDAR_TIPPLIGA_SERVICE_ACCOUNT_PRIVATE_KEY_ID'),
|
||||
string(credentialsId: 'google_calendar_private_key', variable: 'GOOGLE_CALENDAR_TIPPLIGA_SERVICE_ACCOUNT_PRIVATE_KEY')
|
||||
]) {
|
||||
withEnv([
|
||||
"JAVA_HOME=${jdkPath}/jdk-22.0.2"
|
||||
]) {
|
||||
try {
|
||||
sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode MatchesResultsUpdater --season ${season} --league 45 --configFile Supercup >> log.txt 2>&1"
|
||||
sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode MatchesUpdaterFootball --season ${season} --league 45 --configFile Supercup >> log.txt 2>&1"
|
||||
sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode MatchdaysUpdater --season ${season} --league 45 --configFile Supercup >> log.txt 2>&1"
|
||||
sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode TeamsUpdater --season ${season} --league 45 --configFile Supercup >> log.txt 2>&1"
|
||||
} catch (Exception e) {
|
||||
telegramSendManual("TLW-Database-Tool crashed in SupercupUpdater!")
|
||||
}
|
||||
String outputString = readFile 'log.txt'
|
||||
if(outputString != "") {
|
||||
ArrayList<String> outputList = outputString.replace("\n\n", "\n").split('\n').toList()
|
||||
outputList = clean(outputList)
|
||||
outputList.each {
|
||||
telegramSendManual(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
deleteDir()
|
||||
}
|
||||
failure {
|
||||
telegramSendManual("Build failed!\n${env.BUILD_URL}console")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ArrayList<String> clean(ArrayList<String> orig) {
|
||||
ArrayList<String> cleaned = new ArrayList<String>()
|
||||
orig.each{line ->
|
||||
if(line.indexOf(" [main] INFO de.jeyp91 - ") >= 0) {
|
||||
line = line.substring(20, line.size())
|
||||
}
|
||||
|
||||
if(line.indexOf(" [main] ERROR de.jeyp91") >= 0) {
|
||||
line = line.substring(20, line.size())
|
||||
}
|
||||
cleaned.add(line)
|
||||
}
|
||||
return cleaned.unique()
|
||||
}
|
||||
|
||||
def telegramSendManual(String text) {
|
||||
def encodedMessage = URLEncoder.encode(text, "UTF-8")
|
||||
println encodedMessage
|
||||
httpRequest(
|
||||
httpMode: 'GET',
|
||||
contentType: 'APPLICATION_JSON',
|
||||
responseHandle: 'NONE',
|
||||
url: "https://api.telegram.org/bot1298223079:AAEplcQpfzFG59qNYAYuSbJKtB9HMXCCE_U/sendMessage?text=$encodedMessage&chat_id=459231986&disable_web_page_preview=true",
|
||||
wrapAsMultipart: false,
|
||||
consoleLogResponseBody: true
|
||||
)
|
||||
}
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
stages {
|
||||
stage('Restore tlw-database-tool') {
|
||||
steps {
|
||||
copyArtifacts filter: '**/tlw-database-tool-1.0.jar', fingerprintArtifacts: true, projectName: 'build tlw-database-tool', selector: lastSuccessful(), target: '.'
|
||||
}
|
||||
}
|
||||
stage('Execute') {
|
||||
steps {
|
||||
script {
|
||||
String jdkPath = tool name: 'OpenJDK22', type: 'jdk'
|
||||
withCredentials([
|
||||
usernamePassword(credentialsId: 'aws', usernameVariable: 'AWS_ACCESS_KEY_ID', passwordVariable: 'AWS_SECRET_ACCESS_KEY'),
|
||||
usernamePassword(credentialsId: 'forum_database', usernameVariable: 'TLW_DATABASE_USERNAME', passwordVariable: 'TLW_DATABASE_PASSWORD'),
|
||||
usernamePassword(credentialsId: 'forum_user', usernameVariable: 'FORUM_USERNAME', passwordVariable: 'FORUM_PASSWORD'),
|
||||
string(credentialsId: 'google_calendar_private_key_id', variable: 'GOOGLE_CALENDAR_TIPPLIGA_SERVICE_ACCOUNT_PRIVATE_KEY_ID'),
|
||||
string(credentialsId: 'google_calendar_private_key', variable: 'GOOGLE_CALENDAR_TIPPLIGA_SERVICE_ACCOUNT_PRIVATE_KEY')
|
||||
]) {
|
||||
withEnv([
|
||||
"JAVA_HOME=${jdkPath}/jdk-22.0.2"
|
||||
]) {
|
||||
try {
|
||||
sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode MatchesResultsUpdater --season ${season} --league 1 --configFile Tippliga >> log.txt 2>&1"
|
||||
sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode MatchesUpdaterFootball --season ${season} --league 1 --configFile Tippliga >> log.txt 2>&1"
|
||||
sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode MatchdaysUpdater --season ${season} --league 1 --configFile Tippliga >> log.txt 2>&1"
|
||||
sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode TeamsUpdater --season ${season} --league 1 --configFile Tippliga >> log.txt 2>&1"
|
||||
sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode MatchesResultsUpdater --season ${season} --league 2 --configFile Tippliga >> log.txt 2>&1"
|
||||
sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode MatchesUpdaterFootball --season ${season} --league 2 --configFile Tippliga >> log.txt 2>&1"
|
||||
sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode MatchdaysUpdater --season ${season} --league 2 --configFile Tippliga >> log.txt 2>&1"
|
||||
sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode TeamsUpdater --season ${season} --league 2 --configFile Tippliga >> log.txt 2>&1"
|
||||
} catch (Exception e) {
|
||||
telegramSendManual("TLW-Database-Tool crashed in TippligaUpdater!")
|
||||
}
|
||||
String outputString = readFile 'log.txt'
|
||||
echo "Output: ${outputString}"
|
||||
if(outputString != "") {
|
||||
ArrayList<String> outputList = outputString.replace("\n\n", "\n").split('\n').toList()
|
||||
outputList = clean(outputList)
|
||||
outputList.each {
|
||||
telegramSendManual(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
deleteDir()
|
||||
}
|
||||
failure {
|
||||
telegramSendManual("Build failed!\n${env.BUILD_URL}console")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ArrayList<String> clean(ArrayList<String> orig) {
|
||||
ArrayList<String> cleaned = new ArrayList<String>()
|
||||
orig.each{line ->
|
||||
if(line.indexOf(" [main] INFO de.jeyp91 - ") >= 0) {
|
||||
line = line.substring(20, line.size())
|
||||
}
|
||||
|
||||
if(line.indexOf(" [main] ERROR de.jeyp91") >= 0) {
|
||||
line = line.substring(20, line.size())
|
||||
}
|
||||
cleaned.add(line)
|
||||
}
|
||||
return cleaned.unique()
|
||||
}
|
||||
|
||||
def telegramSendManual(String text) {
|
||||
sleep 1
|
||||
if(text) {
|
||||
def encodedMessage = URLEncoder.encode(text, "UTF-8")
|
||||
println encodedMessage
|
||||
httpRequest(
|
||||
httpMode: 'GET',
|
||||
contentType: 'APPLICATION_JSON',
|
||||
responseHandle: 'NONE',
|
||||
url: "https://api.telegram.org/bot1298223079:AAEplcQpfzFG59qNYAYuSbJKtB9HMXCCE_U/sendMessage?text=$encodedMessage&chat_id=459231986&disable_web_page_preview=true",
|
||||
wrapAsMultipart: false,
|
||||
consoleLogResponseBody: true
|
||||
)
|
||||
}
|
||||
}
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
stages {
|
||||
stage('Restore tlw-database-tool') {
|
||||
steps {
|
||||
copyArtifacts filter: '**/tlw-database-tool-1.0.jar', fingerprintArtifacts: true, projectName: 'build tlw-database-tool', selector: lastSuccessful(), target: '.'
|
||||
}
|
||||
}
|
||||
stage('Execute') {
|
||||
steps {
|
||||
script {
|
||||
String jdkPath = tool name: 'OpenJDK22', type: 'jdk'
|
||||
withCredentials([
|
||||
usernamePassword(credentialsId: 'aws', usernameVariable: 'AWS_ACCESS_KEY_ID', passwordVariable: 'AWS_SECRET_ACCESS_KEY'),
|
||||
usernamePassword(credentialsId: 'forum_database', usernameVariable: 'TLW_DATABASE_USERNAME', passwordVariable: 'TLW_DATABASE_PASSWORD'),
|
||||
usernamePassword(credentialsId: 'forum_user', usernameVariable: 'FORUM_USERNAME', passwordVariable: 'FORUM_PASSWORD'),
|
||||
string(credentialsId: 'google_calendar_private_key_id', variable: 'GOOGLE_CALENDAR_TIPPLIGA_SERVICE_ACCOUNT_PRIVATE_KEY_ID'),
|
||||
string(credentialsId: 'google_calendar_private_key', variable: 'GOOGLE_CALENDAR_TIPPLIGA_SERVICE_ACCOUNT_PRIVATE_KEY')
|
||||
]) {
|
||||
withEnv([
|
||||
"JAVA_HOME=${jdkPath}/jdk-22.0.2"
|
||||
]) {
|
||||
try {
|
||||
sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode MatchesResultsUpdater --season ${season} --league 48 --configFile WTL-Pokal >> log.txt 2>&1"
|
||||
sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode MatchesUpdaterFootball --season ${season} --league 48 --configFile WTL-Pokal >> log.txt 2>&1"
|
||||
sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode MatchdaysUpdater --season ${season} --league 48 --configFile WTL-Pokal >> log.txt 2>&1"
|
||||
sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode TeamsUpdater --season ${season} --league 48 --configFile WTL-Pokal >> log.txt 2>&1"
|
||||
} catch (Exception e) {
|
||||
telegramSendManual("TLW-Database-Tool crashed in WTLPokalUpdater!")
|
||||
}
|
||||
String outputString = readFile 'log.txt'
|
||||
if(outputString != "") {
|
||||
ArrayList<String> outputList = outputString.replace("\n\n", "\n").split('\n').toList()
|
||||
outputList = clean(outputList)
|
||||
outputList.each {
|
||||
telegramSendManual(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
deleteDir()
|
||||
}
|
||||
failure {
|
||||
telegramSendManual("Build failed!\n${env.BUILD_URL}console")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ArrayList<String> clean(ArrayList<String> orig) {
|
||||
ArrayList<String> cleaned = new ArrayList<String>()
|
||||
orig.each{line ->
|
||||
if(line.indexOf(" [main] INFO de.jeyp91 - ") >= 0) {
|
||||
line = line.substring(20, line.size())
|
||||
}
|
||||
|
||||
if(line.indexOf(" [main] ERROR de.jeyp91") >= 0) {
|
||||
line = line.substring(20, line.size())
|
||||
}
|
||||
cleaned.add(line)
|
||||
}
|
||||
return cleaned.unique()
|
||||
}
|
||||
|
||||
def telegramSendManual(String text) {
|
||||
def encodedMessage = URLEncoder.encode(text, "UTF-8")
|
||||
println encodedMessage
|
||||
httpRequest(
|
||||
httpMode: 'GET',
|
||||
contentType: 'APPLICATION_JSON',
|
||||
responseHandle: 'NONE',
|
||||
url: "https://api.telegram.org/bot1298223079:AAEplcQpfzFG59qNYAYuSbJKtB9HMXCCE_U/sendMessage?text=$encodedMessage&chat_id=459231986&disable_web_page_preview=true",
|
||||
wrapAsMultipart: false,
|
||||
consoleLogResponseBody: true
|
||||
)
|
||||
}
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
stages {
|
||||
stage('Restore tlw-database-tool') {
|
||||
steps {
|
||||
copyArtifacts filter: '**/tlw-database-tool-1.0.jar', fingerprintArtifacts: true, projectName: 'build tlw-database-tool', selector: lastSuccessful(), target: '.'
|
||||
}
|
||||
}
|
||||
stage('Execute') {
|
||||
steps {
|
||||
script {
|
||||
String jdkPath = tool name: 'OpenJDK22', type: 'jdk'
|
||||
withCredentials([
|
||||
usernamePassword(credentialsId: 'aws', usernameVariable: 'AWS_ACCESS_KEY_ID', passwordVariable: 'AWS_SECRET_ACCESS_KEY'),
|
||||
usernamePassword(credentialsId: 'forum_database', usernameVariable: 'TLW_DATABASE_USERNAME', passwordVariable: 'TLW_DATABASE_PASSWORD'),
|
||||
usernamePassword(credentialsId: 'forum_user', usernameVariable: 'FORUM_USERNAME', passwordVariable: 'FORUM_PASSWORD'),
|
||||
string(credentialsId: 'WhatsApp_Token', variable: 'TLW_WHATSAPP_API_KEY'),
|
||||
string(credentialsId: 'OPENAI_TOKEN', variable: 'OPENAI_TOKEN')
|
||||
]) {
|
||||
withEnv([
|
||||
"JAVA_HOME=${jdkPath}/jdk-22.0.2",
|
||||
"TLW_WHATSAPP_HOST=https://tlw-whatsapp.codeam.io"
|
||||
]) {
|
||||
try {
|
||||
sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode WhatsAppNotifier --season ${season} --league 1 --configFile Tippliga >> log.txt 2>&1"
|
||||
} catch (Exception e) {
|
||||
telegramSendManual("TLW-Database-Tool crashed in WhatsAppReminder!")
|
||||
}
|
||||
String outputString = readFile 'log.txt'
|
||||
if(outputString != "") {
|
||||
ArrayList<String> outputList = outputString.replace("\n\n", "\n").split('\n').toList()
|
||||
outputList = clean(outputList)
|
||||
outputList.each {
|
||||
telegramSendManual(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
deleteDir()
|
||||
}
|
||||
failure {
|
||||
telegramSendManual("Build failed!\n${env.BUILD_URL}console")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ArrayList<String> clean(ArrayList<String> orig) {
|
||||
ArrayList<String> cleaned = new ArrayList<String>()
|
||||
orig.each{line ->
|
||||
if(line.indexOf(" [main] INFO de.jeyp91 - ") >= 0) {
|
||||
line = line.substring(20, line.size())
|
||||
}
|
||||
|
||||
if(line.indexOf(" [main] ERROR de.jeyp91") >= 0) {
|
||||
line = line.substring(20, line.size())
|
||||
}
|
||||
cleaned.add(line)
|
||||
}
|
||||
return cleaned.unique()
|
||||
}
|
||||
|
||||
def telegramSendManual(String text) {
|
||||
sleep 1
|
||||
if(text) {
|
||||
def encodedMessage = URLEncoder.encode(text, "UTF-8")
|
||||
println encodedMessage
|
||||
httpRequest(
|
||||
httpMode: 'GET',
|
||||
contentType: 'APPLICATION_JSON',
|
||||
responseHandle: 'NONE',
|
||||
url: "https://api.telegram.org/bot1298223079:AAEplcQpfzFG59qNYAYuSbJKtB9HMXCCE_U/sendMessage?text=$encodedMessage&chat_id=459231986&disable_web_page_preview=true",
|
||||
wrapAsMultipart: false,
|
||||
consoleLogResponseBody: true
|
||||
)
|
||||
}
|
||||
}
|
||||
Vendored
+81
@@ -0,0 +1,81 @@
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
stages {
|
||||
stage('Checkout') {
|
||||
steps {
|
||||
git branch: 'main', credentialsId: 'gitea', url: 'https://git.codeam.io/Julian/tlw-database-tool.git'
|
||||
}
|
||||
}
|
||||
stage('Build') {
|
||||
steps {
|
||||
script {
|
||||
String jdkPath = tool name: 'OpenJDK22', type: 'jdk'
|
||||
withCredentials([
|
||||
usernamePassword(credentialsId: 'aws', usernameVariable: 'AWS_ACCESS_KEY_ID', passwordVariable: 'AWS_SECRET_ACCESS_KEY'),
|
||||
usernamePassword(credentialsId: 'forum_database', usernameVariable: 'TLW_DATABASE_USERNAME', passwordVariable: 'TLW_DATABASE_PASSWORD'),
|
||||
usernamePassword(credentialsId: 'forum_user', usernameVariable: 'FORUM_USERNAME', passwordVariable: 'FORUM_PASSWORD')
|
||||
]) {
|
||||
withEnv([
|
||||
"JAVA_HOME=${jdkPath}/jdk-22.0.2"
|
||||
]) {
|
||||
sh returnStdout: false, script: "./gradlew build -x test"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Archive') {
|
||||
steps {
|
||||
archiveArtifacts artifacts: 'build/libs/tlw-database-tool-1.0.jar', followSymlinks: false
|
||||
}
|
||||
}
|
||||
stage('Trigger') {
|
||||
steps {
|
||||
echo 'Trigger jobs'
|
||||
build wait: false, job: 'TippligaUpdater'
|
||||
build wait: false, job: 'WTLPokalUpdater'
|
||||
build wait: false, job: 'SupercupUpdater'
|
||||
build wait: false, job: 'RelegationUpdater'
|
||||
build wait: false, job: 'LigaCupUpdater'
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
deleteDir()
|
||||
}
|
||||
failure {
|
||||
telegramSendManual("Build failed!\n${env.BUILD_URL}console")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ArrayList<String> clean(ArrayList<String> orig) {
|
||||
ArrayList<String> cleaned = new ArrayList<String>()
|
||||
orig.each{line ->
|
||||
if(line.indexOf(" [main] INFO de.jeyp91 - ") >= 0) {
|
||||
line = line.substring(20, line.size())
|
||||
}
|
||||
|
||||
if(line.indexOf(" [main] ERROR de.jeyp91") >= 0) {
|
||||
line = line.substring(20, line.size())
|
||||
}
|
||||
cleaned.add(line)
|
||||
}
|
||||
return cleaned.unique()
|
||||
}
|
||||
|
||||
def telegramSendManual(String text) {
|
||||
def encodedMessage = URLEncoder.encode(text, "UTF-8")
|
||||
println encodedMessage
|
||||
httpRequest(
|
||||
httpMode: 'GET',
|
||||
contentType: 'APPLICATION_JSON',
|
||||
responseHandle: 'NONE',
|
||||
url: "https://api.telegram.org/bot1298223079:AAEplcQpfzFG59qNYAYuSbJKtB9HMXCCE_U/sendMessage?text=$encodedMessage&chat_id=459231986&disable_web_page_preview=true",
|
||||
wrapAsMultipart: false,
|
||||
consoleLogResponseBody: true
|
||||
)
|
||||
sleep 1
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
/*
|
||||
* This file was generated by the Gradle 'init' task.
|
||||
*/
|
||||
|
||||
rootProject.name = 'tlw-database-tool'
|
||||
@@ -0,0 +1,136 @@
|
||||
package de.jeyp91;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import de.jeyp91.apifootball.APIFootballUpdater;
|
||||
import de.jeyp91.tippliga.TLWMatchdaysUpdater;
|
||||
import de.jeyp91.tippliga.TLWMatchesCreatorFootball;
|
||||
import de.jeyp91.tippliga.TLWMatchesResultsUpdater;
|
||||
import de.jeyp91.tippliga.TLWMatchesUpdaterFootball;
|
||||
import de.jeyp91.tippliga.TLWTeamsUpdater;
|
||||
import de.jeyp91.tippligaforum.MatchesListForumUpdater;
|
||||
import de.jeyp91.tippligaforum.SeasonForumPostsCreator;
|
||||
import de.jeyp91.tippligaforum.TippligaConfigProvider;
|
||||
import de.jeyp91.tippligaforum.TippligaSQLConnector;
|
||||
import de.jeyp91.whatsapp.WhatsAppNotifier;
|
||||
import net.sourceforge.argparse4j.ArgumentParsers;
|
||||
import net.sourceforge.argparse4j.inf.ArgumentParser;
|
||||
import net.sourceforge.argparse4j.inf.ArgumentParserException;
|
||||
import net.sourceforge.argparse4j.inf.Namespace;
|
||||
|
||||
/**
|
||||
* Hello world!
|
||||
*
|
||||
*/
|
||||
public class App {
|
||||
|
||||
private static String mode;
|
||||
private static int season;
|
||||
private static int league;
|
||||
private static String configFile;
|
||||
private static final Logger logger = LoggerFactory.getLogger(App.class);
|
||||
|
||||
public static void main(String[] args) {
|
||||
// SLF4J does not require explicit configuration here
|
||||
// Configuration can be done via an external configuration file (e.g., logback.xml)
|
||||
initOptions(args);
|
||||
String sql = "";
|
||||
String beautifulInfo = "";
|
||||
switch (mode) {
|
||||
case "MatchdaysUpdater" -> {
|
||||
TLWMatchdaysUpdater matchdaysUpdater = new TLWMatchdaysUpdater(season, league, configFile);
|
||||
sql = matchdaysUpdater.getUpdateSql();
|
||||
beautifulInfo = matchdaysUpdater.getBeautifulInfo();
|
||||
matchdaysUpdater.updateGoogleCalendar();
|
||||
}
|
||||
case "MatchesCreatorFootball" -> {
|
||||
TLWMatchesCreatorFootball creator = new TLWMatchesCreatorFootball(season, league, configFile);
|
||||
sql = creator.getSQLInsertString();
|
||||
}
|
||||
case "MatchesUpdaterFootball" -> {
|
||||
TLWMatchesUpdaterFootball tlwMatchesUpdaterFootball = new TLWMatchesUpdaterFootball(season, league, configFile);
|
||||
sql = tlwMatchesUpdaterFootball.getUpdateSQL();
|
||||
beautifulInfo = tlwMatchesUpdaterFootball.getBeautifulInfo();
|
||||
}
|
||||
case "MatchesResultsUpdater" -> {
|
||||
TLWMatchesResultsUpdater tlwMatchesResultsUpdater = new TLWMatchesResultsUpdater(season, league, configFile);
|
||||
beautifulInfo = tlwMatchesResultsUpdater.getBeautifulInfo();
|
||||
}
|
||||
case "TeamsUpdater" -> {
|
||||
TLWTeamsUpdater teamsUpdater = new TLWTeamsUpdater(season, league, configFile);
|
||||
sql = teamsUpdater.getInsertSQL();
|
||||
}
|
||||
case "APIFootballUpdater" -> {
|
||||
APIFootballUpdater apiFootballUpdater = new APIFootballUpdater();
|
||||
apiFootballUpdater.updateAllFixtures(season);
|
||||
apiFootballUpdater.updateAllRounds(season);
|
||||
}
|
||||
case "MatchesListGistUpdater" -> {
|
||||
MatchesListForumUpdater matchesListForumUpdater = new MatchesListForumUpdater();
|
||||
matchesListForumUpdater.updateAllLeagues(season);
|
||||
}
|
||||
case "SeasonPreparation" -> {
|
||||
SeasonForumPostsCreator creator = new SeasonForumPostsCreator(season);
|
||||
creator.createAllPosts();
|
||||
}
|
||||
case "PostChecksum" -> {
|
||||
TippligaConfigProvider configProvider = new TippligaConfigProvider(season);
|
||||
String checksum = configProvider.getChecksumOfConfigPost(configFile);
|
||||
System.out.println(checksum);
|
||||
}
|
||||
case "WhatsAppNotifier" -> {
|
||||
WhatsAppNotifier notifier = new WhatsAppNotifier();
|
||||
notifier.sendNotifications();
|
||||
}
|
||||
default -> {
|
||||
}
|
||||
}
|
||||
if(!StatusHolder.getError() && !sql.equals("")) {
|
||||
TippligaSQLConnector con = TippligaSQLConnector.getInstance();
|
||||
con.executeUpdate(sql);
|
||||
}
|
||||
if(!StatusHolder.getError() && !beautifulInfo.equals(""))
|
||||
logger.info(beautifulInfo);
|
||||
}
|
||||
|
||||
private static void initOptions(String[] args) {
|
||||
ArgumentParser parser = ArgumentParsers.newFor("tlw").build()
|
||||
.defaultHelp(true)
|
||||
.description("Test");
|
||||
|
||||
parser.addArgument("-m", "--mode")
|
||||
.dest("mode")
|
||||
.choices("MatchdaysUpdater", "MatchesCreatorFootball", "MatchesUpdaterFootball", "MatchesResultsUpdater", "TeamsUpdater", "APIFootballUpdater", "MatchesListGistUpdater", "PostChecksum", "WhatsAppNotifier", "SeasonPreparation")
|
||||
.help("")
|
||||
.required(true)
|
||||
.type(String.class);
|
||||
|
||||
parser.addArgument("-s", "--season")
|
||||
.dest("season")
|
||||
.required(true)
|
||||
.type(Integer.class);
|
||||
|
||||
parser.addArgument("-l", "--league")
|
||||
.dest("league")
|
||||
.required(true)
|
||||
.type(Integer.class);
|
||||
|
||||
parser.addArgument("-c", "--configFile")
|
||||
.dest("configFile")
|
||||
.required(true)
|
||||
.type(String.class);
|
||||
|
||||
Namespace res = null;
|
||||
try {
|
||||
res = parser.parseArgs(args);
|
||||
} catch (ArgumentParserException e) {
|
||||
parser.printHelp();
|
||||
System.exit(1);
|
||||
}
|
||||
mode = res.get("mode");
|
||||
season = res.get("season");
|
||||
league = res.get("league");
|
||||
configFile = res.get("configFile");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package de.jeyp91;
|
||||
|
||||
public abstract class BaseMatch {
|
||||
|
||||
public static final Integer STATUS_NOTSTARTED = 0;
|
||||
public static final Integer STATUS_STARTED = 1;
|
||||
public static final Integer STATUS_PROVISIONAL_RESULT_AVAILABLE = 2;
|
||||
public static final Integer STATUS_FINISHED = 3;
|
||||
public static final Integer STATUS_NOT_EVALUATED = 4;
|
||||
|
||||
public enum COMPARISON {
|
||||
IDENTICAL,
|
||||
DIFFERENT,
|
||||
DIFFERENT_DATETIME,
|
||||
DIFFERENT_RESULT
|
||||
}
|
||||
|
||||
protected Integer teamIdHome;
|
||||
protected Integer teamIdGuest;
|
||||
protected String teamNameHome = null;
|
||||
protected String teamNameGuest = null;
|
||||
protected Integer goalsHome = null;
|
||||
protected Integer goalsGuest = null;
|
||||
protected Integer goalsOvertimeHome = null;
|
||||
protected Integer goalsOvertimeGuest = null;
|
||||
protected Integer goalsPenaltyHome = null;
|
||||
protected Integer goalsPenaltyGuest = null;
|
||||
protected Integer matchday = null;
|
||||
protected String matchDatetime = null;
|
||||
protected Integer status = null;
|
||||
protected Integer koMatch = 0;
|
||||
protected Integer showTable = 0;
|
||||
protected COMPARISON updateStatus = COMPARISON.IDENTICAL;
|
||||
|
||||
public Integer getMatchday() {
|
||||
return this.matchday;
|
||||
}
|
||||
|
||||
public Integer getTeamIdHome() {
|
||||
return this.teamIdHome;
|
||||
}
|
||||
|
||||
public Integer getTeamIdGuest() {
|
||||
return this.teamIdGuest;
|
||||
}
|
||||
|
||||
public String getMatchDateTime() {
|
||||
return this.matchDatetime;
|
||||
}
|
||||
|
||||
public Integer getGoalsHome() {
|
||||
return this.goalsHome;
|
||||
}
|
||||
|
||||
public Integer getGoalsGuest() {
|
||||
return this.goalsGuest;
|
||||
}
|
||||
|
||||
public Integer getGoalsOvertimeHome() {
|
||||
return this.goalsOvertimeHome;
|
||||
}
|
||||
|
||||
public Integer getGoalsOvertimeGuest() {
|
||||
return this.goalsOvertimeGuest;
|
||||
}
|
||||
|
||||
public Integer getGoalsPenaltyHome() {
|
||||
return this.goalsPenaltyHome;
|
||||
}
|
||||
|
||||
public Integer getGoalsPenaltyGuest() {
|
||||
return this.goalsPenaltyGuest;
|
||||
}
|
||||
|
||||
public String getTeamNameHome() {
|
||||
return this.teamNameHome;
|
||||
}
|
||||
|
||||
public String getTeamNameGuest() {
|
||||
return this.teamNameGuest;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return this.status;
|
||||
}
|
||||
|
||||
public Integer getShowTable() {
|
||||
return this.showTable;
|
||||
}
|
||||
|
||||
public void setShowTable(boolean showTable) {
|
||||
this.showTable = showTable ? 0 : 1;
|
||||
}
|
||||
|
||||
public Boolean getKoMatch() {
|
||||
return this.koMatch == 1;
|
||||
}
|
||||
|
||||
public void setKoMatch(Boolean koMatch) {
|
||||
this.koMatch = koMatch ? 0 : 1;
|
||||
}
|
||||
|
||||
public void setUpdateStatus(COMPARISON newStatus) { this.updateStatus = newStatus; }
|
||||
|
||||
public COMPARISON getUpdateStatus() {
|
||||
return this.updateStatus;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package de.jeyp91;
|
||||
|
||||
import com.google.common.io.Resources;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
import org.json.simple.parser.ParseException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
public class ResourceProvider {
|
||||
|
||||
private static JSONArray getJSONArrayFromResource(String path) {
|
||||
URL url = Resources.getResource(path);
|
||||
String jsonConfig;
|
||||
JSONArray array = null;
|
||||
|
||||
try {
|
||||
JSONParser jsonParser = new JSONParser();
|
||||
jsonConfig = Resources.toString(url, StandardCharsets.UTF_8);
|
||||
array = (JSONArray) jsonParser.parse(jsonConfig);
|
||||
|
||||
} catch (IOException | ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
public static JSONArray getLigenConfig() {
|
||||
return getJSONArrayFromResource("Tippliga/Ligen_v3.json");
|
||||
}
|
||||
|
||||
public static JSONArray getTeamIDMatcherConfig() {
|
||||
return getJSONArrayFromResource("Tippliga/Team_ID_Matcher_Config.json");
|
||||
}
|
||||
|
||||
public static JSONArray getTipperMatchPairConfig() {
|
||||
return getJSONArrayFromResource("Tippliga/Tipper_Match_Pair_Config.json");
|
||||
}
|
||||
|
||||
public static JSONArray getTipperTeamConfig() {
|
||||
return getJSONArrayFromResource("Tippliga/Tipper_Team_Config.json");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package de.jeyp91;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
import org.json.simple.parser.ParseException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import software.amazon.awssdk.auth.credentials.EnvironmentVariableCredentialsProvider;
|
||||
import software.amazon.awssdk.core.exception.SdkClientException;
|
||||
import software.amazon.awssdk.core.sync.RequestBody;
|
||||
import software.amazon.awssdk.regions.Region;
|
||||
import software.amazon.awssdk.services.s3.S3Client;
|
||||
import software.amazon.awssdk.services.s3.model.GetObjectRequest;
|
||||
import software.amazon.awssdk.services.s3.model.NoSuchKeyException;
|
||||
import software.amazon.awssdk.services.s3.model.PutObjectRequest;
|
||||
import software.amazon.awssdk.services.s3.model.S3Exception;
|
||||
|
||||
public class S3Provider {
|
||||
private static final Region AWS_DEFAULT_REGION = Region.EU_CENTRAL_1;
|
||||
private static final String BUCKET_NAME = "tlw-database-tool-api-football-data";
|
||||
private final S3Client s3;
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(S3Provider.class);
|
||||
|
||||
public S3Provider() {
|
||||
s3 = S3Client.builder()
|
||||
.region(AWS_DEFAULT_REGION)
|
||||
.credentialsProvider(EnvironmentVariableCredentialsProvider.create())
|
||||
.build();
|
||||
}
|
||||
|
||||
private void writeToS3(String filename, String content) {
|
||||
try {
|
||||
this.s3.putObject(
|
||||
PutObjectRequest.builder()
|
||||
.bucket(BUCKET_NAME)
|
||||
.key(filename)
|
||||
.build(),
|
||||
RequestBody.fromString(content)
|
||||
);
|
||||
} catch (S3Exception e) {
|
||||
System.err.println(e.awsErrorDetails().errorMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void writeFixturesToS3(int season, int league, String content) {
|
||||
writeToS3(v3Filepath("fixtures", season, league), content);
|
||||
}
|
||||
|
||||
public void writeRoundsToS3(int season, int league, String content) {
|
||||
writeToS3(v3Filepath("rounds", season, league), content);
|
||||
}
|
||||
|
||||
private String getFileFromS3(String filename) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
try {
|
||||
GetObjectRequest getObjectRequest = GetObjectRequest.builder()
|
||||
.bucket(BUCKET_NAME)
|
||||
.key(filename)
|
||||
.build();
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(
|
||||
this.s3.getObject(getObjectRequest), StandardCharsets.UTF_8));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
builder.append(line);
|
||||
}
|
||||
} catch (SdkClientException | IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (NoSuchKeyException e) {
|
||||
logger.error(filename + " not found in S3.");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw e;
|
||||
}
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
public JSONObject getFixturesJSONFromS3(int season, int league) {
|
||||
return stringToJSONObject(getFileFromS3(v3Filepath("fixtures", season, league)));
|
||||
}
|
||||
|
||||
public JSONObject getRoundsJSONFromS3(int season, int league) {
|
||||
return stringToJSONObject(getFileFromS3(v3Filepath("rounds", season, league)));
|
||||
}
|
||||
|
||||
private JSONObject stringToJSONObject(String rawData) {
|
||||
if(rawData.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
JSONParser parser = new JSONParser();
|
||||
JSONObject data = null;
|
||||
try {
|
||||
data = (JSONObject) parser.parse(rawData);
|
||||
} catch (ParseException e) {
|
||||
/* TODO */
|
||||
e.printStackTrace();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
private String v3Filepath (String prefix, int season, int league) {
|
||||
return "v3/" + prefix + "_" + season + "_" + league + ".json";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package de.jeyp91;
|
||||
|
||||
public class StatusHolder {
|
||||
private static boolean error = false;
|
||||
public static void setError() {
|
||||
error = true;
|
||||
}
|
||||
public static boolean getError() {
|
||||
return error;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package de.jeyp91.apifootball;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
|
||||
import de.jeyp91.S3Provider;
|
||||
|
||||
public class APIFootballConnector {
|
||||
|
||||
private static APIFootballConnector conn = null;
|
||||
private final int season;
|
||||
private final HashMap<Integer, JSONObject> rounds = new HashMap<>();
|
||||
private final HashMap<Integer, JSONObject> matches = new HashMap<>();
|
||||
private static final Logger logger = LoggerFactory.getLogger(APIFootballConnector.class);
|
||||
|
||||
private APIFootballConnector(int season) {
|
||||
this.season = season;
|
||||
}
|
||||
|
||||
public static APIFootballConnector getAPIFootballConnectorInstance(int season) {
|
||||
if(conn == null) {
|
||||
conn = new APIFootballConnector(season);
|
||||
}
|
||||
return conn;
|
||||
}
|
||||
|
||||
public APIFootballMatch getMatchDataByLeagueAndMatchID(int league, int id) {
|
||||
|
||||
APIFootballMatch matchWithID = null;
|
||||
|
||||
ArrayList<APIFootballMatch> allMatches = getMatchesFromLeagueFromFile(this.season, league);
|
||||
for (APIFootballMatch singleMatch : allMatches) {
|
||||
if (singleMatch.getAPIFootBallMatchID() == id) {
|
||||
matchWithID = singleMatch;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return matchWithID;
|
||||
}
|
||||
|
||||
public ArrayList<APIFootballMatch> getMatchDataByLeagueAndMatchday(int league, int matchday) {
|
||||
|
||||
ArrayList<APIFootballMatch> matchesOfMatchday = new ArrayList<>();
|
||||
|
||||
ArrayList<APIFootballMatch> allMatches = getMatchesFromLeagueFromFile(this.season, league);
|
||||
for (APIFootballMatch singleMatch : allMatches) {
|
||||
if (singleMatch.getMatchday() == matchday) {
|
||||
matchesOfMatchday.add(singleMatch);
|
||||
}
|
||||
}
|
||||
|
||||
return matchesOfMatchday;
|
||||
}
|
||||
|
||||
public ArrayList<APIFootballMatch> getMatchesFromLeagueFromFile(int season, int leagueId) {
|
||||
ArrayList<APIFootballMatch> matchesList = new ArrayList<>();
|
||||
S3Provider prov = new S3Provider();
|
||||
|
||||
if(!this.matches.containsKey(leagueId)) {
|
||||
this.matches.put(leagueId, prov.getFixturesJSONFromS3(season, leagueId));
|
||||
}
|
||||
JSONObject matchesObject = this.matches.get(leagueId);
|
||||
JSONArray matchArray = (JSONArray) (matchesObject.get("response"));
|
||||
|
||||
for(int i = 0; i < matchArray.size(); i++) {
|
||||
try {
|
||||
APIFootballMatch match = new APIFootballMatch((JSONObject) matchArray.get(i), this.season);
|
||||
matchesList.add(match);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
return matchesList;
|
||||
}
|
||||
|
||||
public JSONObject getMatchdays(int leagueId) {
|
||||
S3Provider prov = new S3Provider();
|
||||
if(!this.rounds.containsKey(leagueId)) {
|
||||
this.rounds.put(leagueId, prov.getRoundsJSONFromS3(this.season, leagueId));
|
||||
}
|
||||
return this.rounds.get(leagueId);
|
||||
}
|
||||
|
||||
public JSONObject getTeamsForLeague(int season, int league) throws Exception {
|
||||
String requestPath = "teams";
|
||||
String content = new APIFootballUpdater().getRawData(requestPath, season, league);
|
||||
return stringToJSONObject(content);
|
||||
}
|
||||
|
||||
public static JSONObject stringToJSONObject(String rawData) {
|
||||
JSONParser parser = new JSONParser();
|
||||
JSONObject data = null;
|
||||
try {
|
||||
data = (JSONObject) parser.parse(rawData);
|
||||
} catch (Exception e) {
|
||||
/* TODO */
|
||||
e.printStackTrace();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package de.jeyp91.apifootball;
|
||||
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import de.jeyp91.BaseMatch;
|
||||
|
||||
public class APIFootballMatch extends BaseMatch {
|
||||
|
||||
private int matchId;
|
||||
private int leagueId;
|
||||
private String round;
|
||||
|
||||
public APIFootballMatch(JSONObject json, int season) throws Exception {
|
||||
this.matchId = Integer.parseInt(((JSONObject) json.get("fixture")).get("id").toString());
|
||||
this.leagueId = Integer.parseInt(((JSONObject) json.get("league")).get("id").toString());
|
||||
this.teamIdHome = Integer.valueOf(((JSONObject) ((JSONObject) json.get("teams")).get("home")).get("id").toString());
|
||||
this.teamIdGuest = Integer.valueOf(((JSONObject) ((JSONObject) json.get("teams")).get("away")).get("id").toString());
|
||||
this.teamNameHome = ((JSONObject) ((JSONObject) json.get("teams")).get("home")).get("name").toString();
|
||||
this.teamNameGuest = ((JSONObject) ((JSONObject) json.get("teams")).get("away")).get("name").toString();
|
||||
this.round = ((JSONObject) json.get("league")).get("round").toString();
|
||||
try {
|
||||
this.matchday = getMatchdayFromRoundString(season, this.round, this.leagueId);
|
||||
} catch (Exception e) {
|
||||
throw new Exception("Did not find matchday for league '" + this.leagueId + "': '" + json.get("round").toString() + "'");
|
||||
}
|
||||
this.matchDatetime = (String) ((JSONObject) json.get("fixture")).get("date");
|
||||
this.status = parseStatus(((JSONObject) ((JSONObject) json.get("fixture")).get("status")).get("short").toString());
|
||||
this.parseResult(json);
|
||||
}
|
||||
|
||||
public int getAPIFootBallMatchID() {
|
||||
return this.matchId;
|
||||
}
|
||||
|
||||
public static int getMatchdayFromRoundString(int season, String round, int leagueId) {
|
||||
round = round.replace(" ", "_");
|
||||
Integer matchday = -1;
|
||||
if (round.startsWith("Regular_Season_-_")) {
|
||||
matchday = Integer.valueOf(round.replace("Regular_Season_-_", ""));
|
||||
} else {
|
||||
APIFootballConnector con = APIFootballConnector.getAPIFootballConnectorInstance(season);
|
||||
JSONObject roundsObject = con.getMatchdays(leagueId);
|
||||
JSONArray roundsArray = (JSONArray)(roundsObject.get("response"));
|
||||
for (int i = 0; i < roundsArray.size(); i++) {
|
||||
if(roundsArray.get(i).toString().replace("_", " ").equals(round.replace("_", " "))) {
|
||||
matchday = i + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return matchday;
|
||||
}
|
||||
|
||||
private Integer getNumberOrNull(Object object) {
|
||||
return object != null ? Integer.valueOf(object.toString()) : null;
|
||||
}
|
||||
|
||||
public String getRound() {
|
||||
return this.round;
|
||||
}
|
||||
|
||||
private int parseStatus(String statusShort) {
|
||||
return switch (statusShort) {
|
||||
case "TBD", "NS" -> 0;
|
||||
case "FT", "AET", "PEN" -> 3;
|
||||
default -> 1;
|
||||
};
|
||||
}
|
||||
|
||||
private void parseResult(JSONObject json) {
|
||||
Object resultFulltime = ((JSONObject) json.get("score")).get("fulltime");
|
||||
this.goalsHome = getNumberOrNull(((JSONObject) resultFulltime).get("home"));
|
||||
this.goalsGuest = getNumberOrNull(((JSONObject) resultFulltime).get("away"));
|
||||
|
||||
Object resultExtratime = ((JSONObject) json.get("score")).get("extratime");
|
||||
this.goalsOvertimeHome = getNumberOrNull(((JSONObject) resultExtratime).get("home"));
|
||||
this.goalsOvertimeGuest = getNumberOrNull(((JSONObject) resultExtratime).get("away"));
|
||||
|
||||
Object resultPenalty = ((JSONObject) json.get("score")).get("penalty");
|
||||
this.goalsPenaltyHome = getNumberOrNull(((JSONObject) resultPenalty).get("home"));
|
||||
this.goalsPenaltyGuest = getNumberOrNull(((JSONObject) resultPenalty).get("away"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package de.jeyp91.apifootball;
|
||||
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class APIFootballMatchesProvider {
|
||||
|
||||
APIFootballConnector conn;
|
||||
public APIFootballMatchesProvider(int season) {
|
||||
this.conn = APIFootballConnector.getAPIFootballConnectorInstance(season);
|
||||
}
|
||||
|
||||
public ArrayList<APIFootballMatch> getAPIFootballMatchesFromConfig(JSONObject matchdayConfig) {
|
||||
boolean ko = false;
|
||||
try {
|
||||
ko = (boolean) matchdayConfig.get("ko");
|
||||
} catch (Exception e) {
|
||||
// Nothing to do here
|
||||
}
|
||||
ArrayList<APIFootballMatch> apiFootballMatches = new ArrayList<>();
|
||||
for (Object singleConfigObject : (JSONArray) matchdayConfig.get("matchesConfig")) {
|
||||
JSONObject singleConfig = (JSONObject) singleConfigObject;
|
||||
String type = (String) singleConfig.get("type");
|
||||
boolean showTable = false;
|
||||
switch (type) {
|
||||
case "AllMatchesOfMatchday":
|
||||
int matchesLeague = ((Long) singleConfig.get("matchesLeague")).intValue();
|
||||
int leagueMatchday = ((Long) singleConfig.get("leagueMatchday")).intValue();
|
||||
ArrayList<APIFootballMatch> matches = conn.getMatchDataByLeagueAndMatchday(matchesLeague, leagueMatchday);
|
||||
try {
|
||||
showTable = (boolean) singleConfig.get("showTable");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
boolean finalShowTable = showTable;
|
||||
boolean finalKo = ko;
|
||||
matches.forEach(apiFootballMatch -> {
|
||||
apiFootballMatch.setShowTable(finalShowTable);
|
||||
apiFootballMatch.setKoMatch(finalKo);
|
||||
});
|
||||
apiFootballMatches.addAll(matches);
|
||||
break;
|
||||
case "SingleMatch":
|
||||
int matchLeague = ((Long) singleConfig.get("matchLeague")).intValue();
|
||||
int matchId = ((Long) singleConfig.get("matchId")).intValue();
|
||||
APIFootballMatch match = conn.getMatchDataByLeagueAndMatchID(matchLeague, matchId);
|
||||
showTable = (boolean) singleConfig.get("showTable");
|
||||
match.setShowTable(showTable);
|
||||
match.setKoMatch(ko);
|
||||
apiFootballMatches.add(match);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return apiFootballMatches;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
package de.jeyp91.apifootball;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.impl.client.HttpClientBuilder;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import de.jeyp91.ResourceProvider;
|
||||
import de.jeyp91.S3Provider;
|
||||
|
||||
public class APIFootballUpdater {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(APIFootballUpdater.class);
|
||||
private static final String BASE_URL = "https://v3.football.api-sports.io/";
|
||||
|
||||
public APIFootballUpdater() {
|
||||
|
||||
}
|
||||
|
||||
public void updateFixtures(int season, int league) {
|
||||
String requestPath = "fixtures";
|
||||
S3Provider prov = new S3Provider();
|
||||
try {
|
||||
String content = getRawData(requestPath, season, league);
|
||||
prov.writeFixturesToS3(season, league, content);
|
||||
} catch (Exception e) {
|
||||
if(e.getMessage().toLowerCase().contains("rate limit'")) {
|
||||
try {
|
||||
Thread.sleep(1000 * 60);
|
||||
String content = getRawData(requestPath, season, league);
|
||||
prov.writeFixturesToS3(season, league, content);
|
||||
} catch (InterruptedException interruptedException) {
|
||||
interruptedException.printStackTrace();
|
||||
} catch (Exception exception) {
|
||||
logger.error(e.getMessage());
|
||||
}
|
||||
} else {
|
||||
logger.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateAllFixtures(int season) {
|
||||
HashSet<Integer> leagues = getLeagues();
|
||||
for (Integer league : leagues) {
|
||||
updateFixtures(season, league);
|
||||
try {
|
||||
Thread.sleep(1000*6);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateAllRounds(int season) {
|
||||
HashSet<Integer> leagues = getLeagues();
|
||||
for (Integer league : leagues) {
|
||||
updateRounds(season, league);
|
||||
try {
|
||||
Thread.sleep(1000*6);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateRounds(int season, int league) {
|
||||
String requestPath = "fixtures/rounds";
|
||||
S3Provider prov = new S3Provider();
|
||||
try {
|
||||
String content = getRawData(requestPath, season, league);
|
||||
prov.writeRoundsToS3(season, league, content);
|
||||
} catch (Exception e) {
|
||||
if(e.getMessage().toLowerCase().contains("rate limit'")) {
|
||||
try {
|
||||
Thread.sleep(1000 * 60);
|
||||
String content = getRawData(requestPath, season, league);
|
||||
prov.writeRoundsToS3(season, league, content);
|
||||
} catch (InterruptedException interruptedException) {
|
||||
interruptedException.printStackTrace();
|
||||
} catch (Exception exception) {
|
||||
logger.error(e.getMessage());
|
||||
}
|
||||
} else {
|
||||
logger.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getRawData(String requestPath, int season, int league) throws Exception {
|
||||
if(league != 1 && league != 4) {
|
||||
/**
|
||||
* Season usually is one higher in Tippliga than in API-Football.
|
||||
* e.g. 2023/24 is 2024 in Tippliga and 2023 in API-Football.
|
||||
* Because Liga Cup in Tippliga is at the end of a season, season does match World Cup (1) and Euro Championship (4)
|
||||
*/
|
||||
season--;
|
||||
}
|
||||
|
||||
HttpClient client = HttpClientBuilder.create().build();
|
||||
String requestUrl = BASE_URL + requestPath + "?season=" + (season) + "&league=" + league + "&timezone=Europe/Berlin";
|
||||
HttpGet request = new HttpGet(requestUrl);
|
||||
|
||||
// add request header
|
||||
request.addHeader("x-rapidapi-host", "v3.football.api-sports.io");
|
||||
request.addHeader("x-rapidapi-key", "a607e6a7437d9d52f3ac73e0b2704d0b");
|
||||
|
||||
HttpResponse response = client.execute(request);
|
||||
BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
|
||||
StringBuilder result = new StringBuilder();
|
||||
String line;
|
||||
while ((line = rd.readLine()) != null) {
|
||||
result.append(line);
|
||||
}
|
||||
checkErrors(requestUrl, result.toString());
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
public HashSet<Integer> getLeagues() {
|
||||
JSONArray leaguesArray = ResourceProvider.getLigenConfig();
|
||||
HashSet<Integer> leagues = new HashSet<>();
|
||||
for (Object leagueObject : leaguesArray) {
|
||||
JSONObject leagueJSONObject = (JSONObject) leagueObject;
|
||||
Integer leagueId = ((Long) leagueJSONObject.get("league_id")).intValue();
|
||||
leagues.add(leagueId);
|
||||
}
|
||||
return leagues;
|
||||
}
|
||||
|
||||
public void checkErrors(String requestUrl, String result) throws Exception {
|
||||
JSONObject resultObject = stringToJSONObject(result);
|
||||
boolean containsError = !((JSONArray) resultObject.get("errors")).isEmpty();
|
||||
// int results = Integer.parseInt(resultObject.get("results").toString());
|
||||
if(containsError) {
|
||||
String errorMessage = resultObject.get("errors").toString();
|
||||
throw new Exception(requestUrl + " returned error: '" + errorMessage + "'");
|
||||
}
|
||||
// else if (results == 0) {
|
||||
// throw new Exception(requestUrl + " did not have any results.");
|
||||
// }
|
||||
}
|
||||
|
||||
private JSONObject stringToJSONObject(String rawData) {
|
||||
|
||||
JSONParser parser = new JSONParser();
|
||||
JSONObject data = null;
|
||||
try {
|
||||
data = (JSONObject) parser.parse(rawData);
|
||||
} catch (Exception e) {
|
||||
/* TODO */
|
||||
e.printStackTrace();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package de.jeyp91.googlecalendar;
|
||||
|
||||
public class CalendarConfigProvider {
|
||||
|
||||
private static String GOOGLE_CALENDAR_ID = "825f79shtm9n3uknj99iuu2qho";
|
||||
|
||||
public static String getCalendarUrl() {
|
||||
return GOOGLE_CALENDAR_ID + "@group.calendar.google.com";
|
||||
}
|
||||
|
||||
public static String getCalendarId() {
|
||||
return GOOGLE_CALENDAR_ID;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package de.jeyp91.googlecalendar;
|
||||
|
||||
import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
|
||||
import com.google.api.client.http.javanet.NetHttpTransport;
|
||||
import com.google.api.client.json.JsonFactory;
|
||||
import com.google.api.client.json.gson.GsonFactory;
|
||||
import com.google.api.services.calendar.Calendar;
|
||||
import com.google.api.services.calendar.CalendarScopes;
|
||||
import com.google.auth.http.HttpCredentialsAdapter;
|
||||
import com.google.auth.oauth2.GoogleCredentials;
|
||||
import com.google.auth.oauth2.ServiceAccountCredentials;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.security.KeyFactory;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.PrivateKey;
|
||||
import java.security.spec.InvalidKeySpecException;
|
||||
import java.security.spec.PKCS8EncodedKeySpec;
|
||||
import java.util.Base64;
|
||||
import java.util.Collections;
|
||||
|
||||
public class GoogleCalendarConnector {
|
||||
private static final String APPLICATION_NAME = "Google Calendar API Java Quickstart";
|
||||
private static final JsonFactory JSON_FACTORY = GsonFactory.getDefaultInstance();
|
||||
|
||||
private static final String PROJECT_ID = "tippliga";
|
||||
private static final String CLIENT_MAIL = "tlw-707@tippliga.iam.gserviceaccount.com";
|
||||
private static final String CLIENT_ID = "101590566618120833710";
|
||||
private static final String TOKEN_URI = "https://oauth2.googleapis.com/token";
|
||||
|
||||
private static GoogleCredentials getGoogleCredentials() throws IOException {
|
||||
String privateKeyId = getEnv("GOOGLE_CALENDAR_TIPPLIGA_SERVICE_ACCOUNT_PRIVATE_KEY_ID");
|
||||
String privateKeyPem = getEnv("GOOGLE_CALENDAR_TIPPLIGA_SERVICE_ACCOUNT_PRIVATE_KEY");
|
||||
|
||||
GoogleCredentials credentials = ServiceAccountCredentials.newBuilder()
|
||||
.setClientEmail(CLIENT_MAIL)
|
||||
.setClientId(CLIENT_ID)
|
||||
.setPrivateKey(parsePrivateKey(privateKeyPem))
|
||||
.setPrivateKeyId(privateKeyId)
|
||||
.setProjectId(PROJECT_ID)
|
||||
.setTokenServerUri(URI.create(TOKEN_URI))
|
||||
.build()
|
||||
.createScoped(Collections.singleton(CalendarScopes.CALENDAR));
|
||||
|
||||
credentials.refreshIfExpired();
|
||||
return credentials;
|
||||
}
|
||||
|
||||
private static PrivateKey parsePrivateKey(String pemData) throws IOException {
|
||||
String normalized = pemData.replace("\\n", "\n");
|
||||
String stripped = normalized
|
||||
.replace("-----BEGIN PRIVATE KEY-----", "")
|
||||
.replace("-----END PRIVATE KEY-----", "")
|
||||
.replaceAll("\\s", "");
|
||||
byte[] encoded = Base64.getDecoder().decode(stripped);
|
||||
PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(encoded);
|
||||
try {
|
||||
KeyFactory kf = KeyFactory.getInstance("RSA");
|
||||
return kf.generatePrivate(keySpec);
|
||||
} catch (NoSuchAlgorithmException | InvalidKeySpecException e) {
|
||||
throw new IOException("Failed to parse private key", e);
|
||||
}
|
||||
}
|
||||
|
||||
private static String getEnv(String name) throws IOException {
|
||||
String value = System.getenv(name);
|
||||
if (value == null || value.isEmpty()) {
|
||||
throw new IOException("Environment variable " + name + " is not set");
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public static com.google.api.services.calendar.Calendar getSerivce() {
|
||||
Calendar service = null;
|
||||
|
||||
final NetHttpTransport HTTP_TRANSPORT;
|
||||
try {
|
||||
// Build a new authorized API client service.
|
||||
HTTP_TRANSPORT = GoogleNetHttpTransport.newTrustedTransport();
|
||||
service = new Calendar.Builder(HTTP_TRANSPORT, JSON_FACTORY, null)
|
||||
.setHttpRequestInitializer(new HttpCredentialsAdapter(getGoogleCredentials()))
|
||||
.setApplicationName(APPLICATION_NAME)
|
||||
.build();
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return service;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,213 @@
|
||||
package de.jeyp91.googlecalendar;
|
||||
|
||||
import com.google.api.client.util.DateTime;
|
||||
import com.google.api.services.calendar.Calendar;
|
||||
import com.google.api.services.calendar.model.Event;
|
||||
import com.google.api.services.calendar.model.EventDateTime;
|
||||
import com.google.api.services.calendar.model.Events;
|
||||
import de.jeyp91.tippliga.TLWMatchday;
|
||||
import de.jeyp91.tippligaforum.TippligaSQLConnector;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import static de.jeyp91.googlecalendar.GoogleCalendarConnector.getSerivce;
|
||||
|
||||
public class TippligaGoogleEventManager {
|
||||
|
||||
private static List<Event> allEvents = null;
|
||||
private static final Logger logger = LoggerFactory.getLogger(TippligaGoogleEventManager.class);
|
||||
|
||||
private static final HashMap<String, String> allLeagueNames = new HashMap<>();
|
||||
|
||||
public static List<Event> getAllEvents(Integer season) {
|
||||
if(allEvents == null) {
|
||||
allEvents = getAllEventsStartingFromDateTime(new DateTime(season-1 + "-07-01T00:00:00Z"));
|
||||
}
|
||||
return allEvents;
|
||||
}
|
||||
|
||||
public static List<Event> getAllEventsStartingFromDateTime(DateTime dateTime) {
|
||||
|
||||
Calendar service = getSerivce();
|
||||
Events events = null;
|
||||
|
||||
String calendarUrl = CalendarConfigProvider.getCalendarUrl();
|
||||
|
||||
// Build a new authorized API client service.
|
||||
try {
|
||||
events = service.events().list(calendarUrl)
|
||||
.setMaxResults(500)
|
||||
.setTimeMin(dateTime)
|
||||
.setOrderBy("startTime")
|
||||
.setSingleEvents(true)
|
||||
.execute();
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
assert events != null;
|
||||
return events.getItems();
|
||||
}
|
||||
|
||||
public static Event findEvent(List<Event> allEvents, Integer season, Integer league, Integer matchday, Integer deliveryDateNumber) {
|
||||
String description = getDescription(season, league, matchday, deliveryDateNumber);
|
||||
String descriptionHtml = getDescriptionHTML(season, league, matchday, deliveryDateNumber);
|
||||
if(matchday == 34) {
|
||||
String debug = "";
|
||||
}
|
||||
for (Event event : allEvents) {
|
||||
String eventDescription = event.getDescription();
|
||||
if (
|
||||
(eventDescription.replaceAll("\\s+","").equals(description.replaceAll("\\s+","")))
|
||||
|| eventDescription.equals(descriptionHtml)
|
||||
) {
|
||||
return event;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void createOrUpdateEventsForMatchday(TLWMatchday matchday) {
|
||||
createOrUpdateEvent(matchday, matchday.getDeliveryDate(), 1);
|
||||
if(!matchday.getDeliveryDate2().equals("")) createOrUpdateEvent(matchday, matchday.getDeliveryDate2(), 2);
|
||||
if(!matchday.getDeliveryDate3().equals("")) createOrUpdateEvent(matchday, matchday.getDeliveryDate3(), 3);
|
||||
}
|
||||
|
||||
public static void createOrUpdateEvent(TLWMatchday matchday, String deliveryDateString, Integer deliverDateNumber) {
|
||||
List<Event> allEvents = getAllEvents(matchday.getSeason());
|
||||
Event event = findEvent(allEvents, matchday.getSeason(), matchday.getLeague(), matchday.getMatchday(), deliverDateNumber);
|
||||
if(event == null) {
|
||||
createNewEvent(matchday, deliveryDateString, deliverDateNumber);
|
||||
}
|
||||
else {
|
||||
String googleEventStart = event.getStart().getDateTime().toString();
|
||||
String googleEventEnd = event.getEnd().getDateTime().toString();
|
||||
String googleEventStartBeautified = googleEventStart.substring(0, 19).replace("T", " ");
|
||||
if(!googleEventStartBeautified.equals(deliveryDateString)
|
||||
|| !googleEventEnd.equals(googleEventStart)) {
|
||||
updateEvent(event, matchday, deliveryDateString, deliverDateNumber);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void createNewEvent(TLWMatchday matchday, String deliveryDateString, Integer deliverDateNumber) {
|
||||
String calendarUrl = CalendarConfigProvider.getCalendarUrl();
|
||||
|
||||
Event event = getEvent(matchday, deliveryDateString, deliverDateNumber);
|
||||
|
||||
try {
|
||||
logger.info("Create new google calendar event for " + matchday.getSeason() + ", " + matchday.getLeague() + ", " + matchday.getMatchday() + ", " + deliverDateNumber);
|
||||
getSerivce().events().insert(calendarUrl, event).execute();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void updateEvent(Event oldEvent, TLWMatchday matchday, String deliveryDateString, Integer deliverDateNumber) {
|
||||
String calendarUrl = CalendarConfigProvider.getCalendarUrl();
|
||||
|
||||
Event event = getEvent(matchday, deliveryDateString, deliverDateNumber);
|
||||
|
||||
try {
|
||||
logger.info("Update google calendar event for " + matchday.getSeason() + ", " + matchday.getLeague() + ", " + matchday.getMatchday() + ", " + deliverDateNumber);
|
||||
Calendar.Events events = getSerivce().events();
|
||||
events.update(calendarUrl, oldEvent.getId(), event).execute();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void deleteEvent(TLWMatchday matchday, Integer deliverDateNumber) {
|
||||
String calendarUrl = CalendarConfigProvider.getCalendarUrl();
|
||||
|
||||
Event event = findEvent(getAllEvents(matchday.getSeason()), matchday.getSeason(), matchday.getLeague(), matchday.getMatchday(), deliverDateNumber);
|
||||
if(event != null) {
|
||||
try {
|
||||
logger.info("Delete google calendar event for " + matchday.getSeason() + ", " + matchday.getLeague() + ", " + matchday.getMatchday() + ", " + deliverDateNumber);
|
||||
getSerivce().events().delete(calendarUrl, event.getId()).execute();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void deleteAllEvents(int season) throws IOException {
|
||||
String calendarUrl = CalendarConfigProvider.getCalendarUrl();
|
||||
List<Event> events = getAllEvents(season);
|
||||
for(Event event : events ) {
|
||||
getSerivce().events().delete(calendarUrl, event.getId()).execute();
|
||||
}
|
||||
}
|
||||
|
||||
private static Event getEvent(TLWMatchday matchday, String deliveryDateString, Integer deliverDateNumber) {
|
||||
String matchdayName = matchday.getMatchdayName().equals("") ? matchday.getMatchday().toString() + ". Spieltag" : matchday.getMatchdayName();
|
||||
String summary = getLeagueNameCalendar(matchday.getSeason(), matchday.getLeague()) + " " + matchdayName + " tippen!";
|
||||
if(deliverDateNumber > 1) summary += " " + deliverDateNumber + ". Chance \uD83D\uDE43";
|
||||
String description = getDescription(matchday.getSeason(), matchday.getLeague(), matchday.getMatchday(), deliverDateNumber);
|
||||
String location = "https://tippliga-wuerzburg.de/app.php/football/bet";
|
||||
|
||||
LocalDateTime deliveryLocalDateTime = LocalDateTime.parse(deliveryDateString.replace(" ", "T"));
|
||||
ZonedDateTime zdtBerlin = ZonedDateTime.of(deliveryLocalDateTime, ZoneId.of("Europe/Berlin"));
|
||||
DateTime deliveryDateTime = new DateTime(zdtBerlin.toInstant().toEpochMilli());
|
||||
EventDateTime date = new EventDateTime()
|
||||
.setDateTime(deliveryDateTime)
|
||||
.setTimeZone("Europe/Berlin");
|
||||
|
||||
// Set reminder to 12 remainingHours before
|
||||
Event.Reminders reminders = new Event.Reminders();
|
||||
reminders.setUseDefault(true);
|
||||
|
||||
return new Event()
|
||||
.setSummary(summary)
|
||||
.setLocation(location)
|
||||
.setDescription(description)
|
||||
.setStart(date)
|
||||
.setEnd(date)
|
||||
.setReminders(reminders);
|
||||
}
|
||||
|
||||
private static String getDescription(Integer season, Integer league, Integer matchday, Integer deliverDateNumber) {
|
||||
league = league == 2 ? 1 : league;
|
||||
return "Saison: " + season + "\n" + "Liga: " + league + "\n" + "Spieltag: " + matchday + "\n" + "Abgabeschluss: " + deliverDateNumber;
|
||||
}
|
||||
|
||||
|
||||
private static String getDescriptionHTML(Integer season, Integer league, Integer matchday, Integer deliverDateNumber) {
|
||||
league = league == 2 ? 1 : league;
|
||||
return "Saison: " + season + "<br>" + "Liga: " + league + "<br>" + "Spieltag: " + matchday + "<br>" + "Abgabeschluss: " + deliverDateNumber;
|
||||
}
|
||||
|
||||
public static void updateAllMatchdays(ArrayList<TLWMatchday> matchdays) {
|
||||
matchdays.forEach(tlwMatchday -> {
|
||||
createOrUpdateEvent(tlwMatchday, tlwMatchday.getDeliveryDate(), 1);
|
||||
if(tlwMatchday.getDeliveryDate2().equals("")) {
|
||||
deleteEvent(tlwMatchday, 2);
|
||||
} else {
|
||||
createOrUpdateEvent(tlwMatchday, tlwMatchday.getDeliveryDate2(), 2);
|
||||
}
|
||||
if(tlwMatchday.getDeliveryDate3().equals("")) {
|
||||
deleteEvent(tlwMatchday, 3);
|
||||
} else {
|
||||
createOrUpdateEvent(tlwMatchday, tlwMatchday.getDeliveryDate3(), 3);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static String getLeagueNameCalendar(Integer season, Integer league) {
|
||||
String seasonLeagueId = season.toString() + league.toString();
|
||||
|
||||
if(!allLeagueNames.containsKey(seasonLeagueId)) {
|
||||
allLeagueNames.put(seasonLeagueId, TippligaSQLConnector.getInstance().getLeague(season.toString(), league.toString()).getLeagueNameCalendar());
|
||||
}
|
||||
return allLeagueNames.get(seasonLeagueId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package de.jeyp91.teamidmatcher;
|
||||
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import de.jeyp91.ResourceProvider;
|
||||
import de.jeyp91.StatusHolder;
|
||||
import de.jeyp91.apifootball.APIFootballMatch;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class TeamIDMatcher {
|
||||
|
||||
private static HashBiMap<Integer, Integer> ids = null;
|
||||
private static final Logger logger = LoggerFactory.getLogger(TeamIDMatcher.class);
|
||||
private static JSONArray teams;
|
||||
private static boolean init = false;
|
||||
public static final int HOME = 0;
|
||||
public static final int GUEST = 1;
|
||||
|
||||
private static void initBiMap() {
|
||||
if(!init) {
|
||||
ids = HashBiMap.create();
|
||||
|
||||
teams = ResourceProvider.getTeamIDMatcherConfig();
|
||||
|
||||
for (Object team : teams) {
|
||||
int tippligaID = ((Long) ((JSONObject) team).get("tippligaID")).intValue();
|
||||
int apiFootballID = ((Long) ((JSONObject) team).get("apiFootballID")).intValue();
|
||||
ids.put(tippligaID, apiFootballID);
|
||||
}
|
||||
|
||||
init = true;
|
||||
}
|
||||
}
|
||||
|
||||
public static Integer getApiFootballIdFromTippligaId(int id) {
|
||||
initBiMap();
|
||||
if(ids.containsKey(id)) {
|
||||
return ids.get(id);
|
||||
} else {
|
||||
logger.error("Tippliga ID: " + id + " not in ID Matcher.");
|
||||
StatusHolder.setError();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static Integer getTippligaIdFromApiFootballId(APIFootballMatch match, int homeguest) {
|
||||
Integer apiFootballId = homeguest == HOME ? match.getTeamIdHome() : match.getTeamIdGuest();
|
||||
Integer tlwId = null;
|
||||
if(apiFootballId == null) return null;
|
||||
initBiMap();
|
||||
if(ids.inverse().containsKey(apiFootballId)) {
|
||||
tlwId = ids.inverse().get(apiFootballId);
|
||||
} else {
|
||||
String teamname = homeguest == HOME ? match.getTeamNameHome() : match.getTeamNameGuest();
|
||||
logger.error("Could not find id " + apiFootballId + " for " + teamname);
|
||||
StatusHolder.setError();
|
||||
}
|
||||
return tlwId;
|
||||
}
|
||||
|
||||
public static String getTeamNameFromTippligaId(Integer id) {
|
||||
initBiMap();
|
||||
String name = "";
|
||||
for(Object team : teams) {
|
||||
int tippligaID = ((Long)((JSONObject) team).get("tippligaID")).intValue();
|
||||
if(id == tippligaID) {
|
||||
name = (((JSONObject) team).get("teamname")).toString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package de.jeyp91.teamidmatcher;
|
||||
|
||||
import de.jeyp91.apifootball.APIFootballConnector;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
public class TeamIDMatcherTemplateCreator {
|
||||
APIFootballConnector con;
|
||||
JSONArray teams;
|
||||
|
||||
public TeamIDMatcherTemplateCreator(int season, int league) throws Exception {
|
||||
this.con = APIFootballConnector.getAPIFootballConnectorInstance(season);
|
||||
JSONObject apiObject = con.getTeamsForLeague(season, league);
|
||||
JSONObject teamsObject = (JSONObject) apiObject.get("api");
|
||||
this.teams = (JSONArray) teamsObject.get("teams");
|
||||
}
|
||||
|
||||
public String getTeamsTemplate() {
|
||||
String teamsTemplate = "";
|
||||
for (Object team : this.teams) {
|
||||
JSONObject teamObject = (JSONObject) team;
|
||||
teamsTemplate += ",\n";
|
||||
teamsTemplate += " {\n";
|
||||
teamsTemplate += " \"teamname\": \"" + teamObject.get("name") + "\",\n";
|
||||
teamsTemplate += " \"tippligaID\": " + ",\n";
|
||||
teamsTemplate += " \"apiFootballID\": " + teamObject.get("team_id") + "\n";
|
||||
teamsTemplate += " }";
|
||||
}
|
||||
return teamsTemplate;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package de.jeyp91.tippliga;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class TLWLeague {
|
||||
|
||||
private Integer season = null;
|
||||
private Integer league = null;
|
||||
private String leagueName = null;
|
||||
private String leagueNameShort = null;
|
||||
|
||||
public TLWLeague(ResultSet rset) {
|
||||
final int SEASON = 1;
|
||||
final int LEAGUE = 2;
|
||||
final int LEAGUE_NAME = 3;
|
||||
final int LEAGUE_NAME_SHORT = 4;
|
||||
try {
|
||||
this.season = Integer.parseInt(rset.getString(SEASON));
|
||||
this.league = Integer.parseInt(rset.getString(LEAGUE));
|
||||
this.leagueName = rset.getString(LEAGUE_NAME);
|
||||
this.leagueNameShort = rset.getString(LEAGUE_NAME_SHORT);
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public Integer getSeason() {
|
||||
return this.season;
|
||||
}
|
||||
|
||||
public Integer getLeague() {
|
||||
return this.league;
|
||||
}
|
||||
|
||||
public String getLeagueName() {
|
||||
return this.leagueName;
|
||||
}
|
||||
|
||||
public String getLeagueNameShort() {
|
||||
return this.leagueNameShort;
|
||||
}
|
||||
|
||||
public String getLeagueNameCalendar() {
|
||||
String leagueName = this.leagueName;
|
||||
if (leagueName.equals("1. Tippliga Würzburg") || leagueName.equals("2. Tippliga Würzburg")) {
|
||||
leagueName = "Tippliga";
|
||||
}
|
||||
return leagueName;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,303 @@
|
||||
package de.jeyp91.tippliga;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import de.jeyp91.BaseMatch;
|
||||
import de.jeyp91.apifootball.APIFootballMatch;
|
||||
import de.jeyp91.teamidmatcher.TeamIDMatcher;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class TLWMatch extends BaseMatch{
|
||||
private static final Logger logger = LoggerFactory.getLogger(TLWMatch.class);
|
||||
|
||||
private Integer season = null;
|
||||
private Integer league = null;
|
||||
private Integer matchNo = null;
|
||||
private String groupId = null;
|
||||
private String formulaHome = null;
|
||||
private String formulaGuest = null;
|
||||
private String trend = null;
|
||||
private Float odd1 = null;
|
||||
private Float oddX = null;
|
||||
private Float odd2 = null;
|
||||
private Float rating = null;
|
||||
|
||||
public TLWMatch(ResultSet rset) {
|
||||
|
||||
final int SEASON = 1;
|
||||
final int LEAGUE = 2;
|
||||
final int MATCH_NO = 3;
|
||||
final int TEAM_ID_HOME = 4;
|
||||
final int TEAM_ID_GUEST = 5;
|
||||
final int GOALS_HOME = 6;
|
||||
final int GOALS_GUEST = 7;
|
||||
final int MATCHDAY = 8;
|
||||
final int STATUS = 9;
|
||||
final int MATCH_DATETIME = 10;
|
||||
final int GROUP_ID = 11;
|
||||
final int FORMULA_HOME = 12;
|
||||
final int FORMULA_GUEST = 13;
|
||||
final int KO_MATCH = 14;
|
||||
final int GOALS_OVERTIME_HOME = 15;
|
||||
final int GOALS_OVERTIME_GUEST = 16;
|
||||
final int SHOW_TABLE = 17;
|
||||
final int TREND = 18;
|
||||
final int ODD1 = 19;
|
||||
final int ODDX = 20;
|
||||
final int ODD2 = 21;
|
||||
final int RATING = 22;
|
||||
|
||||
try {
|
||||
this.season = Integer.parseInt(rset.getString(SEASON));
|
||||
this.league = Integer.parseInt(rset.getString(LEAGUE));
|
||||
this.matchNo = Integer.parseInt(rset.getString(MATCH_NO));
|
||||
this.teamIdHome = Integer.parseInt(rset.getString(TEAM_ID_HOME));
|
||||
this.teamIdGuest = Integer.parseInt(rset.getString(TEAM_ID_GUEST));
|
||||
this.goalsHome = rset.getString(GOALS_HOME).isEmpty()?null:Integer.parseInt(rset.getString(GOALS_HOME));
|
||||
this.goalsGuest = rset.getString(GOALS_GUEST).isEmpty()?null:Integer.parseInt(rset.getString(GOALS_GUEST));
|
||||
this.matchday = Integer.parseInt(rset.getString(MATCHDAY));
|
||||
this.status = Integer.parseInt(rset.getString(STATUS));
|
||||
this.matchDatetime = rset.getString(MATCH_DATETIME);
|
||||
this.groupId = rset.getString(GROUP_ID);
|
||||
this.formulaHome = rset.getString(FORMULA_HOME);
|
||||
this.formulaGuest = rset.getString(FORMULA_GUEST);
|
||||
this.koMatch = Integer.parseInt(rset.getString(KO_MATCH));
|
||||
this.goalsOvertimeHome = rset.getString(GOALS_OVERTIME_HOME).isEmpty()?null:Integer.parseInt(rset.getString(GOALS_OVERTIME_HOME));
|
||||
this.goalsOvertimeGuest = rset.getString(GOALS_OVERTIME_GUEST).isEmpty()?null:Integer.parseInt(rset.getString(GOALS_OVERTIME_GUEST));
|
||||
this.showTable = Integer.parseInt(rset.getString(SHOW_TABLE));
|
||||
this.trend = rset.getString(TREND);
|
||||
this.odd1 = Float.parseFloat(rset.getString(ODD1));
|
||||
this.oddX = Float.parseFloat(rset.getString(ODDX));
|
||||
this.odd2 = Float.parseFloat(rset.getString(ODD2));
|
||||
this.rating = Float.parseFloat(rset.getString(RATING));
|
||||
} catch (SQLException e) {
|
||||
/* TODO */
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public TLWMatch(APIFootballMatch apiFootballMatch, int season, int league, int matchday, int matchNo, int status, int koMatch, boolean showTable) {
|
||||
this.season = season;
|
||||
this.league = league;
|
||||
this.matchday = matchday;
|
||||
this.matchNo = matchNo;
|
||||
this.teamIdHome = TeamIDMatcher.getTippligaIdFromApiFootballId(apiFootballMatch, TeamIDMatcher.HOME);
|
||||
this.teamIdGuest = TeamIDMatcher.getTippligaIdFromApiFootballId(apiFootballMatch, TeamIDMatcher.GUEST);
|
||||
this.goalsHome = apiFootballMatch.getGoalsHome();
|
||||
this.goalsOvertimeHome = apiFootballMatch.getGoalsOvertimeHome();
|
||||
this.goalsOvertimeGuest = apiFootballMatch.getGoalsOvertimeGuest();
|
||||
this.goalsGuest = apiFootballMatch.getGoalsGuest();
|
||||
this.goalsHome = apiFootballMatch.getGoalsHome();
|
||||
this.goalsGuest = apiFootballMatch.getGoalsGuest();
|
||||
this.matchDatetime = apiFootballMatch.getMatchDateTime().replace("T", " ").substring(0, 19);
|
||||
this.groupId = this.getGroupFromMatchdayString(apiFootballMatch.getRound());
|
||||
this.formulaHome = "";
|
||||
this.formulaGuest = "";
|
||||
this.status = status;
|
||||
this.koMatch = koMatch;
|
||||
this.showTable = showTable ? 0 : 1;
|
||||
this.teamNameHome = apiFootballMatch.getTeamNameHome();
|
||||
this.teamNameGuest = apiFootballMatch.getTeamNameGuest();
|
||||
}
|
||||
|
||||
public TLWMatch(int season, int league, int matchday, int matchNo, String matchDatetime, int status, int koMatch) {
|
||||
this.season = season;
|
||||
this.matchday = matchday;
|
||||
this.league = league;
|
||||
this.matchNo = matchNo;
|
||||
this.status = status;
|
||||
this.koMatch = koMatch;
|
||||
this.matchDatetime = matchDatetime;
|
||||
}
|
||||
|
||||
public TLWMatch(int season, int league, int matchday, int matchNo, int status, int koMatch, String formulaHome, String formulaGuest, String matchDatetime) {
|
||||
this.season = season;
|
||||
this.matchday = matchday;
|
||||
this.league = league;
|
||||
this.matchNo = matchNo;
|
||||
this.status = status;
|
||||
this.koMatch = koMatch;
|
||||
this.formulaHome = formulaHome;
|
||||
this.formulaGuest = formulaGuest;
|
||||
this.matchDatetime = matchDatetime;
|
||||
}
|
||||
|
||||
public TLWMatch(int season, int league, int matchday, int matchNo, int teamIdHome, int teamIdGuest, String matchDatetime, int koMatch) {
|
||||
this.season = season;
|
||||
this.matchday = matchday;
|
||||
this.league = league;
|
||||
this.matchNo = matchNo;
|
||||
this.teamIdHome = teamIdHome;
|
||||
this.teamIdGuest = teamIdGuest;
|
||||
this.matchDatetime = matchDatetime;
|
||||
this.status = 0;
|
||||
this.koMatch = koMatch;
|
||||
}
|
||||
|
||||
public TLWMatch(TLWMatch referenceMatch) {
|
||||
this.season = referenceMatch.season;
|
||||
this.league = referenceMatch.league;
|
||||
this.matchday = referenceMatch.matchday;
|
||||
this.teamIdHome = referenceMatch.teamIdHome;
|
||||
this.teamIdGuest = referenceMatch.teamIdGuest;
|
||||
this.goalsHome = referenceMatch.goalsHome;
|
||||
this.goalsGuest = referenceMatch.goalsGuest;
|
||||
this.matchDatetime = referenceMatch.matchDatetime;
|
||||
this.matchNo = referenceMatch.matchNo;
|
||||
this.groupId = referenceMatch.groupId;
|
||||
this.formulaHome = referenceMatch.formulaHome;
|
||||
this.formulaGuest = referenceMatch.formulaGuest;
|
||||
this.status = referenceMatch.status;
|
||||
this.koMatch = referenceMatch.koMatch;
|
||||
this.goalsOvertimeHome = referenceMatch.goalsOvertimeHome;
|
||||
this.goalsOvertimeGuest = referenceMatch.goalsOvertimeGuest;
|
||||
this.showTable = referenceMatch.showTable;
|
||||
this.trend = referenceMatch.trend;
|
||||
this.odd1 = referenceMatch.odd1;
|
||||
this.oddX = referenceMatch.oddX;
|
||||
this.odd2 = referenceMatch.odd2;
|
||||
this.rating = referenceMatch.rating;
|
||||
}
|
||||
|
||||
public TLWMatch(String formulaHome, String formulaGuest, String matchDateTime) {
|
||||
this.teamIdHome = 0;
|
||||
this.teamIdGuest = 0;
|
||||
this.formulaHome = formulaHome;
|
||||
this.formulaGuest = formulaGuest;
|
||||
this.matchDatetime = matchDateTime;
|
||||
}
|
||||
|
||||
public Integer getSeason() {
|
||||
return this.season;
|
||||
}
|
||||
|
||||
public Integer getLeague() {
|
||||
return this.league;
|
||||
}
|
||||
|
||||
public Integer getMatchNo() {
|
||||
return this.matchNo;
|
||||
}
|
||||
|
||||
public String getGroupId() {
|
||||
return this.groupId;
|
||||
}
|
||||
|
||||
public String getFormulaHome() {
|
||||
return this.formulaHome != null ? this.formulaHome : "D";
|
||||
}
|
||||
|
||||
public String getFormulaGuest() {
|
||||
return this.formulaGuest != null ? this.formulaGuest : "D";
|
||||
}
|
||||
|
||||
public String getSQLQueryInsert() {
|
||||
return "INSERT INTO phpbb_footb_matches VALUES (" +
|
||||
getSQLQueryValues()
|
||||
+ ");";
|
||||
}
|
||||
|
||||
public String getSQLQueryReplace() {
|
||||
return "REPLACE INTO phpbb_footb_matches VALUES (" +
|
||||
getSQLQueryValues()
|
||||
+ ");";
|
||||
}
|
||||
|
||||
public String getSQLQueryValues() {
|
||||
return this.season + ", " +
|
||||
this.league + ", " +
|
||||
this.matchNo + ", " +
|
||||
nullToSqlNullString(this.teamIdHome) + ", " +
|
||||
nullToSqlNullString(this.teamIdGuest) + ", " +
|
||||
nullToSqlEmptyString(this.goalsHome) + ", " +
|
||||
nullToSqlEmptyString(this.goalsGuest) + ", " +
|
||||
this.matchday + ", " +
|
||||
this.status + ", " +
|
||||
nullToSqlEmptyString(this.matchDatetime) + ", " +
|
||||
nullToSqlEmptyString(this.groupId) + ", " +
|
||||
"'" + getFormulaHome() + "'" + ", " +
|
||||
"'" + getFormulaGuest() + "'" + ", " +
|
||||
nullToSqlEmptyString(this.koMatch) + ", " +
|
||||
nullToSqlEmptyString(this.goalsOvertimeHome) + ", " +
|
||||
nullToSqlEmptyString(this.goalsOvertimeGuest) + ", " +
|
||||
nullToSqlEmptyString(this.showTable) + ", " +
|
||||
"'','0.00','0.00','0.00','0.00'";
|
||||
}
|
||||
|
||||
private String nullToSqlEmptyString(Integer number) {
|
||||
return number != null ? number.toString() : "''";
|
||||
}
|
||||
|
||||
private String nullToSqlNullString(Integer number) {
|
||||
return number != null ? number.toString() : "0";
|
||||
}
|
||||
|
||||
private String nullToSqlEmptyString(String string) {
|
||||
return string != null ? "'"+string+"'" : "''";
|
||||
}
|
||||
|
||||
public void setGoalsHome(int goals) {
|
||||
this.goalsHome = goals;
|
||||
}
|
||||
|
||||
public void setGoalsGuest(int goals) {
|
||||
this.goalsGuest = goals;
|
||||
}
|
||||
|
||||
public void setGoalsOvertimeHome(int goals) {
|
||||
this.goalsOvertimeHome = goals;
|
||||
}
|
||||
|
||||
public void setGoalsOvertimeGuest(int goals) {
|
||||
this.goalsOvertimeGuest = goals;
|
||||
}
|
||||
|
||||
public void setMatchDateTime(String matchDateTime) {
|
||||
this.matchDatetime = matchDateTime;
|
||||
}
|
||||
|
||||
public void updateMatch(APIFootballMatch apiFootballMatch) {
|
||||
this.teamIdHome = TeamIDMatcher.getTippligaIdFromApiFootballId(apiFootballMatch, TeamIDMatcher.HOME);
|
||||
this.teamIdGuest = TeamIDMatcher.getTippligaIdFromApiFootballId(apiFootballMatch, TeamIDMatcher.GUEST);
|
||||
this.teamNameHome = apiFootballMatch.getTeamNameHome();
|
||||
this.teamNameGuest = apiFootballMatch.getTeamNameGuest();
|
||||
this.goalsHome = apiFootballMatch.getGoalsHome();
|
||||
this.goalsGuest = apiFootballMatch.getGoalsGuest();
|
||||
this.matchDatetime = apiFootballMatch.getMatchDateTime().replace("T", " ").substring(0, 19);
|
||||
}
|
||||
|
||||
private String getGroupFromMatchdayString(String matchdayString) {
|
||||
if(matchdayString.startsWith("Group ")) {
|
||||
return matchdayString.substring(6, 7);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isSameMatchPlaceholder (TLWMatch tlwMatch, TLWMatch placeholderConfigMatch) {
|
||||
String placeholderConfigMatchDateTime = placeholderConfigMatch.getMatchDateTime();
|
||||
String tlwMatchDateTime = tlwMatch.getMatchDateTime();
|
||||
String placeholderConfigMatchFormulaHome = placeholderConfigMatch.getFormulaHome();
|
||||
String tlwMatchFormulaHome = tlwMatch.getFormulaHome();
|
||||
String placeholderConfigMatchFormulaGuest = placeholderConfigMatch.getFormulaGuest();
|
||||
String tlwMatchFormulaGuest = tlwMatch.getFormulaGuest();
|
||||
if(Objects.equals(tlwMatchDateTime, placeholderConfigMatchDateTime) &&
|
||||
Objects.equals(tlwMatchFormulaHome, placeholderConfigMatchFormulaHome) &&
|
||||
Objects.equals(tlwMatchFormulaGuest, placeholderConfigMatchFormulaGuest)) {
|
||||
return true;
|
||||
}
|
||||
if(Objects.equals(tlwMatchDateTime, placeholderConfigMatchDateTime) &&
|
||||
Objects.equals(tlwMatch.getTeamIdHome(), null) &&
|
||||
Objects.equals(tlwMatch.getTeamIdGuest(), null)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package de.jeyp91.tippliga;
|
||||
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class TLWMatchday {
|
||||
|
||||
private Integer season = null;
|
||||
private Integer league = null;
|
||||
private Integer matchday = null;
|
||||
private Integer status = null;
|
||||
private String deliveryDate = null;
|
||||
private String deliveryDate2 = null;
|
||||
private String deliveryDate3 = null;
|
||||
private String matchdayName = null;
|
||||
private Integer matches = null;
|
||||
|
||||
public TLWMatchday(ResultSet rset) {
|
||||
|
||||
final int SEASON = 1;
|
||||
final int LEAGUE = 2;
|
||||
final int MATCHDAY = 3;
|
||||
final int STATUS = 4;
|
||||
final int DELIVERY_DATE = 5;
|
||||
final int DELIVERY_DATE_2 = 6;
|
||||
final int DELIVERY_DATE_3 = 7;
|
||||
final int MATCHDAY_NAME = 8;
|
||||
final int MATCHES = 9;
|
||||
|
||||
try {
|
||||
this.season = Integer.valueOf(rset.getString(SEASON));
|
||||
this.league = Integer.valueOf(rset.getString(LEAGUE));
|
||||
this.matchday = Integer.valueOf(rset.getString(MATCHDAY));
|
||||
this.status = Integer.valueOf(rset.getString(STATUS));
|
||||
this.deliveryDate = rset.getString(DELIVERY_DATE);
|
||||
this.deliveryDate2 = rset.getString(DELIVERY_DATE_2);
|
||||
this.deliveryDate3 = rset.getString(DELIVERY_DATE_3);
|
||||
this.matchdayName = rset.getString(MATCHDAY_NAME);
|
||||
this.matches = Integer.valueOf(rset.getString(MATCHES));
|
||||
} catch (SQLException e) {
|
||||
/* TODO */
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public TLWMatchday(int season, int league, int matchday, int status, String deliveryDate1, String deliveryDate2, String deliveryDate3, String matchdayName, int numberOfMatches) {
|
||||
this.season = season;
|
||||
this.league = league;
|
||||
this.matchday = matchday;
|
||||
this.status = status;
|
||||
this.deliveryDate = deliveryDate1;
|
||||
this.deliveryDate2 = deliveryDate2;
|
||||
this.deliveryDate3 = deliveryDate3;
|
||||
this.matchdayName = matchdayName;
|
||||
this.matches = numberOfMatches;
|
||||
}
|
||||
|
||||
public Integer getSeason() {
|
||||
return this.season;
|
||||
}
|
||||
|
||||
public Integer getLeague() {
|
||||
return this.league;
|
||||
}
|
||||
|
||||
public Integer getMatchday() {
|
||||
return this.matchday;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return this.status;
|
||||
}
|
||||
|
||||
public String getDeliveryDate() {
|
||||
return this.deliveryDate == null ? "" : this.deliveryDate;
|
||||
}
|
||||
|
||||
public String getDeliveryDate2() {
|
||||
return this.deliveryDate2 == null ? "" : this.deliveryDate2;
|
||||
}
|
||||
|
||||
public String getDeliveryDate3() {
|
||||
return this.deliveryDate3 == null ? "" : this.deliveryDate3;
|
||||
}
|
||||
|
||||
public String getMatchdayName() {
|
||||
return this.matchdayName;
|
||||
}
|
||||
|
||||
public Integer getMatches() {
|
||||
return this.matches;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,205 @@
|
||||
package de.jeyp91.tippliga;
|
||||
|
||||
import de.jeyp91.apifootball.APIFootballConnector;
|
||||
import de.jeyp91.apifootball.APIFootballMatch;
|
||||
import de.jeyp91.tippligaforum.TippligaConfigProvider;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class TLWMatchdaysCreator {
|
||||
|
||||
int season;
|
||||
int league;
|
||||
ArrayList<TLWMatch> matches;
|
||||
int matchesPerMatchday;
|
||||
JSONObject configObject;
|
||||
|
||||
public TLWMatchdaysCreator(int season, int league, String configPath){
|
||||
this.season = season;
|
||||
this.league = league;
|
||||
|
||||
TLWMatchesCreatorFootball matchesCreator = new TLWMatchesCreatorFootball(season, league, configPath);
|
||||
this.matches = matchesCreator.getMatches();
|
||||
|
||||
TippligaConfigProvider prov = new TippligaConfigProvider(season);
|
||||
this.configObject = prov.getTippligaConfig(configPath);
|
||||
|
||||
//Read JSON file
|
||||
this.matchesPerMatchday = ((Long) this.configObject.get("matchesPerMatchday")).intValue();
|
||||
}
|
||||
|
||||
public ArrayList<TLWMatchday> getMatchdays() {
|
||||
ArrayList<TLWMatchday> matchdays = new ArrayList<>();
|
||||
|
||||
JSONArray matchdaysConfig = (JSONArray) this.configObject.get("matchdayConfig");
|
||||
String deliveryDateMode = this.configObject.containsKey("deliveryDateMode") ? this.configObject.get("deliveryDateMode").toString() : "";
|
||||
for (Object matchdayConfig : matchdaysConfig) {
|
||||
JSONObject matchdayConfigJson = (JSONObject) matchdayConfig;
|
||||
|
||||
int matchdayNumber = Integer.parseInt(matchdayConfigJson.get("TLWMatchday").toString());
|
||||
String matchdayName = matchdayConfigJson.containsKey("matchdayName") ? matchdayConfigJson.get("matchdayName").toString() : "";
|
||||
|
||||
int numberOfMatches = this.matchesPerMatchday;
|
||||
if(numberOfMatches == 0){
|
||||
numberOfMatches = Integer.parseInt(matchdayConfigJson.get("numberOfMatches").toString());
|
||||
}
|
||||
|
||||
ArrayList<String> deliveryDates = getDeliveryDates(matchdayConfigJson, matchdayNumber, deliveryDateMode);
|
||||
|
||||
TLWMatchday matchday = new TLWMatchday(this.season, this.league, matchdayNumber, 0, deliveryDates.get(0), deliveryDates.get(1), deliveryDates.get(2), matchdayName, numberOfMatches);
|
||||
matchdays.add(matchday);
|
||||
}
|
||||
|
||||
return matchdays;
|
||||
}
|
||||
|
||||
private ArrayList<TLWMatch> getMatchesForMatchday(ArrayList<TLWMatch> matches, int matchday) {
|
||||
ArrayList<TLWMatch> matchesOfMatchday = new ArrayList<>();
|
||||
for(TLWMatch match : matches) {
|
||||
if(match.getMatchday() == matchday) {
|
||||
matchesOfMatchday.add(match);
|
||||
}
|
||||
}
|
||||
return matchesOfMatchday;
|
||||
}
|
||||
|
||||
private String getMatchdayNameFromConfig(int matchday) {
|
||||
String matchdayName = "";
|
||||
JSONArray matchdaysConfig = (JSONArray) this.configObject.get("matchdayConfig");
|
||||
for (Object matchdayConfig : matchdaysConfig) {
|
||||
if(((JSONObject) matchdayConfig).get("TLWMatchday").toString().equals(String.valueOf(matchday))
|
||||
&& ((JSONObject) matchdayConfig).containsKey("matchdayName")) {
|
||||
matchdayName = ((JSONObject) matchdayConfig).get("matchdayName").toString();
|
||||
}
|
||||
}
|
||||
return matchdayName;
|
||||
}
|
||||
|
||||
private ArrayList<String> getDeliveryDates(JSONObject matchdayConfigJson, int matchdayNumber, String deliveryDateMode) {
|
||||
ArrayList<String> deliveryDates;
|
||||
switch(deliveryDateMode) {
|
||||
case "single":
|
||||
deliveryDates = getDefaultSingleDeliveryDate(matchdayConfigJson, matchdayNumber);
|
||||
break;
|
||||
case "multiple":
|
||||
default:
|
||||
deliveryDates = getDefaultMultipleDeliveryDates(matchdayConfigJson, matchdayNumber);
|
||||
deliveryDates.addAll(getAdditionalDeliveryDates(matchdayConfigJson, matchdayNumber));
|
||||
deliveryDates = removeDuplicates(deliveryDates);
|
||||
break;
|
||||
}
|
||||
while(deliveryDates.size() < 3) {
|
||||
deliveryDates.add("");
|
||||
}
|
||||
return deliveryDates;
|
||||
}
|
||||
|
||||
private ArrayList<String> getDefaultSingleDeliveryDate(JSONObject matchdayConfigJson, int matchdayNumber) {
|
||||
ArrayList<String> deliveryDates = new ArrayList<>();
|
||||
|
||||
JSONArray matchesConfig = (JSONArray) matchdayConfigJson.get("matchesConfig");
|
||||
JSONObject matchesConfigPlaceholder = (JSONObject) matchesConfig.get(matchesConfig.size() - 1);
|
||||
ArrayList<TLWMatch> matchesOfMatchday = getMatchesForMatchday(matches, matchdayNumber);
|
||||
if(matchesOfMatchday.size() == 0) {
|
||||
deliveryDates.add(matchesConfigPlaceholder.get("placeholderDatetime").toString());
|
||||
}
|
||||
else {
|
||||
LocalDateTime firstMatchDate = TLWMatchesManagerBase.getFirstMatchtimeTLW(matchesOfMatchday);
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
deliveryDates.add(firstMatchDate.format(formatter));
|
||||
}
|
||||
|
||||
return deliveryDates;
|
||||
}
|
||||
|
||||
private ArrayList<String> getDefaultMultipleDeliveryDates(JSONObject matchdayConfigJson, int matchdayNumber) {
|
||||
ArrayList<String> deliveryDates = new ArrayList<>();
|
||||
|
||||
JSONArray matchesConfig = (JSONArray) matchdayConfigJson.get("matchesConfig");
|
||||
JSONObject matchesConfigPlaceholder = (JSONObject) matchesConfig.get(matchesConfig.size() - 1);
|
||||
ArrayList<TLWMatch> matchesOfMatchday = getMatchesForMatchday(matches, matchdayNumber);
|
||||
if(matchesOfMatchday.size() == 0) {
|
||||
deliveryDates.add(matchesConfigPlaceholder.get("placeholderDatetime").toString());
|
||||
}
|
||||
else {
|
||||
LocalDateTime firstMatchDate = TLWMatchesManagerBase.getFirstMatchtimeTLW(matchesOfMatchday);
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
deliveryDates.add(firstMatchDate.format(formatter));
|
||||
|
||||
ArrayList<TLWMatch> matchesSecondDay = TLWMatchesManagerBase.getMatchesStartingFromSecondDay(matchesOfMatchday);
|
||||
if(matchesSecondDay.size() > 0) {
|
||||
firstMatchDate = TLWMatchesManagerBase.getFirstMatchtimeTLW(matchesSecondDay);
|
||||
deliveryDates.add(firstMatchDate.format(formatter));
|
||||
}
|
||||
|
||||
ArrayList<TLWMatch> matchesSecondWeek = TLWMatchesManagerBase.getMatchesStartingFromSecondWeek(matchesOfMatchday);
|
||||
if(matchesSecondWeek.size() > 0) {
|
||||
firstMatchDate = TLWMatchesManagerBase.getFirstMatchtimeTLW(matchesSecondWeek);
|
||||
deliveryDates.add(firstMatchDate.format(formatter));
|
||||
}
|
||||
}
|
||||
|
||||
return deliveryDates;
|
||||
}
|
||||
|
||||
private ArrayList<String> getAdditionalDeliveryDates(JSONObject matchdayConfigJson, int matchdayNumber) {
|
||||
ArrayList<String> deliveryDates = new ArrayList<>();
|
||||
JSONArray matchesConfig = (JSONArray) matchdayConfigJson.get("matchesConfig");
|
||||
|
||||
APIFootballConnector conn = APIFootballConnector.getAPIFootballConnectorInstance(this.season);
|
||||
for(Object config: matchesConfig) {
|
||||
JSONObject jsonConfig = (JSONObject) config;
|
||||
if(jsonConfig.containsKey("additionalDeliveryDate") &&
|
||||
((Boolean) jsonConfig.get("additionalDeliveryDate"))) {
|
||||
ArrayList<APIFootballMatch> matches = TLWMatchesCreatorFootball.getAPIFootballMatchesForConfig(conn, jsonConfig);
|
||||
if(matches.size() > 0) {
|
||||
LocalDateTime firstDate = TLWMatchesManagerBase.getFirstMatchtimeAPIFootball(matches);
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
deliveryDates.add(firstDate.format(formatter));
|
||||
}
|
||||
}
|
||||
}
|
||||
return deliveryDates;
|
||||
}
|
||||
|
||||
public String getMatchdaysSQL() {
|
||||
String matchdaySql = "";
|
||||
for (TLWMatchday matchday : getMatchdays()) {
|
||||
matchdaySql += "REPLACE INTO phpbb_footb_matchdays VALUES('";
|
||||
matchdaySql += matchday.getSeason().toString();
|
||||
matchdaySql += "', '";
|
||||
matchdaySql += matchday.getLeague().toString();
|
||||
matchdaySql += "', '";
|
||||
matchdaySql += matchday.getMatchday().toString();
|
||||
matchdaySql += "', '";
|
||||
matchdaySql += matchday.getStatus().toString();
|
||||
matchdaySql += "', '";
|
||||
matchdaySql += matchday.getDeliveryDate();
|
||||
matchdaySql += "', '";
|
||||
matchdaySql += matchday.getDeliveryDate2();
|
||||
matchdaySql += "', '";
|
||||
matchdaySql += matchday.getDeliveryDate3();
|
||||
matchdaySql += "', '";
|
||||
matchdaySql += matchday.getMatchdayName();
|
||||
matchdaySql += "', '";
|
||||
matchdaySql += matchday.getMatches().toString();
|
||||
matchdaySql += "');\n";
|
||||
}
|
||||
return matchdaySql;
|
||||
}
|
||||
|
||||
public static <T> ArrayList<T> removeDuplicates(ArrayList<T> list)
|
||||
{
|
||||
ArrayList<T> newList = new ArrayList<T>();
|
||||
for (T element : list) {
|
||||
if (!newList.contains(element)) {
|
||||
newList.add(element);
|
||||
}
|
||||
}
|
||||
return newList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
package de.jeyp91.tippliga;
|
||||
|
||||
import de.jeyp91.tippligaforum.TippligaSQLConnector;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
|
||||
import static de.jeyp91.googlecalendar.TippligaGoogleEventManager.*;
|
||||
|
||||
public class TLWMatchdaysUpdater {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(TLWMatch.class);
|
||||
|
||||
int season;
|
||||
int league;
|
||||
ArrayList<TLWMatchday> matchdaysOriginal;
|
||||
ArrayList<TLWMatchday> matchdaysUpdated;
|
||||
String beautifulInfo = "";
|
||||
|
||||
public TLWMatchdaysUpdater(int season, int league, String configPath) {
|
||||
this.season = season;
|
||||
this.league = league;
|
||||
|
||||
TippligaSQLConnector conn = TippligaSQLConnector.getInstance();
|
||||
this.matchdaysOriginal = conn.getMatchdays(String.valueOf(season), String.valueOf(league));
|
||||
this.matchdaysOriginal.sort(Comparator.comparing(TLWMatchday::getMatchday));
|
||||
|
||||
this.matchdaysUpdated = conn.getUpdatedMatchdaysBasedOnMatches(String.valueOf(season), String.valueOf(league));
|
||||
this.matchdaysUpdated.sort(Comparator.comparing(TLWMatchday::getMatchday));
|
||||
}
|
||||
|
||||
public String getUpdateSql() {
|
||||
String updateSql = "";
|
||||
|
||||
if(this.matchdaysUpdated.size() != this.matchdaysOriginal.size()) {
|
||||
this.logger.error("Wrong matchdays config!");
|
||||
} else {
|
||||
|
||||
for (int i = 0; i < this.matchdaysUpdated.size(); i++) {
|
||||
TLWMatchday matchdayOriginal = this.matchdaysOriginal.get(i);
|
||||
TLWMatchday matchdayUpdated = this.matchdaysUpdated.get(i);
|
||||
|
||||
if (matchdayOriginal.getMatchday() != matchdayUpdated.getMatchday()) {
|
||||
this.logger.error("BUUUUG!");
|
||||
} else {
|
||||
|
||||
Date now = new Date(System.currentTimeMillis());
|
||||
|
||||
Date earliestDate = null;
|
||||
try {
|
||||
earliestDate = new SimpleDateFormat("yyyy-MM-dd").parse(matchdayUpdated.getDeliveryDate().substring(0, 10));
|
||||
} catch (java.text.ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (earliestDate.after(now)) {
|
||||
|
||||
String updateStart = "UPDATE phpbb_footb_matchdays SET ";
|
||||
String condition = "WHERE season = " + matchdayOriginal.getSeason() + " " +
|
||||
"AND league = " + matchdayOriginal.getLeague() + " " +
|
||||
"AND matchday = " + matchdayOriginal.getMatchday() + ";\n";
|
||||
String beautifulInfoStart = "Aktualisiere Saison " + matchdayOriginal.getSeason() + ", " +
|
||||
"Liga " + matchdayOriginal.getLeague() + ", " +
|
||||
"Spieltag " + matchdayOriginal.getMatchday() + ", ";
|
||||
|
||||
if (!matchdayOriginal.getDeliveryDate().equals(matchdayUpdated.getDeliveryDate())) {
|
||||
updateSql += updateStart +
|
||||
"delivery_date = '" + matchdayUpdated.getDeliveryDate() + "' " +
|
||||
condition;
|
||||
this.beautifulInfo += beautifulInfoStart +
|
||||
"Tippabgabeschluss 1 zu '" + matchdayUpdated.getDeliveryDate() + "'.\n";
|
||||
}
|
||||
|
||||
if (!matchdayOriginal.getDeliveryDate2().equals(matchdayUpdated.getDeliveryDate2())) {
|
||||
updateSql += updateStart +
|
||||
"delivery_date_2 = '" + matchdayUpdated.getDeliveryDate2() + "' " +
|
||||
condition;
|
||||
this.beautifulInfo += beautifulInfoStart +
|
||||
"Tippabgabeschluss 2 zu '" + matchdayUpdated.getDeliveryDate2() + "'.\n";
|
||||
}
|
||||
|
||||
if (!matchdayOriginal.getDeliveryDate3().equals(matchdayUpdated.getDeliveryDate3())) {
|
||||
updateSql += updateStart +
|
||||
"delivery_date_3 = '" + matchdayUpdated.getDeliveryDate3() + "' " +
|
||||
condition;
|
||||
this.beautifulInfo += beautifulInfoStart +
|
||||
"Tippabgabeschluss 3 zu '" + matchdayUpdated.getDeliveryDate3() + "'.\n";
|
||||
}
|
||||
|
||||
if (!matchdayOriginal.getMatchdayName().equals(matchdayUpdated.getMatchdayName())) {
|
||||
updateSql += updateStart +
|
||||
"matchday_name = '" + matchdayUpdated.getMatchdayName() + "' " +
|
||||
condition;
|
||||
this.beautifulInfo += beautifulInfoStart +
|
||||
"Spieltagsname zu '" + matchdayUpdated.getMatchdayName() + "'.\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return updateSql;
|
||||
}
|
||||
|
||||
public void updateGoogleCalendar() {
|
||||
updateAllMatchdays(matchdaysUpdated);
|
||||
}
|
||||
|
||||
public String getBeautifulInfo() {
|
||||
return this.beautifulInfo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package de.jeyp91.tippliga;
|
||||
|
||||
import de.jeyp91.apifootball.APIFootballConnector;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public abstract class TLWMatchesCreatorBase {
|
||||
|
||||
ArrayList<TLWMatch> TLWMatches;
|
||||
APIFootballConnector conn;
|
||||
|
||||
public TLWMatchesCreatorBase() {
|
||||
this.TLWMatches = new ArrayList<>();
|
||||
}
|
||||
|
||||
public ArrayList<TLWMatch> getMatches() {
|
||||
return this.TLWMatches;
|
||||
}
|
||||
|
||||
public String getSQLInsertString() {
|
||||
String sql = "";
|
||||
|
||||
ArrayList<TLWMatch> tlwMatches = getMatches();
|
||||
|
||||
// Add matches from config
|
||||
for(TLWMatch match : tlwMatches) {
|
||||
sql += match.getSQLQueryReplace() + "\n";
|
||||
}
|
||||
|
||||
return sql;
|
||||
}
|
||||
|
||||
public int getNumberOfMatchdays() {
|
||||
int matchday = 0;
|
||||
for(TLWMatch match : this.TLWMatches) {
|
||||
if(match.getMatchday() > matchday) {
|
||||
matchday = match.getMatchday();
|
||||
}
|
||||
}
|
||||
return matchday;
|
||||
}
|
||||
|
||||
public ArrayList<TLWMatch> getMatchesForMatchday(int matchday) {
|
||||
ArrayList<TLWMatch> matches = new ArrayList<>();
|
||||
|
||||
for(TLWMatch match : this.TLWMatches) {
|
||||
if (match.getMatchday() == matchday) {
|
||||
matches.add(match);
|
||||
}
|
||||
}
|
||||
|
||||
return matches;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
package de.jeyp91.tippliga;
|
||||
|
||||
import de.jeyp91.apifootball.APIFootballConnector;
|
||||
import de.jeyp91.apifootball.APIFootballMatch;
|
||||
import de.jeyp91.tippligaforum.TippligaConfigProvider;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class TLWMatchesCreatorFootball extends TLWMatchesCreatorBase {
|
||||
|
||||
int season;
|
||||
int league;
|
||||
int numberOfMatchdays;
|
||||
int matchesPerMatchday;
|
||||
int ko;
|
||||
int nextMatchNo = 1;
|
||||
JSONArray matchdayConfig;
|
||||
JSONObject config;
|
||||
|
||||
public TLWMatchesCreatorFootball(int season, int league, String configFileName) {
|
||||
|
||||
super();
|
||||
|
||||
this.season = season;
|
||||
this.league = league;
|
||||
this.conn = APIFootballConnector.getAPIFootballConnectorInstance(season);
|
||||
|
||||
TippligaConfigProvider prov = new TippligaConfigProvider(season);
|
||||
this.config = prov.getTippligaConfig(configFileName);
|
||||
|
||||
this.numberOfMatchdays = ((Long) this.config.get("numberOfMatchdays")).intValue();
|
||||
this.matchesPerMatchday = ((Long) this.config.get("matchesPerMatchday")).intValue();
|
||||
this.matchdayConfig = (JSONArray) this.config.get("matchdayConfig");
|
||||
this.ko = ((Long) this.config.get("ko")).intValue();
|
||||
String deliveryDateMode = this.config.containsKey("deliveryDateMode") ? this.config.get("deliveryDateMode").toString() : "";
|
||||
|
||||
this.publicateMatchObjects(deliveryDateMode);
|
||||
}
|
||||
|
||||
private void publicateMatchObjects(String deliveryDateMode) {
|
||||
for(int i = 0; i < this.matchdayConfig.size(); i++) {
|
||||
int TLWMatchday = ((Long) ((JSONObject) this.matchdayConfig.get(i)).get("TLWMatchday")).intValue();
|
||||
|
||||
JSONArray matchesConfig = (JSONArray)((JSONObject) this.matchdayConfig.get(i)).get("matchesConfig");
|
||||
ArrayList<APIFootballMatch> apiFootballMatchesForMatchday = getAPIFootballMatchesForMatchday(matchesConfig);
|
||||
|
||||
int matchdayMatchCounter = 0;
|
||||
|
||||
// Use first matchtime because API Football always returns matches sorted by date
|
||||
LocalDateTime firstDate = TLWMatchesManagerBase.getFirstMatchtimeAPIFootball(apiFootballMatchesForMatchday);
|
||||
|
||||
for(APIFootballMatch match : apiFootballMatchesForMatchday) {
|
||||
int matchNo = this.nextMatchNo;
|
||||
this.nextMatchNo++;
|
||||
int status = 0;
|
||||
LocalDateTime matchDateTime = TLWMatchesManagerBase.getDate(match);
|
||||
if(!deliveryDateMode.equals("single")
|
||||
&& firstDate != null
|
||||
&& TLWMatchesManagerBase.getDaysDifference(firstDate, matchDateTime) >= 1) {
|
||||
status = -1;
|
||||
}
|
||||
this.TLWMatches.add(new TLWMatch(match, this.season, this.league, TLWMatchday, matchNo, status, this.ko, true));
|
||||
matchdayMatchCounter++;
|
||||
if(firstDate == null) {
|
||||
firstDate = matchDateTime;
|
||||
}
|
||||
}
|
||||
|
||||
// Add PlaceholderSingleMatch matches
|
||||
for (Object matchesConfigObject : matchesConfig) {
|
||||
JSONObject singleMatchConfig = (JSONObject) matchesConfigObject;
|
||||
if(singleMatchConfig.get("type").equals("PlaceholderSingleMatch")) {
|
||||
String formulaHome = (String) singleMatchConfig.get("formulaHome");
|
||||
String formulaGuest = (String) singleMatchConfig.get("formulaGuest");
|
||||
String matchDatetime = (String) singleMatchConfig.get("placeholderDatetime");
|
||||
int matchNo = this.nextMatchNo;
|
||||
this.nextMatchNo++;
|
||||
this.TLWMatches.add(new TLWMatch(this.season, this.league, TLWMatchday, matchNo, 0, this.ko, formulaHome, formulaGuest, matchDatetime));
|
||||
matchdayMatchCounter++;
|
||||
}
|
||||
}
|
||||
|
||||
// Add empty missing matches
|
||||
int matchesPerMatchdayTemp = 0;
|
||||
if(this.matchesPerMatchday != 0) {
|
||||
matchesPerMatchdayTemp = this.matchesPerMatchday;
|
||||
} else {
|
||||
if(((JSONObject) this.matchdayConfig.get(i)).containsKey("numberOfMatches")) {
|
||||
matchesPerMatchdayTemp = ((Long) ((JSONObject) this.matchdayConfig.get(i)).get("numberOfMatches")).intValue();
|
||||
}
|
||||
}
|
||||
for(int j = matchdayMatchCounter; j < matchesPerMatchdayTemp; j++) {
|
||||
String matchDatetime = "";
|
||||
if(apiFootballMatchesForMatchday.size() > 0) {
|
||||
matchDatetime = this.TLWMatches.get(this.TLWMatches.size() - 1).getMatchDateTime();
|
||||
}
|
||||
else {
|
||||
matchDatetime = ((JSONObject) matchesConfig.get(matchesConfig.size() - 1)).get("placeholderDatetime").toString();
|
||||
}
|
||||
int matchNo = this.nextMatchNo;
|
||||
this.nextMatchNo++;
|
||||
this.TLWMatches.add(new TLWMatch(this.season, this.league, TLWMatchday, matchNo, matchDatetime, 0, this.ko));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ArrayList<APIFootballMatch> getAPIFootballMatchesForMatchday(JSONArray config) {
|
||||
ArrayList<APIFootballMatch> apiFootballMatches = new ArrayList<>();
|
||||
for (Object singleConfigObject : config) {
|
||||
JSONObject singleConfig = (JSONObject) singleConfigObject;
|
||||
apiFootballMatches.addAll(getAPIFootballMatchesForConfig(this.conn, singleConfig));
|
||||
}
|
||||
return apiFootballMatches;
|
||||
}
|
||||
|
||||
public static ArrayList<APIFootballMatch> getAPIFootballMatchesForConfig(APIFootballConnector conn, JSONObject singleConfig) {
|
||||
ArrayList<APIFootballMatch> apiFootballMatches = new ArrayList<>();
|
||||
String type = (String) singleConfig.get("type");
|
||||
switch (type) {
|
||||
case "AllMatchesOfMatchday":
|
||||
int matchesLeague = ((Long) singleConfig.get("matchesLeague")).intValue();
|
||||
int leagueMatchday = ((Long) singleConfig.get("leagueMatchday")).intValue();
|
||||
apiFootballMatches.addAll(conn.getMatchDataByLeagueAndMatchday(matchesLeague, leagueMatchday));
|
||||
break;
|
||||
case "SingleMatch":
|
||||
int matchLeague = ((Long) singleConfig.get("matchLeague")).intValue();
|
||||
int matchId = ((Long) singleConfig.get("matchId")).intValue();
|
||||
apiFootballMatches.add(conn.getMatchDataByLeagueAndMatchID(matchLeague, matchId));
|
||||
break;
|
||||
}
|
||||
return apiFootballMatches;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package de.jeyp91.tippliga;
|
||||
|
||||
import de.jeyp91.ResourceProvider;
|
||||
import de.jeyp91.StatusHolder;
|
||||
import de.jeyp91.tippligaforum.TippligaConfigProvider;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class TLWMatchesCreatorTipperLeague extends TLWMatchesCreatorBase {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(TLWMatchesCreatorTipperLeague.class);
|
||||
|
||||
int season;
|
||||
int league;
|
||||
|
||||
JSONArray matchPairingConfig;
|
||||
JSONObject tipperList;
|
||||
JSONArray tipperTeamConfig;
|
||||
ArrayList<TLWMatchday> matchdays;
|
||||
|
||||
public TLWMatchesCreatorTipperLeague(int season, int league, String configFileName, ArrayList<TLWMatchday> matchdays) {
|
||||
this.season = season;
|
||||
this.league = league;
|
||||
this.matchdays = matchdays;
|
||||
|
||||
|
||||
this.matchPairingConfig = ResourceProvider.getTipperMatchPairConfig();
|
||||
this.tipperTeamConfig = ResourceProvider.getTipperTeamConfig();
|
||||
|
||||
TippligaConfigProvider prov = new TippligaConfigProvider(season);
|
||||
this.tipperList = prov.getTippligaConfig(configFileName);
|
||||
|
||||
this.publicateMatchObjects();
|
||||
}
|
||||
|
||||
private void publicateMatchObjects() {
|
||||
|
||||
for(Object matchdayConfig : this.matchPairingConfig) {
|
||||
|
||||
int matchday = ((Long) ((JSONObject) matchdayConfig).get("matchday")).intValue();
|
||||
JSONArray matchesConfig = (JSONArray)((JSONObject) matchdayConfig).get("matches");
|
||||
|
||||
for(int i = 0; i < matchesConfig.size(); i++) {
|
||||
int homeTipperNumber = ((Long) ((JSONObject) matchesConfig.get(i)).get("home")).intValue();
|
||||
int guestTipperNumber = ((Long) ((JSONObject) matchesConfig.get(i)).get("guest")).intValue();
|
||||
|
||||
String homeName = this.tipperList.get(String.valueOf(homeTipperNumber)).toString();
|
||||
String guestName = this.tipperList.get(String.valueOf(guestTipperNumber)).toString();
|
||||
|
||||
int teamIdHome = getTeamIdFromTipperName(homeName);
|
||||
int teamIdGuest = getTeamIdFromTipperName(guestName);
|
||||
|
||||
int matchNo = (matchday - 1) * matchesConfig.size() + i + 1;
|
||||
|
||||
String matchDatetime = getDeliveryDateForMatchday(matchday);
|
||||
|
||||
TLWMatch tlwMatch = new TLWMatch(this.season, this.league, matchday, matchNo, teamIdHome, teamIdGuest, matchDatetime, 0);
|
||||
this.TLWMatches.add(tlwMatch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int getTeamIdFromTipperName(String name) {
|
||||
int teamId = 0;
|
||||
for(Object config : tipperTeamConfig) {
|
||||
if (((JSONObject) config).get("team_name").toString().equals(name)) {
|
||||
teamId = ((Long) (((JSONObject) config).get("team_id"))).intValue();
|
||||
}
|
||||
}
|
||||
if(teamId == 0) {
|
||||
logger.error("ERROR! Did not find Tipper ID for " + name);
|
||||
StatusHolder.setError();
|
||||
}
|
||||
return teamId;
|
||||
}
|
||||
|
||||
private String getDeliveryDateForMatchday(int matchday) {
|
||||
String deliveryDate = "";
|
||||
for (TLWMatchday matchdayObject : this.matchdays) {
|
||||
if(matchdayObject.getMatchday() == matchday) {
|
||||
deliveryDate = matchdayObject.getDeliveryDate();
|
||||
}
|
||||
}
|
||||
return deliveryDate;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package de.jeyp91.tippliga;
|
||||
|
||||
import de.jeyp91.ResourceProvider;
|
||||
import de.jeyp91.tippligaforum.TippligaConfigProvider;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class TLWMatchesCreatorTipperPokal extends TLWMatchesCreatorBase{
|
||||
|
||||
Logger logger = LoggerFactory.getLogger(TLWMatchesCreatorTipperPokal.class);
|
||||
|
||||
int season;
|
||||
int league;
|
||||
|
||||
ArrayList<TLWMatch> TLWMatches;
|
||||
JSONObject tipperList;
|
||||
JSONArray tipperTeamConfig;
|
||||
ArrayList<TLWMatchday> matchdays;
|
||||
|
||||
public TLWMatchesCreatorTipperPokal(int season, int league, String configFileName, ArrayList<TLWMatchday> matchdays) {
|
||||
this.season = season;
|
||||
this.league = league;
|
||||
this.matchdays = matchdays;
|
||||
|
||||
TippligaConfigProvider prov = new TippligaConfigProvider(season);
|
||||
this.tipperList = prov.getTippligaConfig(configFileName);
|
||||
|
||||
this.tipperTeamConfig = ResourceProvider.getTipperTeamConfig();
|
||||
|
||||
this.TLWMatches = new ArrayList<>();
|
||||
|
||||
this.publicateMatchObjects();
|
||||
}
|
||||
|
||||
private void publicateMatchObjects() {
|
||||
|
||||
int matchday = 1;
|
||||
|
||||
for(int matchNo = 1; matchNo <= this.tipperList.size() / 2; matchNo++) {
|
||||
|
||||
String homeName = this.tipperList.get(String.valueOf(2 * matchNo - 1)).toString();
|
||||
String guestName = this.tipperList.get(String.valueOf(2 * matchNo)).toString();
|
||||
|
||||
int teamIdHome = getTeamIdFromTipperName(homeName);
|
||||
int teamIdGuest = getTeamIdFromTipperName(guestName);
|
||||
|
||||
String matchDatetime = getDeliveryDateForMatchday(matchday);
|
||||
|
||||
TLWMatch tlwMatch = new TLWMatch(this.season, this.league, matchday, matchNo, teamIdHome, teamIdGuest, matchDatetime, 1);
|
||||
tlwMatch.setShowTable(false);
|
||||
this.TLWMatches.add(tlwMatch);
|
||||
}
|
||||
}
|
||||
|
||||
private int getTeamIdFromTipperName(String name) {
|
||||
int teamId = 0;
|
||||
for(Object config : tipperTeamConfig) {
|
||||
if (((JSONObject) config).get("team_name").toString().equals(name)) {
|
||||
teamId = ((Long) (((JSONObject) config).get("team_id"))).intValue();
|
||||
}
|
||||
}
|
||||
if(teamId == 0) {
|
||||
logger.error("Did not find Tipper ID for " + name);
|
||||
}
|
||||
return teamId;
|
||||
}
|
||||
|
||||
public ArrayList<TLWMatch> getMatches() {
|
||||
return this.TLWMatches;
|
||||
}
|
||||
|
||||
private String getDeliveryDateForMatchday(int matchday) {
|
||||
String deliveryDate = "";
|
||||
for (TLWMatchday matchdayObject : this.matchdays) {
|
||||
if(matchdayObject.getMatchday() == matchday) {
|
||||
deliveryDate = matchdayObject.getDeliveryDate();
|
||||
}
|
||||
}
|
||||
return deliveryDate;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
package de.jeyp91.tippliga;
|
||||
|
||||
import de.jeyp91.apifootball.APIFootballMatch;
|
||||
import de.jeyp91.teamidmatcher.TeamIDMatcher;
|
||||
import de.jeyp91.tippligaforum.TippligaConfigProvider;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class TLWMatchesManagerBase {
|
||||
|
||||
protected int season;
|
||||
protected int league;
|
||||
protected int numberOfMatchdays;
|
||||
protected Integer matchesPerMatchday = null;
|
||||
protected int ko;
|
||||
protected int betKOType;
|
||||
|
||||
protected JSONArray matchdayConfig;
|
||||
|
||||
protected void initConfigParamsFromFile(String configFileName) {
|
||||
|
||||
TippligaConfigProvider prov = new TippligaConfigProvider(this.season);
|
||||
JSONObject config = prov.getTippligaConfig(configFileName);
|
||||
this.numberOfMatchdays = ((Long) config.get("numberOfMatchdays")).intValue();
|
||||
try { this.matchesPerMatchday = ((Long) config.get("matchesPerMatchday")).intValue(); } catch (Exception ignored) {}
|
||||
this.matchdayConfig = (JSONArray) config.get("matchdayConfig");
|
||||
this.ko = ((Long) config.get("ko")).intValue();
|
||||
Long parsedBetKOType = (Long) config.get("betKOType");
|
||||
this.betKOType = parsedBetKOType == null ? 1 : parsedBetKOType.intValue();
|
||||
}
|
||||
|
||||
public static ArrayList<TLWMatch> getMatchesStartingFromSecondDay(ArrayList<TLWMatch> matches) {
|
||||
LocalDateTime firstMatchtime = getFirstMatchtimeTLW(matches);
|
||||
ArrayList<TLWMatch> filteredMatches = new ArrayList<>();
|
||||
for(TLWMatch match : matches) {
|
||||
LocalDateTime matchDateTime = getDate(match);
|
||||
if(getDaysDifference(matchDateTime, firstMatchtime) != 0) {
|
||||
filteredMatches.add(match);
|
||||
}
|
||||
}
|
||||
return filteredMatches;
|
||||
}
|
||||
|
||||
public static ArrayList<TLWMatch> getMatchesStartingFromSecondWeek(ArrayList<TLWMatch> matches) {
|
||||
LocalDateTime firstMatchtime = getFirstMatchtimeTLW(matches);
|
||||
ArrayList<TLWMatch> filteredMatches = new ArrayList<>();
|
||||
for(TLWMatch match : matches) {
|
||||
LocalDateTime matchDateTime = getDate(match);
|
||||
if(getDaysDifference(matchDateTime, firstMatchtime) > 6) {
|
||||
filteredMatches.add(match);
|
||||
}
|
||||
}
|
||||
return filteredMatches;
|
||||
}
|
||||
|
||||
public static LocalDateTime getFirstMatchtimeTLW(ArrayList<TLWMatch> matches) {
|
||||
LocalDateTime matchtime = null;
|
||||
for(TLWMatch match : matches) {
|
||||
LocalDateTime matchtimeTemp = getDate(match);
|
||||
if(matchtime == null) {
|
||||
matchtime = matchtimeTemp;
|
||||
} else {
|
||||
if(matchtimeTemp.isBefore(matchtime)) {
|
||||
matchtime = matchtimeTemp;
|
||||
}
|
||||
}
|
||||
}
|
||||
return matchtime;
|
||||
}
|
||||
|
||||
public static LocalDateTime getFirstMatchtimeAPIFootball(ArrayList<APIFootballMatch> matches) {
|
||||
LocalDateTime matchtime = null;
|
||||
for(APIFootballMatch match : matches) {
|
||||
LocalDateTime matchtimeTemp = getDate(match);
|
||||
if(matchtime == null) {
|
||||
matchtime = matchtimeTemp;
|
||||
} else {
|
||||
if(matchtimeTemp.isBefore(matchtime)) {
|
||||
matchtime = matchtimeTemp;
|
||||
}
|
||||
}
|
||||
}
|
||||
return matchtime;
|
||||
}
|
||||
|
||||
public static LocalDateTime getDate(TLWMatch match) {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
LocalDateTime dateTime = LocalDateTime.parse(match.getMatchDateTime(), formatter);
|
||||
return dateTime;
|
||||
}
|
||||
|
||||
public static LocalDateTime getDate(APIFootballMatch match) {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss");
|
||||
LocalDateTime dateTime = LocalDateTime.parse(match.getMatchDateTime().substring(0, 19), formatter);
|
||||
return dateTime;
|
||||
}
|
||||
|
||||
public static int getDaysDifference(LocalDateTime date1, LocalDateTime date2) {
|
||||
date1 = date1.toLocalDate().atTime(0, 0, 0);
|
||||
date2 = date2.toLocalDate().atTime(0, 0, 0);
|
||||
return (int) date1.until(date2, ChronoUnit.DAYS);
|
||||
}
|
||||
|
||||
protected TLWMatch getMatchingMatch(APIFootballMatch apiFootballMatch, ArrayList<TLWMatch> tlwMatches) {
|
||||
TLWMatch matchingMatch = null;
|
||||
for(TLWMatch match : tlwMatches) {
|
||||
Integer apiTeamIdHome = TeamIDMatcher.getTippligaIdFromApiFootballId(apiFootballMatch, TeamIDMatcher.HOME);
|
||||
Integer apiTeamIdGuest = TeamIDMatcher.getTippligaIdFromApiFootballId(apiFootballMatch, TeamIDMatcher.GUEST);
|
||||
int tlwTeamIdHome = match.getTeamIdHome();
|
||||
int tlwTeamIdGuest = match.getTeamIdGuest();
|
||||
|
||||
if(apiTeamIdHome == null
|
||||
|| apiTeamIdGuest == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
if(
|
||||
apiTeamIdHome.equals(tlwTeamIdHome)
|
||||
&& apiTeamIdGuest.equals(tlwTeamIdGuest)
|
||||
) {
|
||||
matchingMatch = match;
|
||||
}
|
||||
}
|
||||
return matchingMatch;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
package de.jeyp91.tippliga;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.json.simple.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import de.jeyp91.apifootball.APIFootballMatch;
|
||||
import de.jeyp91.apifootball.APIFootballMatchesProvider;
|
||||
import de.jeyp91.teamidmatcher.TeamIDMatcher;
|
||||
import de.jeyp91.tippligaforum.TippligaSQLConnector;
|
||||
import de.jeyp91.tippligaforum.TippligaWebsiteConnector;
|
||||
|
||||
public class TLWMatchesResultsUpdater extends TLWMatchesManagerBase {
|
||||
private static final Logger logger = LoggerFactory.getLogger(TLWMatchesResultsUpdater.class);
|
||||
|
||||
|
||||
ArrayList<ArrayList<TLWMatch>> tlwMatchesUpdated = new ArrayList<>();
|
||||
|
||||
String beautifulInfo = "";
|
||||
|
||||
public TLWMatchesResultsUpdater(int season, int league, String configFileName) {
|
||||
this.season = season;
|
||||
this.league = league;
|
||||
|
||||
super.initConfigParamsFromFile(configFileName);
|
||||
initUpdates();
|
||||
applyUpdates();
|
||||
}
|
||||
|
||||
private void initUpdates() {
|
||||
|
||||
APIFootballMatchesProvider apiFootballMatchesProvider = new APIFootballMatchesProvider(this.season);
|
||||
TippligaSQLConnector tippligaSQLConnector = TippligaSQLConnector.getInstance();
|
||||
for (Object singleMatchdayConfig : this.matchdayConfig) {
|
||||
int tlwMatchday = ((Long) ((JSONObject) singleMatchdayConfig).get("TLWMatchday")).intValue();
|
||||
|
||||
ArrayList<APIFootballMatch> apiFootballMatches = apiFootballMatchesProvider.getAPIFootballMatchesFromConfig((JSONObject) singleMatchdayConfig);
|
||||
|
||||
ArrayList<TLWMatch> tlwMatchesOriginalMatchday = tippligaSQLConnector.getMatches(String.valueOf(this.season), String.valueOf(this.league), String.valueOf(tlwMatchday));
|
||||
ArrayList<TLWMatch> tlwMatchesUpdatedMatchday = new ArrayList<>();
|
||||
for (TLWMatch match : tlwMatchesOriginalMatchday) {
|
||||
tlwMatchesUpdatedMatchday.add(new TLWMatch(match));
|
||||
}
|
||||
|
||||
if (apiFootballMatches.size() > tlwMatchesOriginalMatchday.size()) {
|
||||
logger.error("Not matching config!");
|
||||
}
|
||||
|
||||
if(!apiFootballMatches.isEmpty()) {
|
||||
updateResults(tlwMatchesUpdatedMatchday, apiFootballMatches);
|
||||
}
|
||||
|
||||
updateBeautifulInfo(tlwMatchesOriginalMatchday, tlwMatchesUpdatedMatchday);
|
||||
tlwMatchesUpdatedMatchday.removeIf(tlwMatch -> tlwMatch.getUpdateStatus() != TLWMatch.COMPARISON.DIFFERENT_RESULT);
|
||||
if(!tlwMatchesUpdatedMatchday.isEmpty()) this.tlwMatchesUpdated.add(tlwMatchesUpdatedMatchday);
|
||||
}
|
||||
}
|
||||
|
||||
public void applyUpdates() {
|
||||
TippligaWebsiteConnector con;
|
||||
try {
|
||||
con = new TippligaWebsiteConnector();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
this.tlwMatchesUpdated.forEach(tlwMatches -> {
|
||||
con.updateResultsAdmin(this.season, this.league, tlwMatches.get(0).getMatchday(), tlwMatches);
|
||||
});
|
||||
}
|
||||
|
||||
private void updateResults(
|
||||
ArrayList<TLWMatch> tlwMatchesUpdated,
|
||||
ArrayList<APIFootballMatch> apiFootballMatches)
|
||||
{
|
||||
ArrayList<TLWMatch> tlwMatchesCopy = new ArrayList<>(tlwMatchesUpdated);
|
||||
for(APIFootballMatch apiFootballMatch : apiFootballMatches) {
|
||||
try {
|
||||
TLWMatch tlwMatch = getMatchingMatch(apiFootballMatch, tlwMatchesCopy);
|
||||
tlwMatchesCopy.remove(tlwMatch);
|
||||
if(Objects.equals(apiFootballMatch.getStatus(), TLWMatch.STATUS_FINISHED)) {
|
||||
if(!Objects.equals(tlwMatch.getGoalsHome(), apiFootballMatch.getGoalsHome())
|
||||
|| !Objects.equals(tlwMatch.getGoalsGuest(), apiFootballMatch.getGoalsGuest())
|
||||
) {
|
||||
tlwMatch.setGoalsHome(apiFootballMatch.getGoalsHome());
|
||||
tlwMatch.setGoalsGuest(apiFootballMatch.getGoalsGuest());
|
||||
tlwMatch.setUpdateStatus(TLWMatch.COMPARISON.DIFFERENT_RESULT);
|
||||
}
|
||||
if(tlwMatch.getKoMatch() &&
|
||||
this.betKOType == 2 &&
|
||||
(!Objects.equals(tlwMatch.getGoalsOvertimeHome(), apiFootballMatch.getGoalsOvertimeHome())
|
||||
|| !Objects.equals(tlwMatch.getGoalsOvertimeGuest(), apiFootballMatch.getGoalsOvertimeGuest()))
|
||||
) {
|
||||
tlwMatch.setGoalsOvertimeHome(apiFootballMatch.getGoalsOvertimeHome());
|
||||
tlwMatch.setGoalsOvertimeGuest(apiFootballMatch.getGoalsOvertimeGuest());
|
||||
tlwMatch.setUpdateStatus(TLWMatch.COMPARISON.DIFFERENT_RESULT);
|
||||
}
|
||||
if(tlwMatch.getKoMatch() &&
|
||||
(this.betKOType == 1 || this.betKOType == 3) &&
|
||||
(apiFootballMatch.getGoalsPenaltyHome() != null) &&
|
||||
(!Objects.equals(tlwMatch.getGoalsOvertimeHome(), apiFootballMatch.getGoalsPenaltyHome())
|
||||
|| !Objects.equals(tlwMatch.getGoalsOvertimeGuest(), apiFootballMatch.getGoalsPenaltyGuest()))
|
||||
) {
|
||||
tlwMatch.setGoalsOvertimeHome(apiFootballMatch.getGoalsPenaltyHome());
|
||||
tlwMatch.setGoalsOvertimeGuest(apiFootballMatch.getGoalsPenaltyGuest());
|
||||
tlwMatch.setUpdateStatus(TLWMatch.COMPARISON.DIFFERENT_RESULT);
|
||||
}
|
||||
if(tlwMatch.getKoMatch() &&
|
||||
(this.betKOType == 1 || this.betKOType == 3) &&
|
||||
(apiFootballMatch.getGoalsPenaltyHome() == null) &&
|
||||
(!Objects.equals(tlwMatch.getGoalsOvertimeHome(), apiFootballMatch.getGoalsOvertimeHome())
|
||||
|| !Objects.equals(tlwMatch.getGoalsOvertimeGuest(), apiFootballMatch.getGoalsOvertimeGuest()))
|
||||
) {
|
||||
tlwMatch.setGoalsOvertimeHome(apiFootballMatch.getGoalsOvertimeHome());
|
||||
tlwMatch.setGoalsOvertimeGuest(apiFootballMatch.getGoalsOvertimeGuest());
|
||||
tlwMatch.setUpdateStatus(TLWMatch.COMPARISON.DIFFERENT_RESULT);
|
||||
}
|
||||
if(Objects.equals(tlwMatch.getStatus(), TLWMatch.STATUS_PROVISIONAL_RESULT_AVAILABLE)) {
|
||||
tlwMatch.setUpdateStatus(TLWMatch.COMPARISON.DIFFERENT_RESULT);
|
||||
}
|
||||
}
|
||||
} catch (NullPointerException ignored) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateBeautifulInfo(ArrayList<TLWMatch> matchesOriginal, ArrayList<TLWMatch> matchesUpdated) {
|
||||
for (int i = 0; i < matchesOriginal.size(); i++) {
|
||||
if(matchesUpdated.get(i).getUpdateStatus() != TLWMatch.COMPARISON.DIFFERENT_RESULT) {
|
||||
continue;
|
||||
}
|
||||
updateBeautifulInfo(matchesOriginal.get(i), matchesUpdated.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
private void updateBeautifulInfo(TLWMatch matchOriginal, TLWMatch matchUpdated) {
|
||||
String beautifulInfoStart = "Aktualisiere Saison " + matchOriginal.getSeason() + ", " +
|
||||
"Liga " + matchOriginal.getLeague() + ", " +
|
||||
"Spieltag " + matchOriginal.getMatchday() + ", " +
|
||||
"Spielnummer " + matchOriginal.getMatchNo() + ", " +
|
||||
"Spiel '" + TeamIDMatcher.getTeamNameFromTippligaId(matchOriginal.getTeamIdHome()) + "' - '" + TeamIDMatcher.getTeamNameFromTippligaId(matchOriginal.getTeamIdGuest()) + "', ";
|
||||
|
||||
if(!Objects.equals(matchOriginal.getGoalsHome(), matchUpdated.getGoalsHome())
|
||||
|| !Objects.equals(matchOriginal.getGoalsGuest(), matchUpdated.getGoalsGuest())) {
|
||||
this.beautifulInfo += beautifulInfoStart +
|
||||
"Ergebnis zu '" + matchUpdated.getGoalsHome() + ":" + matchUpdated.getGoalsGuest() + "'.\n";
|
||||
}
|
||||
|
||||
if(matchOriginal.getKoMatch() && (!Objects.equals(matchOriginal.getGoalsOvertimeHome(), matchUpdated.getGoalsOvertimeHome())
|
||||
|| !Objects.equals(matchOriginal.getGoalsOvertimeGuest(), matchUpdated.getGoalsOvertimeGuest()))) {
|
||||
this.beautifulInfo += beautifulInfoStart +
|
||||
"Ergebnis Nachspielzeit zu '" + matchUpdated.getGoalsOvertimeHome() + ":" + matchUpdated.getGoalsOvertimeGuest() + "'.\n";
|
||||
}
|
||||
|
||||
if(matchOriginal.getStatus().equals(TLWMatch.STATUS_PROVISIONAL_RESULT_AVAILABLE)
|
||||
&& Objects.equals(matchOriginal.getGoalsHome(), matchUpdated.getGoalsHome())
|
||||
&& Objects.equals(matchOriginal.getGoalsGuest(), matchUpdated.getGoalsGuest())
|
||||
&& (!matchOriginal.getKoMatch() || (
|
||||
matchOriginal.getKoMatch()
|
||||
&& Objects.equals(matchOriginal.getGoalsOvertimeHome(), matchUpdated.getGoalsOvertimeHome())
|
||||
&& Objects.equals(matchOriginal.getGoalsOvertimeGuest(), matchUpdated.getGoalsOvertimeGuest())
|
||||
))
|
||||
) {
|
||||
this.beautifulInfo += beautifulInfoStart +
|
||||
"Ergebnis gespeichert.\n";
|
||||
}
|
||||
}
|
||||
|
||||
public String getBeautifulInfo() {
|
||||
return this.beautifulInfo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,356 @@
|
||||
package de.jeyp91.tippliga;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import de.jeyp91.StatusHolder;
|
||||
import de.jeyp91.apifootball.APIFootballMatch;
|
||||
import de.jeyp91.apifootball.APIFootballMatchesProvider;
|
||||
import de.jeyp91.teamidmatcher.TeamIDMatcher;
|
||||
import de.jeyp91.tippligaforum.TippligaSQLConnector;
|
||||
|
||||
public class TLWMatchesUpdaterFootball extends TLWMatchesManagerBase {
|
||||
private static final Logger logger = LoggerFactory.getLogger(TLWMatchesUpdaterFootball.class);
|
||||
|
||||
ArrayList<TLWMatch> tlwMatchesOriginal;
|
||||
ArrayList<TLWMatch> tlwMatchesUpdated;
|
||||
|
||||
String beautifulInfo = "";
|
||||
|
||||
public TLWMatchesUpdaterFootball(int season, int league, String configFileName) {
|
||||
this.season = season;
|
||||
this.league = league;
|
||||
|
||||
tlwMatchesOriginal = new ArrayList<>();
|
||||
tlwMatchesUpdated = new ArrayList<>();
|
||||
|
||||
super.initConfigParamsFromFile(configFileName);
|
||||
this.initUpdates();
|
||||
}
|
||||
|
||||
private void initUpdates() {
|
||||
|
||||
APIFootballMatchesProvider apiFootballMatchesProvider = new APIFootballMatchesProvider(this.season);
|
||||
TippligaSQLConnector tippligaSQLConnector = TippligaSQLConnector.getInstance();
|
||||
for (Object singleMatchdayConfig : this.matchdayConfig) {
|
||||
int tlwMatchday = ((Long) ((JSONObject) singleMatchdayConfig).get("TLWMatchday")).intValue();
|
||||
|
||||
ArrayList<APIFootballMatch> apiFootballMatches = apiFootballMatchesProvider.getAPIFootballMatchesFromConfig((JSONObject) singleMatchdayConfig);
|
||||
|
||||
if(apiFootballMatches.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ArrayList<TLWMatch> tlwMatchesOriginalMatchday = tippligaSQLConnector.getMatches(String.valueOf(this.season), String.valueOf(this.league), String.valueOf(tlwMatchday));
|
||||
ArrayList<TLWMatch> tlwMatchesUpdatedMatchday = new ArrayList<>();
|
||||
for (TLWMatch match : tlwMatchesOriginalMatchday) {
|
||||
tlwMatchesUpdatedMatchday.add(new TLWMatch(match));
|
||||
}
|
||||
|
||||
if (apiFootballMatches.size() > tlwMatchesUpdatedMatchday.size()) {
|
||||
logger.error("Not matching config!");
|
||||
}
|
||||
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
LocalDateTime firstMatchOriginal = TLWMatchesManagerBase.getFirstMatchtimeTLW(tlwMatchesOriginalMatchday);
|
||||
LocalDateTime firstMatchUpdated = TLWMatchesManagerBase.getFirstMatchtimeAPIFootball(apiFootballMatches);
|
||||
|
||||
if(now.isBefore(firstMatchOriginal) && now.isBefore(firstMatchUpdated)) {
|
||||
addMissingMatches(tlwMatchesUpdatedMatchday, apiFootballMatches);
|
||||
updateMatchDateTimes(tlwMatchesUpdatedMatchday, apiFootballMatches);
|
||||
updateShowTable(tlwMatchesUpdatedMatchday, apiFootballMatches);
|
||||
updateStatus(tlwMatchesUpdatedMatchday);
|
||||
}
|
||||
if(now.isBefore(firstMatchOriginal)) {
|
||||
updateStatus(tlwMatchesUpdatedMatchday);
|
||||
addPlaceholderMatches(tlwMatchesUpdatedMatchday, (JSONObject) singleMatchdayConfig);
|
||||
}
|
||||
|
||||
this.tlwMatchesOriginal.addAll(tlwMatchesOriginalMatchday);
|
||||
this.tlwMatchesUpdated.addAll(tlwMatchesUpdatedMatchday);
|
||||
}
|
||||
}
|
||||
|
||||
public String getUpdateSQL() {
|
||||
return this.getUpdateString(tlwMatchesOriginal, tlwMatchesUpdated);
|
||||
}
|
||||
|
||||
private String getUpdateString(ArrayList<TLWMatch> matchesOriginal, ArrayList<TLWMatch> matchesUpdated) {
|
||||
String updateString = "";
|
||||
for (int i = 0; i < matchesOriginal.size(); i++) {
|
||||
updateString += getUpdateString(matchesOriginal.get(i), matchesUpdated.get(i));
|
||||
}
|
||||
return updateString;
|
||||
}
|
||||
|
||||
private String getUpdateString(TLWMatch matchOriginal, TLWMatch matchUpdated) {
|
||||
String updateString = "";
|
||||
String updateStart = "UPDATE phpbb_footb_matches SET ";
|
||||
String condition = "WHERE season = " + matchOriginal.getSeason() + " " +
|
||||
"AND league = " + matchOriginal.getLeague() + " " +
|
||||
"AND matchday = " + matchOriginal.getMatchday() + " " +
|
||||
"AND match_no = " + matchOriginal.getMatchNo() + ";\n";
|
||||
String beautifulInfoStart = "Aktualisiere Saison " + matchOriginal.getSeason() + ", " +
|
||||
"Liga " + matchOriginal.getLeague() + ", " +
|
||||
"Spieltag " + matchOriginal.getMatchday() + ", " +
|
||||
"Spielnummer " + matchOriginal.getMatchNo() + ", " +
|
||||
"Spiel '" + TeamIDMatcher.getTeamNameFromTippligaId(matchOriginal.getTeamIdHome()) + "' - '" + TeamIDMatcher.getTeamNameFromTippligaId(matchOriginal.getTeamIdGuest()) + "', ";
|
||||
|
||||
if(!matchOriginal.getTeamIdHome().equals(matchUpdated.getTeamIdHome())) {
|
||||
updateString += updateStart +
|
||||
"team_id_home = " + matchUpdated.getTeamIdHome() + " " +
|
||||
condition;
|
||||
this.beautifulInfo += beautifulInfoStart +
|
||||
"Heimteam zu '" + matchUpdated.getTeamNameHome() + "'.\n";
|
||||
}
|
||||
|
||||
if(!matchOriginal.getTeamIdGuest().equals(matchUpdated.getTeamIdGuest())) {
|
||||
updateString += updateStart +
|
||||
"team_id_guest = " + matchUpdated.getTeamIdGuest() + " " +
|
||||
condition;
|
||||
this.beautifulInfo += beautifulInfoStart +
|
||||
"Gastteam zu '" + matchUpdated.getTeamNameGuest() + "'.\n";
|
||||
}
|
||||
|
||||
if (!matchOriginal.getMatchDateTime().equals(matchUpdated.getMatchDateTime())) {
|
||||
updateString += updateStart +
|
||||
"match_datetime = '" + matchUpdated.getMatchDateTime() + "' " +
|
||||
condition;
|
||||
this.beautifulInfo += beautifulInfoStart +
|
||||
"Spielbeginn zu '" + matchUpdated.getMatchDateTime() + "'.\n";
|
||||
}
|
||||
|
||||
if (!matchOriginal.getStatus().equals(matchUpdated.getStatus())) {
|
||||
updateString += updateStart +
|
||||
"status = '" + matchUpdated.getStatus() + "' " +
|
||||
condition;
|
||||
this.beautifulInfo += beautifulInfoStart +
|
||||
"Status zu '" + matchUpdated.getStatus() + "'.\n";
|
||||
}
|
||||
|
||||
if (!matchOriginal.getShowTable().equals(matchUpdated.getShowTable())) {
|
||||
updateString += updateStart +
|
||||
"show_table = '" + matchUpdated.getShowTable() + "' " +
|
||||
condition;
|
||||
this.beautifulInfo += beautifulInfoStart +
|
||||
"Spiel in Tabelle einberechnen zu '" + (matchUpdated.getShowTable() == 1 ? "falsch" : "wahr") + "'.\n";
|
||||
}
|
||||
|
||||
if (!matchOriginal.getKoMatch().equals(matchUpdated.getKoMatch())) {
|
||||
updateString += updateStart +
|
||||
"ko_match = '" + (matchUpdated.getKoMatch() ? "1" : "0") + "' " +
|
||||
condition;
|
||||
this.beautifulInfo += beautifulInfoStart +
|
||||
"KO zu '" + (matchUpdated.getKoMatch() ? "wahr" : "falsch") + "'.\n";
|
||||
}
|
||||
|
||||
|
||||
return updateString;
|
||||
}
|
||||
|
||||
private void addMissingMatches(ArrayList<TLWMatch> tlwMatches,
|
||||
ArrayList<APIFootballMatch> apiFootballMatches) {
|
||||
|
||||
ArrayList<APIFootballMatch> missingMatches = new ArrayList<>();
|
||||
if(!validateApiFootballTeamIds(apiFootballMatches)) {
|
||||
return;
|
||||
}
|
||||
|
||||
for(APIFootballMatch apiFootballMatch : apiFootballMatches) {
|
||||
if(getMatchingMatch(apiFootballMatch, tlwMatches) == null) {
|
||||
missingMatches.add(apiFootballMatch);
|
||||
}
|
||||
}
|
||||
|
||||
for (APIFootballMatch missingMatch : missingMatches) {
|
||||
Integer missingTeamIdHome = TeamIDMatcher.getTippligaIdFromApiFootballId(missingMatch, TeamIDMatcher.HOME);
|
||||
Integer missingTeamIdGuest = TeamIDMatcher.getTippligaIdFromApiFootballId(missingMatch, TeamIDMatcher.GUEST);
|
||||
boolean done = false;
|
||||
// update placeholder match based on matching match datetime
|
||||
for (TLWMatch tlwMatch : tlwMatches) {
|
||||
Boolean homeMatches = tlwMatch.getTeamIdHome() == 0 || tlwMatch.getTeamIdHome().equals(missingTeamIdHome);
|
||||
Boolean guestMatches =tlwMatch.getTeamIdGuest() == 0 || tlwMatch.getTeamIdGuest().equals(missingTeamIdGuest);
|
||||
Boolean timeMatches = Objects.equals(tlwMatch.getMatchDateTime(), missingMatch.getMatchDateTime().replace("T", " ").substring(0, 19));
|
||||
Boolean formulaHomeMatches = !Objects.equals(tlwMatch.getFormulaHome(), "");
|
||||
Boolean formulaGuestMatches = !Objects.equals(tlwMatch.getFormulaGuest(), "");
|
||||
if (
|
||||
homeMatches
|
||||
&& guestMatches
|
||||
&& timeMatches
|
||||
&& formulaHomeMatches
|
||||
&& formulaGuestMatches
|
||||
) {
|
||||
tlwMatch.updateMatch(missingMatch);
|
||||
done = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// update empty match
|
||||
if(!done) {
|
||||
for (TLWMatch tlwMatch : tlwMatches) {
|
||||
Integer teamIdHome = tlwMatch.getTeamIdHome();
|
||||
Integer teamIdGuest = tlwMatch.getTeamIdGuest();
|
||||
String formulaHome = tlwMatch.getFormulaHome();
|
||||
String formulaGuest = tlwMatch.getFormulaGuest();
|
||||
if (
|
||||
(Objects.equals(teamIdHome, 0) || Objects.equals(teamIdHome, null))
|
||||
&& (Objects.equals(teamIdGuest, 0) || Objects.equals(teamIdGuest, null))
|
||||
&& (Objects.equals(formulaHome, "") || Objects.equals(formulaHome, "D"))
|
||||
&& (Objects.equals(formulaGuest, "") || Objects.equals(formulaGuest, "D"))
|
||||
) {
|
||||
tlwMatch.updateMatch(missingMatch);
|
||||
done = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!done) {
|
||||
logger.error("Could not add missing match: " + this.season + ", " + this.league + ", " + tlwMatches.get(0).getMatchday() + ", " + missingMatch.getTeamNameHome() + " - " + missingMatch.getTeamNameGuest());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addPlaceholderMatches(ArrayList<TLWMatch> tlwMatches,
|
||||
JSONObject matchdayConfig) {
|
||||
Integer numberOfMatches = this.matchesPerMatchday;
|
||||
try { numberOfMatches = ((Long) matchdayConfig.get("numberOfMatches")).intValue();} catch (Exception ignored) {}
|
||||
ArrayList<TLWMatch> placeholderMatches = new ArrayList<>();
|
||||
ArrayList<TLWMatch> tlwMatchesCopy = new ArrayList<>(tlwMatches);
|
||||
JSONArray matchesConfig = (JSONArray) matchdayConfig.get("matchesConfig");
|
||||
for (Object singleMatchConfig : matchesConfig) {
|
||||
// check if type placeholderSingleMatch
|
||||
if(((JSONObject) singleMatchConfig).get("type").equals("PlaceholderSingleMatch")) {
|
||||
String formulaHome = (String) ((JSONObject) singleMatchConfig).get("formulaHome");
|
||||
String formulaGuest = (String) ((JSONObject) singleMatchConfig).get("formulaGuest");
|
||||
String matchDateTime = (String) ((JSONObject) singleMatchConfig).get("placeholderDatetime");
|
||||
TLWMatch placeholderMatch = new TLWMatch(formulaHome, formulaGuest, matchDateTime);
|
||||
placeholderMatches.add(placeholderMatch);
|
||||
}
|
||||
}
|
||||
// filter placeholderMatches by checking if they are already in tlwMatches
|
||||
Iterator<TLWMatch> placeholderIterator = placeholderMatches.iterator();
|
||||
while (placeholderIterator.hasNext()) {
|
||||
TLWMatch placeholderMatch = placeholderIterator.next();
|
||||
Iterator<TLWMatch> tlwMatchIterator = tlwMatchesCopy.iterator();
|
||||
while (tlwMatchIterator.hasNext()) {
|
||||
TLWMatch tlwMatch = tlwMatchIterator.next();
|
||||
if (TLWMatch.isSameMatchPlaceholder(tlwMatch, placeholderMatch)) {
|
||||
tlwMatchIterator.remove();
|
||||
placeholderIterator.remove();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// check if total number of matches is not too high
|
||||
if(tlwMatches.size() + placeholderMatches.size() > (numberOfMatches)) {
|
||||
logger.error("Too many matches in config: " + this.season + ", " + this.league + ", " + tlwMatches.get(0).getMatchday());
|
||||
} else {
|
||||
// add placeholderMatches to tlwMatches
|
||||
tlwMatches.addAll(placeholderMatches);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateMatchDateTimes(
|
||||
ArrayList<TLWMatch> tlwMatches,
|
||||
ArrayList<APIFootballMatch> apiFootballMatches)
|
||||
{
|
||||
ArrayList<TLWMatch> tlwMatchesCopy = new ArrayList<>(tlwMatches);
|
||||
for(APIFootballMatch apiFootballMatch : apiFootballMatches) {
|
||||
try {
|
||||
TLWMatch tlwMatch = getMatchingMatch(apiFootballMatch, tlwMatchesCopy);
|
||||
tlwMatchesCopy.remove(tlwMatch);
|
||||
if(tlwMatch == null) {
|
||||
StatusHolder.setError();
|
||||
logger.error("Did not find match to update: " + this.season + ", " + this.league + ", " + tlwMatches.get(0).getMatchday() + ", " + apiFootballMatch.getTeamNameHome() + " - " + apiFootballMatch.getTeamNameGuest());
|
||||
}
|
||||
tlwMatch.setMatchDateTime(apiFootballMatch.getMatchDateTime().replace("T", " ").substring(0, 19));
|
||||
} catch(NullPointerException ignored) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateStatus(ArrayList<TLWMatch> matches) {
|
||||
LocalDateTime earliestDate = TLWMatchesManagerBase.getFirstMatchtimeTLW(matches);
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
if(earliestDate.isAfter(now)) {
|
||||
for(TLWMatch match : matches) {
|
||||
LocalDateTime date = TLWMatchesManagerBase.getDate(match);
|
||||
int daysDifference = TLWMatchesManagerBase.getDaysDifference(earliestDate, date);
|
||||
if (daysDifference == 0) {
|
||||
match.setStatus(0);
|
||||
} else if (daysDifference > 0 && daysDifference < 7) {
|
||||
match.setStatus(-1);
|
||||
} else {
|
||||
match.setStatus(-2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateShowTable(
|
||||
ArrayList<TLWMatch> tlwMatches,
|
||||
ArrayList<APIFootballMatch> apiFootballMatches)
|
||||
{
|
||||
ArrayList<TLWMatch> tlwMatchesCopy = new ArrayList<>(tlwMatches);
|
||||
for(APIFootballMatch apiFootballMatch : apiFootballMatches) {
|
||||
try {
|
||||
TLWMatch tlwMatch = getMatchingMatch(apiFootballMatch, tlwMatchesCopy);
|
||||
if(tlwMatch.getTeamIdHome() == 4) {
|
||||
int debug = 1;
|
||||
}
|
||||
tlwMatchesCopy.remove(tlwMatch);
|
||||
tlwMatch.setShowTable(apiFootballMatch.getShowTable() == 0);
|
||||
} catch (NullPointerException ignored) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateKo(
|
||||
ArrayList<TLWMatch> tlwMatches,
|
||||
ArrayList<APIFootballMatch> apiFootballMatches)
|
||||
{
|
||||
ArrayList<TLWMatch> tlwMatchesCopy = new ArrayList<>(tlwMatches);
|
||||
for(APIFootballMatch apiFootballMatch : apiFootballMatches) {
|
||||
try {
|
||||
TLWMatch tlwMatch = getMatchingMatch(apiFootballMatch, tlwMatchesCopy);
|
||||
tlwMatchesCopy.remove(tlwMatch);
|
||||
tlwMatch.setKoMatch(apiFootballMatch.getKoMatch());
|
||||
} catch (NullPointerException ignored) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<TLWMatch> getTLWMatchesUpdated() {
|
||||
return this.tlwMatchesUpdated;
|
||||
}
|
||||
|
||||
public String getBeautifulInfo() {
|
||||
return this.beautifulInfo;
|
||||
}
|
||||
|
||||
private boolean validateApiFootballTeamIds(ArrayList<APIFootballMatch> apiFootballMatches) {
|
||||
|
||||
int missing = 0;
|
||||
|
||||
for(APIFootballMatch apiFootballMatch : apiFootballMatches) {
|
||||
if(TeamIDMatcher.getTippligaIdFromApiFootballId(apiFootballMatch, TeamIDMatcher.HOME) == null) {
|
||||
missing++;
|
||||
}
|
||||
if(TeamIDMatcher.getTippligaIdFromApiFootballId(apiFootballMatch, TeamIDMatcher.GUEST) == null) {
|
||||
missing++;
|
||||
}
|
||||
}
|
||||
|
||||
return missing == 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package de.jeyp91.tippliga;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class TLWTeam {
|
||||
|
||||
private int season;
|
||||
private int league;
|
||||
private int teamId;
|
||||
private String teamName;
|
||||
private String teamNameShort;
|
||||
private String teamSymbol;
|
||||
private String groupId;
|
||||
private int matchday;
|
||||
|
||||
public TLWTeam(ResultSet rset) {
|
||||
final int SEASON = 1;
|
||||
final int LEAGUE = 2;
|
||||
final int TEAM_ID = 3;
|
||||
final int TEAM_NAME = 4;
|
||||
final int TEAM_NAME_SHORT = 5;
|
||||
final int TEAM_SYMBOL = 6;
|
||||
final int GROUP_ID = 7;
|
||||
final int MATCHDAY = 8;
|
||||
|
||||
try {
|
||||
this.season = Integer.parseInt(rset.getString(SEASON));
|
||||
this.league = Integer.parseInt(rset.getString(LEAGUE));
|
||||
this.teamId = Integer.parseInt(rset.getString(TEAM_ID));
|
||||
this.teamName = rset.getString(TEAM_NAME);
|
||||
this.teamNameShort = rset.getString(TEAM_NAME_SHORT);
|
||||
this.teamSymbol = rset.getString(TEAM_SYMBOL);
|
||||
this.groupId = rset.getString(GROUP_ID);
|
||||
this.matchday = Integer.parseInt(rset.getString(MATCHDAY));
|
||||
} catch (SQLException e) {
|
||||
/* TODO */
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public TLWTeam(
|
||||
int season, int league, int teamId,
|
||||
String teamName, String teamNameShort, String teamSymbol, String groupId,
|
||||
int matchday
|
||||
) {
|
||||
this.season = season;
|
||||
this.league = league;
|
||||
this.teamId = teamId;
|
||||
this.teamName = teamName;
|
||||
this.teamNameShort = teamNameShort;
|
||||
this.teamSymbol = teamSymbol;
|
||||
this.groupId = groupId;
|
||||
this.matchday = matchday;
|
||||
}
|
||||
|
||||
public int getSeason() {
|
||||
return this.season;
|
||||
}
|
||||
|
||||
public int getLeague() {
|
||||
return this.league;
|
||||
}
|
||||
|
||||
public int getTeamId() {
|
||||
return this.teamId;
|
||||
}
|
||||
|
||||
public String getTeamName() {
|
||||
return this.teamName;
|
||||
}
|
||||
|
||||
public String getTeamNameShort() {
|
||||
return this.teamNameShort;
|
||||
}
|
||||
|
||||
public String getTeamSymbol() {
|
||||
return this.teamSymbol;
|
||||
}
|
||||
|
||||
public String getGroupId() {
|
||||
return this.groupId;
|
||||
}
|
||||
|
||||
public int getMatchday() {
|
||||
return this.matchday;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package de.jeyp91.tippliga;
|
||||
|
||||
import de.jeyp91.tippligaforum.TippligaSQLConnector;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class TLWTeamsCreator {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(TLWTeamsCreator.class);
|
||||
int season;
|
||||
int league;
|
||||
ArrayList<TLWMatch> matches;
|
||||
TippligaSQLConnector connector = TippligaSQLConnector.getInstance();
|
||||
|
||||
public TLWTeamsCreator(int season, int league, ArrayList<TLWMatch> matches) {
|
||||
this.season = season;
|
||||
this.league = league;
|
||||
this.matches = matches;
|
||||
}
|
||||
|
||||
public Set<Integer> getTeamIds() {
|
||||
Set<Integer> teamIds = new LinkedHashSet<>();
|
||||
for(TLWMatch match : matches) {
|
||||
if(match.getTeamIdHome() != null) {
|
||||
teamIds.add(match.getTeamIdHome());
|
||||
}
|
||||
if(match.getTeamIdGuest() != null) {
|
||||
teamIds.add(match.getTeamIdGuest());
|
||||
}
|
||||
}
|
||||
return teamIds;
|
||||
}
|
||||
|
||||
public String getSql() {
|
||||
Set<Integer> teamIds = getTeamIds();
|
||||
String sql = "";
|
||||
for (Integer id : teamIds) {
|
||||
ArrayList<TLWTeam> teams = connector.getTeams(String.valueOf(id));
|
||||
if(teams.size() == 0) {
|
||||
this.logger.error("Did not find team id " + id.toString());
|
||||
continue;
|
||||
}
|
||||
String teamName = teams.get(0).getTeamName();
|
||||
String teamNameShort = teams.get(0).getTeamNameShort();
|
||||
String teamSymbol = teams.get(0).getTeamSymbol();
|
||||
String groupId = getGroup(id);
|
||||
int matchday = getMatchday(id);
|
||||
sql += "REPLACE INTO phpbb_footb_teams VALUES ('";
|
||||
sql += this.season;
|
||||
sql += "', '";
|
||||
sql += this.league;
|
||||
sql += "', '";
|
||||
sql += id;
|
||||
sql += "', '";
|
||||
sql += teamName;
|
||||
sql += "', '";
|
||||
sql += teamNameShort;
|
||||
sql += "', '";
|
||||
sql += teamSymbol;
|
||||
sql += "', '";
|
||||
sql += groupId;
|
||||
sql += "', '";
|
||||
sql += matchday;
|
||||
sql += "');\n";
|
||||
}
|
||||
return sql;
|
||||
}
|
||||
|
||||
String getGroup(Integer teamId) {
|
||||
for(TLWMatch match: matches) {
|
||||
if(teamId.equals(match.getTeamIdHome()) || teamId.equals(match.getTeamIdGuest())) {
|
||||
return match.getGroupId() != null ? match.getGroupId() : "";
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
int getMatchday(Integer teamId) {
|
||||
int matchday = 0;
|
||||
for(TLWMatch match: matches) {
|
||||
if(teamId.equals(match.getTeamIdHome()) || teamId.equals(match.getTeamIdGuest())) {
|
||||
matchday = matchday > match.getMatchday() ? matchday : match.getMatchday();
|
||||
}
|
||||
}
|
||||
return matchday;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package de.jeyp91.tippliga;
|
||||
|
||||
import de.jeyp91.tippligaforum.TippligaSQLConnector;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
|
||||
public class TLWTeamsUpdater {
|
||||
|
||||
Integer season;
|
||||
Integer league;
|
||||
ArrayList<TLWTeam> teamsOriginal;
|
||||
ArrayList<TLWMatch> matchesUpdated;
|
||||
ArrayList<TLWTeam> missingTeams;
|
||||
|
||||
public TLWTeamsUpdater(int season, int league, String configFileName) {
|
||||
|
||||
TippligaSQLConnector conn = TippligaSQLConnector.getInstance();
|
||||
|
||||
this.season = season;
|
||||
this.league = league;
|
||||
this.matchesUpdated = new ArrayList<>();
|
||||
|
||||
TLWMatchesUpdaterFootball matchesUpdaterFootball = new TLWMatchesUpdaterFootball(season, league, configFileName);
|
||||
this.matchesUpdated.addAll(matchesUpdaterFootball.getTLWMatchesUpdated());
|
||||
this.matchesUpdated.addAll(conn.getMatches(String.valueOf(season), String.valueOf(league)));
|
||||
|
||||
missingTeams = new ArrayList<>();
|
||||
|
||||
teamsOriginal = conn.getTeams(String.valueOf(season), String.valueOf(league));
|
||||
|
||||
HashSet<Integer> missingIds = this.initMissingIds();
|
||||
this.initMissingTeams(missingIds);
|
||||
}
|
||||
|
||||
private HashSet<Integer> initMissingIds() {
|
||||
HashSet<Integer> missingIds = new HashSet<>();
|
||||
|
||||
for(TLWMatch match : matchesUpdated) {
|
||||
if(isTeamMissing(match.getTeamIdHome())) {
|
||||
missingIds.add(match.getTeamIdHome());
|
||||
}
|
||||
if(isTeamMissing(match.getTeamIdGuest())) {
|
||||
missingIds.add(match.getTeamIdGuest());
|
||||
}
|
||||
}
|
||||
missingIds.remove(0);
|
||||
return missingIds;
|
||||
}
|
||||
|
||||
private void initMissingTeams(HashSet<Integer> missingIds) {
|
||||
TippligaSQLConnector conn = TippligaSQLConnector.getInstance();
|
||||
for (Integer id : missingIds) {
|
||||
ArrayList<TLWTeam> teams = conn.getTeams(String.valueOf(id));
|
||||
missingTeams.add(new TLWTeam(
|
||||
this.season,
|
||||
this.league,
|
||||
id,
|
||||
teams.get(0).getTeamName(),
|
||||
teams.get(0).getTeamNameShort(),
|
||||
teams.get(0).getTeamSymbol(),
|
||||
"",
|
||||
0
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isTeamMissing(int id) {
|
||||
boolean teamMissing = true;
|
||||
for(TLWTeam team : teamsOriginal) {
|
||||
if(team.getTeamId() == id) {
|
||||
teamMissing = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return teamMissing;
|
||||
}
|
||||
|
||||
public String getInsertSQL() {
|
||||
String updateSql = "";
|
||||
|
||||
for(TLWTeam team : missingTeams) {
|
||||
|
||||
updateSql += "INSERT INTO phpbb_footb_teams VALUES (" +
|
||||
team.getSeason() + ", " +
|
||||
team.getLeague() + ", " +
|
||||
team.getTeamId() + ", " +
|
||||
"'" + team.getTeamName() + "', " +
|
||||
"'" + team.getTeamNameShort() + "', " +
|
||||
"'" + team.getTeamSymbol() + "', " +
|
||||
"'" + team.getGroupId() + "', " +
|
||||
team.getMatchday() +
|
||||
");\n";
|
||||
}
|
||||
|
||||
return updateSql;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package de.jeyp91.tippligaforum;
|
||||
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
import de.jeyp91.S3Provider;
|
||||
import de.jeyp91.apifootball.APIFootballMatch;
|
||||
|
||||
public class MatchesListCreator {
|
||||
|
||||
private final JSONObject mainObject = new JSONObject();
|
||||
private String country;
|
||||
private String leagueName;
|
||||
private final int season;
|
||||
|
||||
public MatchesListCreator(int season, int league) {
|
||||
this.season = season;
|
||||
S3Provider prov = new S3Provider();
|
||||
JSONObject leagueConfig = prov.getFixturesJSONFromS3(season, league);
|
||||
if (leagueConfig == null) {
|
||||
return;
|
||||
}
|
||||
JSONArray matchesAPIFootball = (JSONArray) leagueConfig.get("response");
|
||||
|
||||
if(matchesAPIFootball.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
JSONObject firstMatchAPIFootball = (JSONObject) matchesAPIFootball.get(0);
|
||||
JSONObject leagueObject = (JSONObject) firstMatchAPIFootball.get("league");
|
||||
this.country = leagueObject.get("country").toString();
|
||||
this.leagueName = leagueObject.get("name").toString();
|
||||
|
||||
JSONArray matchesConfig = populateMatches(matchesAPIFootball);
|
||||
|
||||
JSONObject matchdayConfigObject = new JSONObject();
|
||||
matchdayConfigObject.put("matchesConfig", matchesConfig);
|
||||
|
||||
JSONArray matchdayConfig = new JSONArray();
|
||||
matchdayConfig.add(matchdayConfigObject);
|
||||
|
||||
this.mainObject.put("matchdayConfig", matchdayConfig);
|
||||
}
|
||||
|
||||
private JSONArray populateMatches(JSONArray matchesAPIFootball) {
|
||||
JSONArray matches = new JSONArray();
|
||||
for(Object matchAPIFootballObject : matchesAPIFootball) {
|
||||
JSONObject matchAPIFootball = (JSONObject) matchAPIFootballObject;
|
||||
JSONObject match = new JSONObject();
|
||||
|
||||
JSONObject leagueObject = (JSONObject) matchAPIFootball.get("league");
|
||||
Long leagueId = (Long) leagueObject.get("id");
|
||||
String matchdayString = leagueObject.get("round").toString();
|
||||
int matchday = APIFootballMatch.getMatchdayFromRoundString(this.season, matchdayString, leagueId.intValue());
|
||||
|
||||
JSONObject fixtureObject = (JSONObject) matchAPIFootball.get("fixture");
|
||||
String matchtime = fixtureObject.get("date").toString().replace("T", " ").substring(0, 16);
|
||||
Long fixtureId = (Long) fixtureObject.get("id");
|
||||
|
||||
JSONObject teamsObject = (JSONObject) matchAPIFootball.get("teams");
|
||||
JSONObject teamHome = (JSONObject) teamsObject.get("home");
|
||||
String teamNameHome = teamHome.get("name").toString();
|
||||
JSONObject teamGuest = (JSONObject) teamsObject.get("away");
|
||||
String teamNameGuest = teamGuest.get("name").toString();
|
||||
|
||||
match.put("match", teamNameHome + " - " + teamNameGuest);
|
||||
match.put("matchday", matchday);
|
||||
match.put("matchtime", matchtime);
|
||||
match.put("type", "SingleMatch");
|
||||
match.put("matchLeague", leagueId);
|
||||
match.put("matchId", fixtureId);
|
||||
match.put("showTable", false);
|
||||
matches.add(match);
|
||||
}
|
||||
return matches;
|
||||
}
|
||||
|
||||
public JSONObject getMatches() {
|
||||
return this.mainObject;
|
||||
}
|
||||
|
||||
public String getMatchesBeautiful() {
|
||||
JsonElement jelement = JsonParser.parseString(this.mainObject.toString());
|
||||
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||
return gson.toJson(jelement);
|
||||
}
|
||||
|
||||
public String getCountry() {
|
||||
return country;
|
||||
}
|
||||
|
||||
public String getLeagueName() {
|
||||
return leagueName;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package de.jeyp91.tippligaforum;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import de.jeyp91.apifootball.APIFootballUpdater;
|
||||
|
||||
public class MatchesListForumUpdater {
|
||||
private HashSet<Integer> leagues;
|
||||
private static final Logger logger = LoggerFactory.getLogger(MatchesListForumUpdater.class);
|
||||
|
||||
public MatchesListForumUpdater() {
|
||||
this.leagues = new APIFootballUpdater().getLeagues();
|
||||
}
|
||||
|
||||
public void updateAllLeagues(int season) {
|
||||
for(Integer league : this.leagues) {
|
||||
updateLeague(season, league);
|
||||
}
|
||||
}
|
||||
|
||||
public void updateLeague(int season, int league) {
|
||||
MatchesListCreator creator = new MatchesListCreator(season, league);
|
||||
if(creator.getMatches().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
String content = creator.getMatchesBeautiful();
|
||||
String contentWithCodeBBCode = "<r><CODE><s>[code]</s>" + content + "<e>[/code]</e></CODE></r>";
|
||||
Integer postId = getPostId(season, creator.getCountry(), creator.getLeagueName());
|
||||
if(postId != null) {
|
||||
TippligaSQLConnector con = TippligaSQLConnector.getInstance();
|
||||
con.updatePost(postId, contentWithCodeBBCode);
|
||||
}
|
||||
}
|
||||
|
||||
private Integer getPostId(int season, String country, String league) {
|
||||
TippligaSQLConnector con = TippligaSQLConnector.getInstance();
|
||||
Integer adminForumId = con.getForumId("Admin");
|
||||
Integer tippligaConfigForumId = con.getForumId("Tippliga-Config", adminForumId);
|
||||
Integer seasonForumId = con.getForumId(String.valueOf(season), tippligaConfigForumId);
|
||||
Integer leagueForumId = con.getForumId("Ligen", seasonForumId);
|
||||
String query = "SELECT post_id FROM phpbb_posts WHERE post_subject = '" + country + " " + league + "' AND forum_id = " + leagueForumId + ";";
|
||||
ResultSet rset = con.executeQuery(query);
|
||||
Integer postId = null;
|
||||
try {
|
||||
rset.next();
|
||||
postId = Integer.parseInt(rset.getString(1));
|
||||
} catch (SQLException e) {
|
||||
logger.error("Could not find post for " + country + " - " + league + ".");
|
||||
logger.error(e.getMessage());
|
||||
}
|
||||
return postId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
package de.jeyp91.tippligaforum;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class SeasonForumPostsCreator {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(SeasonForumPostsCreator.class);
|
||||
private static final String EMPTY_POST_CONTENT = "[code][/code]";
|
||||
|
||||
private static final String[] CONFIG_POSTS = {
|
||||
"Supercup Tipper",
|
||||
"WTL-Pokal Tipper",
|
||||
"2. Tippliga Tipper",
|
||||
"1. Tippliga Tipper",
|
||||
"Relegation",
|
||||
"Supercup",
|
||||
"WTL-Pokal",
|
||||
"Tippliga"
|
||||
};
|
||||
|
||||
private static final String[] MATCH_LIST_POSTS = {
|
||||
"World UEFA Super Cup",
|
||||
"World UEFA Europa Conference League",
|
||||
"World UEFA Europa League",
|
||||
"World UEFA Champions League",
|
||||
"Austria Bundesliga",
|
||||
"Portugal Primeira Liga",
|
||||
"Netherlands Eredivisie",
|
||||
"Turkey Süper Lig",
|
||||
"France Ligue 1",
|
||||
"Italy Serie A",
|
||||
"Spain La Liga",
|
||||
"England Premier League",
|
||||
"Germany Super Cup",
|
||||
"Germany Frauen Bundesliga",
|
||||
"Germany U19 Bundesliga",
|
||||
"Germany Regionalliga - SudWest",
|
||||
"Germany Regionalliga - Bayern",
|
||||
"Germany 3. Liga",
|
||||
"Germany 2. Bundesliga",
|
||||
"Germany Bundesliga",
|
||||
"Germany DFB Pokal"
|
||||
};
|
||||
|
||||
private final int season;
|
||||
private final TippligaWebsiteConnector connector;
|
||||
private final TippligaSQLConnector sqlConnector;
|
||||
|
||||
public SeasonForumPostsCreator(int season) {
|
||||
this.season = season;
|
||||
try {
|
||||
this.connector = new TippligaWebsiteConnector();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
this.sqlConnector = TippligaSQLConnector.getInstance();
|
||||
}
|
||||
|
||||
public void createAllPosts() {
|
||||
Integer adminForumId = sqlConnector.getForumId("Admin");
|
||||
if (adminForumId == null) {
|
||||
logger.error("Forum 'Admin' not found. Aborting.");
|
||||
return;
|
||||
}
|
||||
|
||||
Integer tippligaConfigForumId = sqlConnector.getForumId("Tippliga-Config", adminForumId);
|
||||
if (tippligaConfigForumId == null) {
|
||||
logger.error("Forum 'Tippliga-Config' not found. Aborting.");
|
||||
return;
|
||||
}
|
||||
|
||||
Integer seasonForumId = sqlConnector.getForumId(String.valueOf(season), tippligaConfigForumId);
|
||||
if (seasonForumId == null) {
|
||||
logger.error("Forum '" + season + "' not found under Tippliga-Config. Aborting.");
|
||||
return;
|
||||
}
|
||||
|
||||
Integer ligenForumId = sqlConnector.getForumId("Ligen", seasonForumId);
|
||||
if (ligenForumId == null) {
|
||||
logger.error("Forum 'Ligen' not found under " + season + ". Aborting.");
|
||||
return;
|
||||
}
|
||||
|
||||
createConfigPosts(seasonForumId);
|
||||
createMatchListPosts(ligenForumId);
|
||||
}
|
||||
|
||||
private void createConfigPosts(int seasonForumId) {
|
||||
logger.info("Creating config posts in forum " + season + "...");
|
||||
for (String subject : CONFIG_POSTS) {
|
||||
if (postExists(seasonForumId, subject)) {
|
||||
logger.info("Config post '" + subject + "' already exists. Skipping.");
|
||||
continue;
|
||||
}
|
||||
boolean success = connector.createPost(seasonForumId, subject, EMPTY_POST_CONTENT);
|
||||
if (success) {
|
||||
logger.info("Created config post: " + subject);
|
||||
} else {
|
||||
logger.error("Failed to create config post: " + subject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void createMatchListPosts(int ligenForumId) {
|
||||
logger.info("Creating match list posts in " + season + " > Ligen...");
|
||||
for (String subject : MATCH_LIST_POSTS) {
|
||||
if (postExists(ligenForumId, subject)) {
|
||||
logger.info("Match list post '" + subject + "' already exists. Skipping.");
|
||||
continue;
|
||||
}
|
||||
boolean success = connector.createPost(ligenForumId, subject, EMPTY_POST_CONTENT);
|
||||
if (success) {
|
||||
logger.info("Created match list post: " + subject);
|
||||
} else {
|
||||
logger.error("Failed to create match list post: " + subject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean postExists(int forumId, String subject) {
|
||||
String query = "SELECT COUNT(*) FROM phpbb_posts WHERE forum_id = " + forumId + " AND post_subject = '" + subject + "'";
|
||||
ResultSet rset = sqlConnector.executeQuery(query);
|
||||
try {
|
||||
if (rset != null && rset.next()) {
|
||||
return rset.getInt(1) > 0;
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
logger.error("Error checking if post exists", e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package de.jeyp91.tippligaforum;
|
||||
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
import org.json.simple.parser.ParseException;
|
||||
|
||||
public class TippligaConfigProvider {
|
||||
TippligaSQLConnector con;
|
||||
Integer seasonForumId;
|
||||
|
||||
public TippligaConfigProvider(int season) {
|
||||
this.con = TippligaSQLConnector.getInstance();
|
||||
Integer adminForumId = con.getForumId("Admin");
|
||||
Integer tippligaConfigForumId = con.getForumId("Tippliga-Config", adminForumId);
|
||||
this.seasonForumId = con.getForumId(String.valueOf(season), tippligaConfigForumId);
|
||||
}
|
||||
|
||||
public JSONObject getTippligaConfig(String config) {
|
||||
String post = this.con.getPost(config, this.seasonForumId);
|
||||
int postLength = post.length();
|
||||
post = post.substring(22, postLength - 25);
|
||||
|
||||
JSONObject tippligaConfig = null;
|
||||
JSONParser jsonParser = new JSONParser();
|
||||
try {
|
||||
tippligaConfig = (JSONObject) jsonParser.parse(post);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return tippligaConfig;
|
||||
}
|
||||
|
||||
public String getChecksumOfConfigPost(String configFile) {
|
||||
return con.getChecksumOfPost(this.seasonForumId, configFile);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,479 @@
|
||||
package de.jeyp91.tippligaforum;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import javax.xml.bind.DatatypeConverter;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import de.jeyp91.StatusHolder;
|
||||
import de.jeyp91.tippliga.TLWLeague;
|
||||
import de.jeyp91.tippliga.TLWMatch;
|
||||
import de.jeyp91.tippliga.TLWMatchday;
|
||||
import de.jeyp91.tippliga.TLWTeam;
|
||||
import de.jeyp91.whatsapp.WhatsAppReminder;
|
||||
|
||||
public class TippligaSQLConnector {
|
||||
|
||||
Connection con;
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(TippligaSQLConnector.class);
|
||||
private static TippligaSQLConnector tlwSqlCon = null;
|
||||
|
||||
static {
|
||||
try {
|
||||
Class.forName("com.mysql.cj.jdbc.Driver");
|
||||
} catch (ClassNotFoundException ex) {
|
||||
logger.error("Unable to load MySQL Driver");
|
||||
StatusHolder.setError();
|
||||
}
|
||||
}
|
||||
|
||||
private TippligaSQLConnector() {
|
||||
String databaseUsername = System.getenv("TLW_DATABASE_USERNAME");
|
||||
String databasePassword = System.getenv("TLW_DATABASE_PASSWORD");
|
||||
String jdbcUrlLocalhost = "jdbc:mysql://localhost:3306/d0144ddb" +
|
||||
"?user=root" +
|
||||
"&password=" +
|
||||
"&useUnicode=true" +
|
||||
"&useJDBCCompliantTimezoneShift=true" +
|
||||
"&useLegacyDatetimeCode=false" +
|
||||
"&serverTimezone=UTC" +
|
||||
"&allowMultiQueries=true";
|
||||
String jdbcUrlProd = "jdbc:mysql://w00f4eaf.kasserver.com:3306/d0144ddb" +
|
||||
"?user=" + databaseUsername +
|
||||
"&password=" + databasePassword +
|
||||
"&useUnicode=true" +
|
||||
"&useJDBCCompliantTimezoneShift=true" +
|
||||
"&useLegacyDatetimeCode=false" +
|
||||
"&serverTimezone=UTC" +
|
||||
"&allowMultiQueries=true" +
|
||||
"&useSSL=false";
|
||||
try {
|
||||
con = DriverManager.getConnection(jdbcUrlProd);
|
||||
} catch (SQLException e) {
|
||||
/* TODO */
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static TippligaSQLConnector getInstance() {
|
||||
if (tlwSqlCon == null) {
|
||||
tlwSqlCon = new TippligaSQLConnector();
|
||||
}
|
||||
return tlwSqlCon;
|
||||
}
|
||||
|
||||
public ArrayList<TLWTeam> getTeams(String season, String league) {
|
||||
String queryString = "SELECT * FROM `phpbb_footb_teams` WHERE `season` = " + season + " AND `league` = " + league + ";";
|
||||
|
||||
ArrayList<TLWTeam> teams = new ArrayList<>();
|
||||
ResultSet rset = executeQuery(queryString);
|
||||
try {
|
||||
while (rset.next()) {
|
||||
teams.add(new TLWTeam(rset));
|
||||
}
|
||||
} catch (SQLException throwables) {
|
||||
throwables.printStackTrace();
|
||||
}
|
||||
|
||||
return teams;
|
||||
}
|
||||
|
||||
public ArrayList<TLWTeam> getTeams(String id) {
|
||||
String queryString = "SELECT * FROM `phpbb_footb_teams` WHERE `team_id` = " + id + " ORDER BY `season` DESC, `league` ASC;";
|
||||
|
||||
ArrayList<TLWTeam> teams = new ArrayList<>();
|
||||
ResultSet rset = executeQuery(queryString);
|
||||
try {
|
||||
while (rset.next()) {
|
||||
teams.add(new TLWTeam(rset));
|
||||
}
|
||||
} catch (SQLException throwables) {
|
||||
throwables.printStackTrace();
|
||||
}
|
||||
|
||||
return teams;
|
||||
}
|
||||
|
||||
private ArrayList<TLWMatch> getMatches(String queryString) {
|
||||
|
||||
ArrayList<TLWMatch> matches = new ArrayList<>();
|
||||
ResultSet rset = executeQuery(queryString);
|
||||
try {
|
||||
while (rset.next()) {
|
||||
matches.add(new TLWMatch(rset));
|
||||
}
|
||||
} catch (SQLException throwables) {
|
||||
throwables.printStackTrace();
|
||||
}
|
||||
return matches;
|
||||
}
|
||||
|
||||
public ArrayList<TLWMatch> getMatches(String season, String league) {
|
||||
String queryString = "SELECT * FROM `phpbb_footb_matches` WHERE `season` = " + season + " AND `league` = " + league + " ORDER BY match_no ASC;";
|
||||
return getMatches(queryString);
|
||||
}
|
||||
|
||||
public ArrayList<TLWMatch> getMatches(String season, String league, String matchday) {
|
||||
String queryString = "SELECT * FROM `phpbb_footb_matches` WHERE `season` = " + season + " AND `league` = " + league + " AND `matchday` = " + matchday + " ORDER BY match_no ASC;";
|
||||
return getMatches(queryString);
|
||||
}
|
||||
|
||||
public ArrayList<TLWMatchday> getMatchdays(String season, String league) {
|
||||
String queryString = "SELECT * FROM `phpbb_footb_matchdays` WHERE `season` = " + season + " AND `league` = " + league + ";";
|
||||
|
||||
ArrayList<TLWMatchday> matchdays = new ArrayList<>();
|
||||
ResultSet rset = executeQuery(queryString);
|
||||
try {
|
||||
while (rset.next()) {
|
||||
matchdays.add(new TLWMatchday(rset));
|
||||
}
|
||||
} catch (SQLException throwables) {
|
||||
throwables.printStackTrace();
|
||||
}
|
||||
return matchdays;
|
||||
}
|
||||
|
||||
public TLWLeague getLeague(String season, String league) {
|
||||
String queryString = "SELECT * FROM `phpbb_footb_leagues` WHERE `season` = " + season + " AND `league` = " + league + ";";
|
||||
ResultSet rset = executeQuery(queryString);
|
||||
TLWLeague tlwLeague = null;
|
||||
try {
|
||||
while (rset.next()) {
|
||||
tlwLeague = new TLWLeague(rset);
|
||||
}
|
||||
} catch (SQLException throwables) {
|
||||
throwables.printStackTrace();
|
||||
}
|
||||
return tlwLeague;
|
||||
}
|
||||
|
||||
public ArrayList<TLWMatchday> getUpdatedMatchdaysBasedOnMatches(String season, String league) {
|
||||
String queryString = """
|
||||
SELECT
|
||||
d1.season,
|
||||
d1.league,
|
||||
d1.matchday,
|
||||
d1.status,
|
||||
d1.delivery_date,
|
||||
min(STR_TO_DATE(d2.match_datetime, '%Y-%m-%d %H:%i:%s')) as delivery_date_2,
|
||||
min(STR_TO_DATE(d3.match_datetime, '%Y-%m-%d %H:%i:%s')) as delivery_date_3,
|
||||
d1.matchday_name,
|
||||
d1.matches
|
||||
FROM (
|
||||
SELECT
|
||||
md.season,
|
||||
md.league,
|
||||
md.matchday,
|
||||
md.status,
|
||||
min(STR_TO_DATE(ma.match_datetime, '%Y-%m-%d %H:%i:%s')) AS delivery_date,
|
||||
md.matchday_name,
|
||||
md.matches
|
||||
FROM phpbb_footb_matchdays md
|
||||
LEFT JOIN phpbb_footb_matches ma ON (md.season = ma.season AND md.league = ma.league AND md.matchday = ma.matchday)
|
||||
WHERE md.season =""" + " " + season + " " + """
|
||||
AND md.league =""" + " " + league + " " + """
|
||||
GROUP BY md.season, md.league, md.matchday
|
||||
) AS d1
|
||||
LEFT JOIN phpbb_footb_matches d2 ON (d1.season = d2.season AND d1.league = d2.league AND d1.matchday = d2.matchday
|
||||
AND DATEDIFF(DATE(STR_TO_DATE(d2.match_datetime, '%Y-%m-%d %H:%i:%s')), DATE(d1.delivery_date)) > 0)
|
||||
LEFT JOIN phpbb_footb_matches d3 ON (d1.season = d3.season AND d1.league = d3.league AND d1.matchday = d3.matchday
|
||||
AND DATEDIFF(DATE(STR_TO_DATE(d3.match_datetime, '%Y-%m-%d %H:%i:%s')), DATE(d1.delivery_date)) > 6)
|
||||
GROUP BY d1.season, d1.league, d1.matchday;
|
||||
""";
|
||||
|
||||
ArrayList<TLWMatchday> matchdays = new ArrayList<>();
|
||||
ResultSet rset = executeQuery(queryString);
|
||||
try {
|
||||
while (rset.next()) {
|
||||
matchdays.add(new TLWMatchday(rset));
|
||||
}
|
||||
} catch (SQLException throwables) {
|
||||
throwables.printStackTrace();
|
||||
}
|
||||
return matchdays;
|
||||
}
|
||||
|
||||
public Integer getForumId(String forumName, int parentId) {
|
||||
String queryString = "SELECT forum_id FROM phpbb_forums WHERE forum_name = \"" + forumName + "\" AND parent_id = " + parentId + ";";
|
||||
ResultSet rset = executeQuery(queryString);
|
||||
Integer id = null;
|
||||
try {
|
||||
while (rset.next()) {
|
||||
id = Integer.parseInt(rset.getString(1));
|
||||
}
|
||||
} catch (SQLException throwables) {
|
||||
throwables.printStackTrace();
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
public Integer getForumId(String forumName) {
|
||||
String queryString = "SELECT forum_id FROM phpbb_forums WHERE forum_name = \"" + forumName + "\";";
|
||||
ResultSet rset = executeQuery(queryString);
|
||||
Integer id = null;
|
||||
try {
|
||||
while (rset.next()) {
|
||||
id = Integer.parseInt(rset.getString(1));
|
||||
}
|
||||
} catch (SQLException throwables) {
|
||||
throwables.printStackTrace();
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getPost(String subject, int forum_id) {
|
||||
String queryString = "SELECT post_text FROM phpbb_posts WHERE post_subject = \"" + subject + "\" AND forum_id = \"" + forum_id + "\";";
|
||||
ResultSet rset = executeQuery(queryString);
|
||||
String post = null;
|
||||
try {
|
||||
while (rset.next()) {
|
||||
post = rset.getString(1);
|
||||
}
|
||||
} catch (SQLException throwables) {
|
||||
throwables.printStackTrace();
|
||||
}
|
||||
return post;
|
||||
}
|
||||
|
||||
public ResultSet executeQuery(String queryString) {
|
||||
Statement stmt;
|
||||
ResultSet rset = null;
|
||||
try {
|
||||
stmt = con.createStatement();
|
||||
rset = stmt.executeQuery(queryString);
|
||||
} catch (SQLException e) {
|
||||
logger.error(e.getMessage());
|
||||
}
|
||||
return rset;
|
||||
}
|
||||
|
||||
public void executeUpdate(String queryString) {
|
||||
Statement stmt;
|
||||
try {
|
||||
stmt = con.createStatement();
|
||||
stmt.executeUpdate(queryString);
|
||||
} catch (SQLException e) {
|
||||
logger.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void updatePost(int postId, String postText) {
|
||||
String postChecksum = getChecksum(postText);
|
||||
final long postEditTime = Instant.now().getEpochSecond();
|
||||
final String postEditReason = "Update by tool.";
|
||||
int postEditUser = 2;
|
||||
String query = getPostUpdateQuery(postId, postText, postChecksum, postEditTime, postEditReason, postEditUser);
|
||||
executeUpdate(query);
|
||||
}
|
||||
|
||||
public String getChecksumOfPost(int forum_id, String subject) {
|
||||
String queryString = "SELECT post_checksum FROM phpbb_posts WHERE forum_id = " + forum_id + " AND post_subject = '" + subject + "'";
|
||||
ResultSet rset = executeQuery(queryString);
|
||||
String checksum = null;
|
||||
try {
|
||||
while (rset.next()) {
|
||||
checksum = rset.getString(1);
|
||||
}
|
||||
} catch (SQLException throwables) {
|
||||
throwables.printStackTrace();
|
||||
}
|
||||
return checksum;
|
||||
}
|
||||
|
||||
public String getPostUpdateQuery(int postId, String postText, String postChecksum, long postEditTime, String postEditReason, int postEditUser) {
|
||||
return "UPDATE phpbb_posts SET " +
|
||||
"post_text = '" + postText + "', " +
|
||||
"post_checksum = '" + postChecksum + "', " +
|
||||
"post_edit_time = " + postEditTime + ", " +
|
||||
"post_edit_reason = '" + postEditReason + "', " +
|
||||
"post_edit_user = " + postEditUser + ", " +
|
||||
"post_edit_count = post_edit_count + 1 " +
|
||||
"WHERE post_id = " + postId + ";";
|
||||
}
|
||||
|
||||
public String getChecksum(String postText) {
|
||||
String postTextForMd5 = replaceXmlMetacharacters(postText);
|
||||
MessageDigest md = null;
|
||||
try {
|
||||
md = MessageDigest.getInstance("MD5");
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
assert md != null;
|
||||
md.update(postTextForMd5.getBytes());
|
||||
byte[] digest = md.digest();
|
||||
return DatatypeConverter.printHexBinary(digest).toLowerCase();
|
||||
}
|
||||
|
||||
public String replaceXmlMetacharacters(String post) {
|
||||
post = post.replace("&", "&");
|
||||
post = post.replace("<", "<");
|
||||
post = post.replace(">", ">");
|
||||
post = post.replace("\"", """);
|
||||
post = post.replace("'", "'");
|
||||
return post;
|
||||
}
|
||||
|
||||
public String getNextMailReminder(int hours) {
|
||||
String query = """
|
||||
WITH next_delivery_date AS (
|
||||
SELECT
|
||||
m.season,
|
||||
m.league,
|
||||
l.league_name,
|
||||
l.bet_type,
|
||||
m.matchday,
|
||||
m.matchday_name,
|
||||
delivery_date,
|
||||
STR_TO_DATE(delivery_date, '%Y-%m-%d %H:%i:%s') as parsed_delivery_date
|
||||
FROM phpbb_footb_matchdays m
|
||||
LEFT JOIN phpbb_footb_leagues l ON (m.season = l.season AND m.league = l.league)
|
||||
HAVING parsed_delivery_date > NOW() AND parsed_delivery_date < NOW() + INTERVAL {{remainingHours}} HOUR
|
||||
)
|
||||
""".replace("{{remainingHours}}", "" + hours);
|
||||
ResultSet rset = executeQuery(query);
|
||||
String reminder = null;
|
||||
try {
|
||||
if (rset.next()) {
|
||||
reminder = "Reminder for user: " + rset.getString("username") + " for matchday: " + rset.getString("matchday");
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return reminder;
|
||||
}
|
||||
|
||||
public ArrayList<WhatsAppReminder> getNextWhatsAppReminders(int hours) {
|
||||
final String remindersToSendQuery = """
|
||||
WITH delivery_date_next_day AS (
|
||||
SELECT
|
||||
m.season,
|
||||
m.league,
|
||||
l.league_name,
|
||||
l.bet_type,
|
||||
m.matchday,
|
||||
m.matchday_name,
|
||||
delivery_date,
|
||||
STR_TO_DATE(delivery_date, '%Y-%m-%d %H:%i:%s') as parsed_delivery_date
|
||||
FROM phpbb_footb_matchdays m
|
||||
LEFT JOIN phpbb_footb_leagues l ON (m.season = l.season AND m.league = l.league)
|
||||
HAVING parsed_delivery_date > NOW() AND parsed_delivery_date < NOW() + INTERVAL {{remainingHours}} HOUR
|
||||
)
|
||||
SELECT
|
||||
d.season,
|
||||
d.league,
|
||||
d.league_name,
|
||||
d.matchday,
|
||||
IF(d.matchday_name = '', CONCAT(d.matchday, '. Spieltag'), d.matchday_name) AS matchday_name,
|
||||
d.delivery_date,
|
||||
CASE
|
||||
WHEN DATE (d.parsed_delivery_date) = CURDATE() THEN 'heute'
|
||||
WHEN DATE (d.parsed_delivery_date) = CURDATE() + INTERVAL 1 DAY THEN 'morgen'
|
||||
ELSE DATE (d.parsed_delivery_date)
|
||||
END AS today_or_tomorrow,
|
||||
TIME_FORMAT(TIME(d.parsed_delivery_date), '%H:%i') AS time,
|
||||
'{{remainingHours}}' AS remaining_hours,
|
||||
b.user_id,
|
||||
u.username,
|
||||
CASE
|
||||
WHEN SUBSTR(pf.pf_handynummer, 1, 2) = '00' THEN pf.pf_handynummer
|
||||
WHEN SUBSTR(pf.pf_handynummer, 1, 1) = '+' THEN CONCAT('00', SUBSTR(pf.pf_handynummer, 2))
|
||||
WHEN SUBSTR(pf.pf_handynummer, 1, 2) = '01' THEN CONCAT('0049', SUBSTR(pf.pf_handynummer, 2))
|
||||
ELSE ''
|
||||
END AS pf_handynummer,
|
||||
count(*) AS missing_bets
|
||||
FROM delivery_date_next_day d
|
||||
LEFT JOIN phpbb_footb_matches m
|
||||
ON (d.season = m.season
|
||||
AND d.league = m.league
|
||||
AND d.matchday = m.matchday)
|
||||
LEFT JOIN phpbb_footb_bets b
|
||||
ON (m.season = b.season
|
||||
AND m.league = b.league
|
||||
AND m.match_no = b.match_no)
|
||||
LEFT JOIN phpbb_footb_matches mb
|
||||
ON (d.season = mb.season
|
||||
AND d.league = mb.league - 50
|
||||
AND d.matchday = mb.matchday
|
||||
AND (b.user_id + 2000 = mb.team_id_home OR b.user_id + 2000 = mb.team_id_guest))
|
||||
LEFT JOIN phpbb_footb_whatsapp_reminders r
|
||||
ON (m.season = r.season
|
||||
AND m.league = r.league
|
||||
AND m.matchday = r.matchday
|
||||
AND r.delivery_date = d.delivery_date
|
||||
AND b.user_id = r.user_id
|
||||
AND r.remaining_hours = {{remainingHours}})
|
||||
LEFT JOIN phpbb_users u
|
||||
ON (b.user_id = u.user_id)
|
||||
LEFT JOIN phpbb_footb_whatsapp_reminder_users wu
|
||||
ON (u.username = wu.username)
|
||||
LEFT JOIN phpbb_profile_fields_data pf
|
||||
ON (u.user_id = pf.user_id)
|
||||
WHERE ((d.bet_type = 0 AND mb.match_no IS NOT NULL) OR d.bet_type = 1)
|
||||
AND (b.goals_home = '' OR b.goals_guest = '')
|
||||
AND r.timestamp IS NULL
|
||||
AND m.status = 0
|
||||
AND wu.username IS NOT NULL
|
||||
AND pf.pf_handynummer != ''
|
||||
GROUP BY d.league_name, d.matchday, u.username, pf.pf_handynummer;
|
||||
""".replace("{{remainingHours}}", "" + hours);
|
||||
final int SEASON = 1;
|
||||
final int LEAGUE = 2;
|
||||
final int LEAGUE_NAME = 3;
|
||||
final int MATCHDAY = 4;
|
||||
final int MATCHDAY_NAME = 5;
|
||||
final int DELIVERY_DATE = 6;
|
||||
final int TODAY_OR_TOMORROW = 7;
|
||||
final int TIME = 8;
|
||||
final int HOURS = 9;
|
||||
final int USER_ID = 10;
|
||||
final int USERNAME = 11;
|
||||
final int PHONE_NUMBER = 12;
|
||||
final int MISSING_BETS = 13;
|
||||
try {
|
||||
ResultSet rset = executeQuery(remindersToSendQuery);
|
||||
ArrayList <WhatsAppReminder> reminders = new ArrayList<>();
|
||||
while (rset.next()) {
|
||||
reminders.add(
|
||||
new WhatsAppReminder(
|
||||
Integer.parseInt(rset.getString(SEASON)),
|
||||
Integer.parseInt(rset.getString(LEAGUE)),
|
||||
rset.getString(LEAGUE_NAME),
|
||||
Integer.parseInt(rset.getString(MATCHDAY)),
|
||||
rset.getString(MATCHDAY_NAME),
|
||||
rset.getString(DELIVERY_DATE),
|
||||
rset.getString(TODAY_OR_TOMORROW),
|
||||
rset.getString(TIME),
|
||||
Integer.parseInt(rset.getString(HOURS)),
|
||||
Integer.parseInt(rset.getString(USER_ID)),
|
||||
rset.getString(USERNAME),
|
||||
rset.getString(PHONE_NUMBER),
|
||||
Integer.parseInt(rset.getString(MISSING_BETS))
|
||||
)
|
||||
);
|
||||
}
|
||||
return reminders;
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
public void markWhatsAppReminderAsSent(WhatsAppReminder reminder) {
|
||||
String query = """
|
||||
INSERT INTO phpbb_footb_whatsapp_reminders
|
||||
(season, league, matchday, delivery_date, user_id, remaining_hours)
|
||||
VALUES
|
||||
(""" + reminder.season() + ", " + reminder.league() + ", " + reminder.matchday() + ", '" + reminder.deliveryDate() + "', " + reminder.userId() + ", " + reminder.remainingHours() + ");";
|
||||
executeUpdate(query);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,289 @@
|
||||
package de.jeyp91.tippligaforum;
|
||||
|
||||
import de.jeyp91.tippliga.TLWMatch;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.*;
|
||||
import java.net.http.HttpClient;
|
||||
import java.net.http.HttpRequest;
|
||||
import java.net.http.HttpResponse;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.Duration;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class TippligaWebsiteConnector {
|
||||
CookieManager cm = new CookieManager(null, CookiePolicy.ACCEPT_ALL);
|
||||
|
||||
CookieStore cookieStore = cm.getCookieStore();
|
||||
private static final Logger logger = LoggerFactory.getLogger(TippligaWebsiteConnector.class);
|
||||
private final HttpClient client;
|
||||
private final String username = System.getenv("FORUM_USERNAME");
|
||||
private final String password = System.getenv("FORUM_PASSWORD");
|
||||
private String lastCreationTime = "";
|
||||
private String lastFormToken = "";
|
||||
|
||||
public TippligaWebsiteConnector() throws IOException {
|
||||
CookieHandler.setDefault(cm);
|
||||
|
||||
client = HttpClient.newBuilder()
|
||||
.cookieHandler(CookieHandler.getDefault())
|
||||
.connectTimeout(Duration.ofSeconds(10))
|
||||
.build();
|
||||
login();
|
||||
adminLogin();
|
||||
}
|
||||
|
||||
private void login() throws IOException {
|
||||
HttpRequest req = HttpRequest.newBuilder()
|
||||
.uri(URI.create("https://tippliga-wuerzburg.de/ucp.php?mode=login"))
|
||||
.GET().build();
|
||||
|
||||
String reqBody = "";
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(1);
|
||||
reqBody = client.send(req, HttpResponse.BodyHandlers.ofString()).body();
|
||||
} catch (IOException | InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Pattern pattern = Pattern.compile("^[\\s\\S]*<input type=\"hidden\" name=\"creation_time\" value=\"([\\d]{10})\" \\/>[\\s\\S]*<input type=\"hidden\" name=\"form_token\" value=\"([\\d\\w]{40})\" \\/>[\\s\\S]*<input type=\"hidden\" name=\"sid\" value=\"([\\d\\w]{32})\" \\/>[\\s\\S]*$");
|
||||
Matcher matcher = pattern.matcher(reqBody);
|
||||
matcher.find();
|
||||
|
||||
this.lastCreationTime = matcher.group(1);
|
||||
this.lastFormToken = matcher.group(2);
|
||||
String sid = matcher.group(3);
|
||||
|
||||
Map<String, String> loginParameters = new HashMap<>();
|
||||
loginParameters.put("login", "Anmelden");
|
||||
loginParameters.put("redirect", "index.php");
|
||||
loginParameters.put("autologin", "on");
|
||||
loginParameters.put("viewonline", "on");
|
||||
loginParameters.put("username", username);
|
||||
loginParameters.put("password", password);
|
||||
loginParameters.put("creation_time", this.lastCreationTime);
|
||||
loginParameters.put("form_token", this.lastFormToken);
|
||||
loginParameters.put("sid", sid);
|
||||
|
||||
String loginForm = loginParameters.entrySet()
|
||||
.stream()
|
||||
.map(e -> e.getKey() + "=" + URLEncoder.encode(e.getValue(), StandardCharsets.UTF_8))
|
||||
.collect(Collectors.joining("&"));
|
||||
|
||||
HttpRequest loginReq = HttpRequest.newBuilder()
|
||||
.uri(URI.create("https://tippliga-wuerzburg.de/ucp.php?mode=login"))
|
||||
.headers("Content-Type", "application/x-www-form-urlencoded")
|
||||
.POST(HttpRequest.BodyPublishers.ofString(loginForm))
|
||||
.build();
|
||||
|
||||
String loginReqBody = "";
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(1);
|
||||
loginReqBody = client.send(loginReq, HttpResponse.BodyHandlers.ofString()).body();
|
||||
} catch (IOException | InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
List<HttpCookie> loginReqCookieList = cookieStore.getCookies();
|
||||
}
|
||||
|
||||
private void adminLogin() throws IOException {
|
||||
String sid = getSidFromCookie();
|
||||
String url = "https://tippliga-wuerzburg.de/adm/index.php?sid=" + sid;
|
||||
HttpRequest req = HttpRequest.newBuilder()
|
||||
.uri(URI.create(url))
|
||||
.headers("referer", "https://tippliga-wuerzburg.de/index.php?sid=" + sid)
|
||||
.GET().build();
|
||||
|
||||
String reqBody = "";
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(1);
|
||||
reqBody = client.send(req, HttpResponse.BodyHandlers.ofString()).body();
|
||||
} catch (IOException | InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Pattern pattern = Pattern.compile("^[\\s\\S]*<input type=\"hidden\" name=\"creation_time\" value=\"([\\d]{10})\" \\/>[\\s\\S]*<input type=\"hidden\" name=\"form_token\" value=\"([\\d\\w]{40})\" \\/>[\\s\\S]*<input type=\"hidden\" name=\"sid\" value=\"([\\d\\w]{32})\" \\/>[\\s\\S]*<input type=\"hidden\" name=\"credential\" value=\"([\\d\\w]{32})\" \\/>[\\s\\S]*$");
|
||||
Matcher matcher = pattern.matcher(reqBody);
|
||||
matcher.find();
|
||||
|
||||
this.lastCreationTime = matcher.group(1);
|
||||
this.lastFormToken = matcher.group(2);
|
||||
sid = matcher.group(3);
|
||||
String credential = matcher.group(4);
|
||||
|
||||
Map<String, String> loginParameters = new HashMap<>();
|
||||
loginParameters.put("login", "Anmelden");
|
||||
loginParameters.put("redirect", "./../adm/index.php?sid=" + sid);
|
||||
loginParameters.put("username", username);
|
||||
loginParameters.put("password_" + credential, password);
|
||||
loginParameters.put("creation_time", this.lastCreationTime);
|
||||
loginParameters.put("form_token", this.lastFormToken);
|
||||
loginParameters.put("sid", sid);
|
||||
loginParameters.put("credential", credential);
|
||||
|
||||
String loginForm = loginParameters.entrySet()
|
||||
.stream()
|
||||
.map(e -> e.getKey() + "=" + URLEncoder.encode(e.getValue(), StandardCharsets.UTF_8))
|
||||
.collect(Collectors.joining("&"));
|
||||
|
||||
HttpRequest loginReq = HttpRequest.newBuilder()
|
||||
.uri(URI.create(url))
|
||||
.headers("Content-Type", "application/x-www-form-urlencoded")
|
||||
.POST(HttpRequest.BodyPublishers.ofString(loginForm))
|
||||
.build();
|
||||
|
||||
String loginReqBody = "";
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(1);
|
||||
HttpResponse<String> loginReqResponse = client.send(loginReq, HttpResponse.BodyHandlers.ofString()); // Response 302
|
||||
|
||||
} catch (IOException | InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
List<HttpCookie> loginReqCookieList = cookieStore.getCookies();
|
||||
}
|
||||
|
||||
public void updateResultsAdmin(int season, int league, int matchday, List<TLWMatch> matches) {
|
||||
String sid = getSidFromCookie();
|
||||
String url = "https://tippliga-wuerzburg.de/adm/index.php?i=-football-football-acp-results_module&mode=manage&sid=" + sid;
|
||||
|
||||
HttpRequest req = HttpRequest.newBuilder()
|
||||
.uri(URI.create(url))
|
||||
.GET().build();
|
||||
|
||||
String reqBody = "";
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(1);
|
||||
reqBody = client.send(req, HttpResponse.BodyHandlers.ofString()).body();
|
||||
} catch (IOException | InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Pattern pattern = Pattern.compile("^[\\s\\S]*<input type=\"hidden\" name=\"creation_time\" value=\"([\\d]{10})\" \\/>[\\s\\S]*<input type=\"hidden\" name=\"form_token\" value=\"([\\d\\w]{40})\" \\/>[\\s\\S]*$");
|
||||
Matcher matcher = pattern.matcher(reqBody);
|
||||
matcher.find();
|
||||
|
||||
this.lastCreationTime = matcher.group(1);
|
||||
this.lastFormToken = matcher.group(2);
|
||||
|
||||
Map<String, String> resultParameters = new HashMap<>();
|
||||
|
||||
resultParameters.put("s", String.valueOf(season));
|
||||
resultParameters.put("l", String.valueOf(league));
|
||||
resultParameters.put("m", String.valueOf(matchday));
|
||||
resultParameters.put("edit", "Speichern");
|
||||
resultParameters.put("creation_time", this.lastCreationTime);
|
||||
resultParameters.put("form_token", this.lastFormToken);
|
||||
matches.forEach(tlwMatch -> {
|
||||
String matchNo = String.valueOf(tlwMatch.getMatchNo());
|
||||
resultParameters.put("select_" + matchNo, "on");
|
||||
resultParameters.put("goals_home_" + matchNo, String.valueOf(tlwMatch.getGoalsHome()));
|
||||
resultParameters.put("goals_guest_" + matchNo, String.valueOf(tlwMatch.getGoalsGuest()));
|
||||
Integer goalsOverTimeHome = tlwMatch.getGoalsOvertimeHome();
|
||||
Integer goalsOvertimeGuest = tlwMatch.getGoalsOvertimeGuest();
|
||||
resultParameters.put("overtime_home_" + matchNo, goalsOverTimeHome == null ? "" : String.valueOf(goalsOverTimeHome));
|
||||
resultParameters.put("overtime_guest_" + matchNo, goalsOvertimeGuest == null ? "" : String.valueOf(goalsOvertimeGuest));
|
||||
});
|
||||
|
||||
String resultForm = resultParameters.entrySet()
|
||||
.stream()
|
||||
.map(e -> e.getKey() + "=" + URLEncoder.encode(e.getValue(), StandardCharsets.UTF_8))
|
||||
.collect(Collectors.joining("&"));
|
||||
|
||||
HttpRequest resultReq = HttpRequest.newBuilder()
|
||||
.uri(URI.create("https://tippliga-wuerzburg.de/adm/index.php?i=-football-football-acp-results_module&mode=manage&sid=" + sid))
|
||||
.headers("Content-Type", "application/x-www-form-urlencoded")
|
||||
.POST(HttpRequest.BodyPublishers.ofString(resultForm))
|
||||
.build();
|
||||
|
||||
String resultReqBody = "";
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(1);
|
||||
resultReqBody = client.send(resultReq, HttpResponse.BodyHandlers.ofString()).body();
|
||||
} catch (IOException | InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
matcher = pattern.matcher(resultReqBody);
|
||||
matcher.find();
|
||||
|
||||
this.lastCreationTime = matcher.group(1);
|
||||
this.lastFormToken = matcher.group(2);
|
||||
}
|
||||
|
||||
public boolean createPost(int forumId, String subject, String message) {
|
||||
String url = "https://tippliga-wuerzburg.de/posting.php?mode=post&f=" + forumId;
|
||||
|
||||
HttpRequest req = HttpRequest.newBuilder()
|
||||
.uri(URI.create(url))
|
||||
.GET().build();
|
||||
|
||||
String reqBody = "";
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(1);
|
||||
reqBody = client.send(req, HttpResponse.BodyHandlers.ofString()).body();
|
||||
} catch (IOException | InterruptedException e) {
|
||||
logger.error("Failed to fetch posting form", e);
|
||||
return false;
|
||||
}
|
||||
|
||||
Pattern pattern = Pattern.compile("^[\\s\\S]*<input type=\"hidden\" name=\"creation_time\" value=\"([\\d]{10})\" \\/>[\\s\\S]*<input type=\"hidden\" name=\"form_token\" value=\"([\\d\\w]{40})\" \\/>[\\s\\S]*$");
|
||||
Matcher matcher = pattern.matcher(reqBody);
|
||||
if (!matcher.find()) {
|
||||
logger.error("Could not find CSRF tokens in posting form for forum " + forumId);
|
||||
return false;
|
||||
}
|
||||
|
||||
String creationTime = matcher.group(1);
|
||||
String formToken = matcher.group(2);
|
||||
|
||||
Map<String, String> postParameters = new HashMap<>();
|
||||
postParameters.put("subject", subject);
|
||||
postParameters.put("message", message);
|
||||
postParameters.put("creation_time", creationTime);
|
||||
postParameters.put("form_token", formToken);
|
||||
postParameters.put("post", "Absenden");
|
||||
postParameters.put("attach_sig", "1");
|
||||
postParameters.put("enable_bbcode", "1");
|
||||
postParameters.put("enable_smilies", "1");
|
||||
postParameters.put("enable_magic_url", "1");
|
||||
|
||||
String postForm = postParameters.entrySet()
|
||||
.stream()
|
||||
.map(e -> e.getKey() + "=" + URLEncoder.encode(e.getValue(), StandardCharsets.UTF_8))
|
||||
.collect(Collectors.joining("&"));
|
||||
|
||||
HttpRequest postReq = HttpRequest.newBuilder()
|
||||
.uri(URI.create(url))
|
||||
.headers("Content-Type", "application/x-www-form-urlencoded")
|
||||
.POST(HttpRequest.BodyPublishers.ofString(postForm))
|
||||
.build();
|
||||
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(1);
|
||||
HttpResponse<String> response = client.send(postReq, HttpResponse.BodyHandlers.ofString());
|
||||
if (response.statusCode() == 302) {
|
||||
logger.info("Created post '" + subject + "' in forum " + forumId);
|
||||
return true;
|
||||
}
|
||||
logger.error("Failed to create post '" + subject + "' in forum " + forumId + ". Status: " + response.statusCode());
|
||||
return false;
|
||||
} catch (IOException | InterruptedException e) {
|
||||
logger.error("Failed to create post", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private String getSidFromCookie() {
|
||||
HttpCookie sidCookie = cookieStore.getCookies().get(2);
|
||||
String sid = sidCookie.getValue();
|
||||
return sid;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package de.jeyp91.whatsapp;
|
||||
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.http.HttpClient;
|
||||
import java.net.http.HttpRequest;
|
||||
import java.net.http.HttpResponse;
|
||||
import java.util.HashMap;
|
||||
|
||||
import static de.jeyp91.apifootball.APIFootballConnector.stringToJSONObject;
|
||||
|
||||
public class OpenAIConnector {
|
||||
private final HttpClient client;
|
||||
private final String OPENAI_TOKEN = System.getenv("OPENAI_TOKEN");
|
||||
private final String OPENAPI_URL = "https://api.openai.com/v1/chat/completions";
|
||||
private final String OPENAPI_MODEL = "gpt-3.5-turbo-0125";
|
||||
private final HashMap<String, String> generatedMessages = new HashMap<>();
|
||||
|
||||
public OpenAIConnector() {
|
||||
client = HttpClient.newBuilder().build();
|
||||
}
|
||||
|
||||
public String getReminderMessage(WhatsAppReminder reminder) {
|
||||
String key = reminder.leagueName() + reminder.matchdayName() + reminder.todayTomorrow() + reminder.time();
|
||||
String message;
|
||||
if (generatedMessages.containsKey(key)) {
|
||||
message = generatedMessages.get(key);
|
||||
} else {
|
||||
message = executeReminderPrompt(reminder.leagueName(), reminder.matchdayName(), reminder.todayTomorrow(), reminder.time(), reminder.remainingHours());
|
||||
generatedMessages.put(key, message);
|
||||
}
|
||||
message = message.replace("Hey", "Hey " + reminder.username());
|
||||
String end = "\nDu kannst deine Tipps wie immer unter https://tippliga-wuerzburg.de/app.php/football/bet abgeben.\nViele Grüße\nDie Tippliga Admins";
|
||||
message += end;
|
||||
return message;
|
||||
}
|
||||
|
||||
private String executeReminderPrompt(String leagueName, String matchdayName, String deliveryDay, String time, int remainingHours) {
|
||||
String systemPrompt = "Generiere eine Nachricht, die dem Zweck dient, jemanden daran zu erinnern, seine noch fehlenden Tipps für den kommenden Spieltag abzuschicken. Die Nachricht muss so klingen, als ob ein Freund sie in natürlicher Sprache abschickt. Sie muss auf Deutsch sein. Die Nachricht muss den richtigen Singular und Plural für die Anzahl der fehlenden Wetten verwenden. Halte dich genau an die Vorlage und ersetze die Teile gekennzeichnet durch \"{}\" durch passende Passagen. Die Antwort auf diesen Prompt soll ausschließlich die Nachricht sein.\n\n "
|
||||
+"Dies ist die Vorlage:\n"
|
||||
+"Hey,\n"
|
||||
+ (remainingHours == 24 ? "{ein netter einleitender Satz der \"league_name\", \"matchday_name\" enthält}.\n" : "{ein einleitender Satz der \"league_name\", \"matchday_name\" enthält und klar macht, dass die Zeit abläuft und nur noch weniger als zwei Stunden Zeit für die Abgabe der Tipps bleibt}.\n")
|
||||
+"Bitte gib die fehlenden Tipps bis {delivery_day} um {time} ab.";
|
||||
JSONObject userInput = new JSONObject();
|
||||
userInput.put("league_name", leagueName);
|
||||
userInput.put("matchday_name", matchdayName);
|
||||
userInput.put("delivery_day", deliveryDay);
|
||||
userInput.put("time", time);
|
||||
String user = userInput.toJSONString();
|
||||
JSONObject jsonBody = new JSONObject();
|
||||
jsonBody.put("model", OPENAPI_MODEL);
|
||||
JSONArray messages = new JSONArray();
|
||||
JSONObject system = new JSONObject();
|
||||
system.put("role", "system");
|
||||
system.put("content", systemPrompt);
|
||||
messages.add(system);
|
||||
JSONObject userMessage = new JSONObject();
|
||||
userMessage.put("role", "user");
|
||||
userMessage.put("content", user);
|
||||
messages.add(userMessage);
|
||||
jsonBody.put("messages", messages);
|
||||
HttpRequest openAIRequest = HttpRequest.newBuilder()
|
||||
.uri(URI.create(OPENAPI_URL))
|
||||
.headers("Content-Type", "application/json")
|
||||
.headers("Authorization", "Bearer " + OPENAI_TOKEN)
|
||||
.POST(HttpRequest.BodyPublishers.ofString(jsonBody.toJSONString()))
|
||||
.build();
|
||||
JSONObject response = new JSONObject();
|
||||
try {
|
||||
response = stringToJSONObject(client.send(openAIRequest, HttpResponse.BodyHandlers.ofString()).body());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
JSONArray choices = (JSONArray) response.get("choices");
|
||||
JSONObject choice = (JSONObject) choices.get(0);
|
||||
JSONObject message = (JSONObject) choice.get("message");
|
||||
return message.get("content").toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package de.jeyp91.whatsapp;
|
||||
|
||||
import de.jeyp91.tippligaforum.TippligaSQLConnector;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.http.HttpClient;
|
||||
import java.net.http.HttpRequest;
|
||||
import java.net.http.HttpResponse;
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class WhatsAppNotifier {
|
||||
private final String host = System.getenv("TLW_WHATSAPP_HOST");
|
||||
private final String port = System.getenv("TLW_WHATSAPP_PORT");
|
||||
private final String apiKey = System.getenv("TLW_WHATSAPP_API_KEY");
|
||||
private static final Logger logger = LoggerFactory.getLogger(WhatsAppNotifier.class);
|
||||
private final HttpClient client;
|
||||
private final OpenAIConnector openAIConnector = new OpenAIConnector();
|
||||
|
||||
public WhatsAppNotifier() {
|
||||
client = HttpClient.newBuilder()
|
||||
.connectTimeout(Duration.ofSeconds(10))
|
||||
.build();
|
||||
}
|
||||
|
||||
public void sendNotifications() {
|
||||
ArrayList<WhatsAppReminder> reminders = TippligaSQLConnector.getInstance().getNextWhatsAppReminders(24);
|
||||
reminders.addAll(TippligaSQLConnector.getInstance().getNextWhatsAppReminders(2));
|
||||
reminders.forEach(reminder -> {
|
||||
boolean success = sendMessage(reminder);
|
||||
if (success) {
|
||||
markReminderAsSent(reminder);
|
||||
logger.info("WhatsApp Erinnerung an " + reminder.username() + " gesendet.");
|
||||
} else {
|
||||
logger.error("WhatsApp Nachricht senden an " + reminder.username() + " fehlgeschlagen.");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public boolean sendMessage(WhatsAppReminder reminder) {
|
||||
String message = openAIConnector.getReminderMessage(reminder);
|
||||
JSONObject body = new JSONObject();
|
||||
body.put("number", reminder.phoneNumber().substring(2));
|
||||
body.put("message", message);
|
||||
HttpRequest req = HttpRequest.newBuilder()
|
||||
.uri(URI.create(this.host + (this.port != null ? ":" + this.port : "") + "/send"))
|
||||
.headers("Content-Type", "application/json")
|
||||
.headers("x-api-key", apiKey)
|
||||
.POST(HttpRequest.BodyPublishers.ofString(body.toJSONString()))
|
||||
.build();
|
||||
boolean success = false;
|
||||
try {
|
||||
int responseCode = client.send(req, HttpResponse.BodyHandlers.ofString()).statusCode();
|
||||
if (responseCode != 200) {
|
||||
logger.error("Failed to send WhatsApp message. Response code: " + responseCode);
|
||||
} else {
|
||||
success = true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("Failed to send WhatsApp message: " + e.getMessage());
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
public void markReminderAsSent(WhatsAppReminder reminder) {
|
||||
TippligaSQLConnector.getInstance().markWhatsAppReminderAsSent(reminder);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package de.jeyp91.whatsapp;
|
||||
|
||||
public record WhatsAppReminder(int season,
|
||||
int league,
|
||||
String leagueName,
|
||||
int matchday,
|
||||
String matchdayName,
|
||||
String deliveryDate,
|
||||
String todayTomorrow,
|
||||
String time,
|
||||
int remainingHours,
|
||||
int userId,
|
||||
String username,
|
||||
String phoneNumber,
|
||||
int missingBets) {
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
[
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "Bundesliga 1",
|
||||
"league_id": 2755
|
||||
},
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "Bundesliga 2",
|
||||
"league_id": 2743
|
||||
},
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "Liga 3",
|
||||
"league_id": 2795
|
||||
},
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "Regionalliga - SudWest",
|
||||
"league_id": 2823
|
||||
},
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "Regionalliga - Bayern",
|
||||
"league_id": 1240
|
||||
},
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "DFB Pokal",
|
||||
"league_id": 2677
|
||||
},
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "U19 Bundesliga",
|
||||
"league_id": 2692
|
||||
},
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "Women Bundesliga",
|
||||
"league_id": 2681
|
||||
},
|
||||
{
|
||||
"country": "England",
|
||||
"name": "Premier League",
|
||||
"league_id": 2790
|
||||
},
|
||||
{
|
||||
"country": "Spain",
|
||||
"name": "Primera Division",
|
||||
"league_id": 2833
|
||||
},
|
||||
{
|
||||
"country": "Italy",
|
||||
"name": "Serie A",
|
||||
"league_id": 2857
|
||||
},
|
||||
{
|
||||
"country": "France",
|
||||
"name": "Ligue 1",
|
||||
"league_id": 2664
|
||||
},
|
||||
{
|
||||
"country": "World",
|
||||
"name": "UEFA Champions League",
|
||||
"league_id": 2771
|
||||
},
|
||||
{
|
||||
"country": "World",
|
||||
"name": "UEFA Europa League",
|
||||
"league_id": 2777
|
||||
},
|
||||
{
|
||||
"country": "World",
|
||||
"name": "Euro Championship",
|
||||
"league_id": 403
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,77 @@
|
||||
[
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "Bundesliga 1",
|
||||
"league_id": 3510
|
||||
},
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "Bundesliga 2",
|
||||
"league_id": 3509
|
||||
},
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "Liga 3",
|
||||
"league_id": 3520
|
||||
},
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "Regionalliga - SudWest",
|
||||
"league_id": 3582
|
||||
},
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "Regionalliga - Bayern",
|
||||
"league_id": 3584
|
||||
},
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "DFB Pokal",
|
||||
"league_id": 3532
|
||||
},
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "U19 Bundesliga",
|
||||
"league_id": 3555
|
||||
},
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "Women Bundesliga",
|
||||
"league_id": 3541
|
||||
},
|
||||
{
|
||||
"country": "England",
|
||||
"name": "Premier League",
|
||||
"league_id": 3456
|
||||
},
|
||||
{
|
||||
"country": "Spain",
|
||||
"name": "Primera Division",
|
||||
"league_id": 3513
|
||||
},
|
||||
{
|
||||
"country": "Italy",
|
||||
"name": "Serie A",
|
||||
"league_id": 3576
|
||||
},
|
||||
{
|
||||
"country": "France",
|
||||
"name": "Ligue 1",
|
||||
"league_id": 3506
|
||||
},
|
||||
{
|
||||
"country": "World",
|
||||
"name": "UEFA Champions League",
|
||||
"league_id": 3431
|
||||
},
|
||||
{
|
||||
"country": "World",
|
||||
"name": "UEFA Europa League",
|
||||
"league_id": 3632
|
||||
},
|
||||
{
|
||||
"country": "World",
|
||||
"name": "UEFA Europa Conference League",
|
||||
"league_id": 3490
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,97 @@
|
||||
[
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "Bundesliga 1",
|
||||
"league_id": 4346
|
||||
},
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "Bundesliga 2",
|
||||
"league_id": 4352
|
||||
},
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "Liga 3",
|
||||
"league_id": 4383
|
||||
},
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "Regionalliga - SudWest",
|
||||
"league_id": 4509
|
||||
},
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "Regionalliga - Bayern",
|
||||
"league_id": 4507
|
||||
},
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "DFB Pokal",
|
||||
"league_id": 4303
|
||||
},
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "U19 Bundesliga",
|
||||
"league_id": 4489
|
||||
},
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "Women Bundesliga",
|
||||
"league_id": 4428
|
||||
},
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "Super Cup",
|
||||
"league_id": 4293
|
||||
},
|
||||
{
|
||||
"country": "England",
|
||||
"name": "Premier League",
|
||||
"league_id": 4335
|
||||
},
|
||||
{
|
||||
"country": "Spain",
|
||||
"name": "La Liga",
|
||||
"league_id": 4378
|
||||
},
|
||||
{
|
||||
"country": "Italy",
|
||||
"name": "Serie A",
|
||||
"league_id": 4399
|
||||
},
|
||||
{
|
||||
"country": "France",
|
||||
"name": "Ligue 1",
|
||||
"league_id": 4347
|
||||
},
|
||||
{
|
||||
"country": "World",
|
||||
"name": "UEFA Champions League",
|
||||
"league_id": 4314
|
||||
},
|
||||
{
|
||||
"country": "World",
|
||||
"name": "UEFA Europa League",
|
||||
"league_id": 4584
|
||||
},
|
||||
{
|
||||
"country": "World",
|
||||
"name": "UEFA Europa Conference League",
|
||||
"league_id": 4331
|
||||
},
|
||||
{
|
||||
"country": "World",
|
||||
"name": "UEFA Super Cup",
|
||||
"league_id": 4306
|
||||
},
|
||||
{
|
||||
"country": "Turkey",
|
||||
"name": "Süper Lig",
|
||||
"league_id": 4418
|
||||
},
|
||||
{
|
||||
"country": "Netherlands",
|
||||
"name": "Eredivisie",
|
||||
"league_id": 4349
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,102 @@
|
||||
[
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "Bundesliga",
|
||||
"league_id": 5348
|
||||
},
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "2. Bundesliga",
|
||||
"league_id": 5347
|
||||
},
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "3. Liga",
|
||||
"league_id": 5399
|
||||
},
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "Regionalliga - Bayern",
|
||||
"league_id": 5518
|
||||
},
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "Regionalliga - SudWest",
|
||||
"league_id": 5519
|
||||
},
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "U19 Bundesliga",
|
||||
"league_id": 5436
|
||||
},
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "Frauen Bundesliga",
|
||||
"league_id": 5464
|
||||
},
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "DFB Pokal",
|
||||
"league_id": 5275
|
||||
},
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "Super Cup",
|
||||
"league_id": 5223
|
||||
},
|
||||
{
|
||||
"country": "England",
|
||||
"name": "Premier League",
|
||||
"league_id": 5267
|
||||
},
|
||||
{
|
||||
"country": "Spain",
|
||||
"name": "La Liga",
|
||||
"league_id": 5284
|
||||
},
|
||||
{
|
||||
"country": "Italy",
|
||||
"name": "Serie A",
|
||||
"league_id": 5367
|
||||
},
|
||||
{
|
||||
"country": "France",
|
||||
"name": "Ligue 1",
|
||||
"league_id": 5322
|
||||
},
|
||||
{
|
||||
"country": "Turkey",
|
||||
"name": "Süper Lig",
|
||||
"league_id": 5476
|
||||
},
|
||||
{
|
||||
"country": "Netherlands",
|
||||
"name": "Eredivisie",
|
||||
"league_id": 5389
|
||||
},
|
||||
{
|
||||
"country": "World",
|
||||
"name": "UEFA Champions League",
|
||||
"league_id": 5262
|
||||
},
|
||||
{
|
||||
"country": "World",
|
||||
"name": "UEFA Europa League",
|
||||
"league_id": 5607
|
||||
},
|
||||
{
|
||||
"country": "World",
|
||||
"name": "UEFA Europa Conference League",
|
||||
"league_id": 5277
|
||||
},
|
||||
{
|
||||
"country": "World",
|
||||
"name": "UEFA Super Cup",
|
||||
"league_id": 5235
|
||||
},
|
||||
{
|
||||
"country": "World",
|
||||
"name": "Euro Championship",
|
||||
"league_id": 5858
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,97 @@
|
||||
[
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "Bundesliga",
|
||||
"league_id": 6375
|
||||
},
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "2. Bundesliga",
|
||||
"league_id": 6387
|
||||
},
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "3. Liga",
|
||||
"league_id": 6443
|
||||
},
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "Regionalliga - Bayern",
|
||||
"league_id": 6472
|
||||
},
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "Regionalliga - SudWest",
|
||||
"league_id": 6471
|
||||
},
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "U19 Bundesliga",
|
||||
"league_id": 6572
|
||||
},
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "Frauen Bundesliga",
|
||||
"league_id": 6510
|
||||
},
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "DFB Pokal",
|
||||
"league_id": 6244
|
||||
},
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "Super Cup",
|
||||
"league_id": 6247
|
||||
},
|
||||
{
|
||||
"country": "England",
|
||||
"name": "Premier League",
|
||||
"league_id": 6280
|
||||
},
|
||||
{
|
||||
"country": "Spain",
|
||||
"name": "La Liga",
|
||||
"league_id": 6284
|
||||
},
|
||||
{
|
||||
"country": "Italy",
|
||||
"name": "Serie A",
|
||||
"league_id": 6374
|
||||
},
|
||||
{
|
||||
"country": "France",
|
||||
"name": "Ligue 1",
|
||||
"league_id": 6315
|
||||
},
|
||||
{
|
||||
"country": "Turkey",
|
||||
"name": "Süper Lig",
|
||||
"league_id": 6447
|
||||
},
|
||||
{
|
||||
"country": "Netherlands",
|
||||
"name": "Eredivisie",
|
||||
"league_id": 6314
|
||||
},
|
||||
{
|
||||
"country": "World",
|
||||
"name": "UEFA Champions League",
|
||||
"league_id": 6281
|
||||
},
|
||||
{
|
||||
"country": "World",
|
||||
"name": "UEFA Europa League",
|
||||
"league_id": 6283
|
||||
},
|
||||
{
|
||||
"country": "World",
|
||||
"name": "UEFA Europa Conference League",
|
||||
"league_id": 6282
|
||||
},
|
||||
{
|
||||
"country": "World",
|
||||
"name": "UEFA Super Cup",
|
||||
"league_id": 6241
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,117 @@
|
||||
[
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "Bundesliga",
|
||||
"league_id": 78
|
||||
},
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "2. Bundesliga",
|
||||
"league_id": 79
|
||||
},
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "3. Liga",
|
||||
"league_id": 80
|
||||
},
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "Regionalliga - Bayern",
|
||||
"league_id": 83
|
||||
},
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "Regionalliga - SudWest",
|
||||
"league_id": 86
|
||||
},
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "U19 Bundesliga",
|
||||
"league_id": 488
|
||||
},
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "Frauen Bundesliga",
|
||||
"league_id": 82
|
||||
},
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "DFB Pokal",
|
||||
"league_id": 81
|
||||
},
|
||||
{
|
||||
"country": "Germany",
|
||||
"name": "Super Cup",
|
||||
"league_id": 529
|
||||
},
|
||||
{
|
||||
"country": "England",
|
||||
"name": "Premier League",
|
||||
"league_id": 39
|
||||
},
|
||||
{
|
||||
"country": "Spain",
|
||||
"name": "La Liga",
|
||||
"league_id": 140
|
||||
},
|
||||
{
|
||||
"country": "Italy",
|
||||
"name": "Serie A",
|
||||
"league_id": 135
|
||||
},
|
||||
{
|
||||
"country": "France",
|
||||
"name": "Ligue 1",
|
||||
"league_id": 61
|
||||
},
|
||||
{
|
||||
"country": "Turkey",
|
||||
"name": "Süper Lig",
|
||||
"league_id": 203
|
||||
},
|
||||
{
|
||||
"country": "Netherlands",
|
||||
"name": "Eredivisie",
|
||||
"league_id": 88
|
||||
},
|
||||
{
|
||||
"country": "Austria",
|
||||
"name": "Bundesliga",
|
||||
"league_id": 218
|
||||
},
|
||||
{
|
||||
"country": "Portugal",
|
||||
"name": "Primeira Liga",
|
||||
"league_id": 94
|
||||
},
|
||||
{
|
||||
"country": "World",
|
||||
"name": "UEFA Champions League",
|
||||
"league_id": 2
|
||||
},
|
||||
{
|
||||
"country": "World",
|
||||
"name": "UEFA Europa League",
|
||||
"league_id": 3
|
||||
},
|
||||
{
|
||||
"country": "World",
|
||||
"name": "UEFA Europa Conference League",
|
||||
"league_id": 848
|
||||
},
|
||||
{
|
||||
"country": "World",
|
||||
"name": "UEFA Super Cup",
|
||||
"league_id": 531
|
||||
},
|
||||
{
|
||||
"country": "World",
|
||||
"name": "World Cup",
|
||||
"league_id": 1
|
||||
},
|
||||
{
|
||||
"country": "World",
|
||||
"name": "Euro Championship",
|
||||
"league_id": 4
|
||||
}
|
||||
]
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,297 @@
|
||||
[
|
||||
{
|
||||
"team_id": 2002,
|
||||
"team_name": "Julian",
|
||||
"team_name_short": "Julian"
|
||||
},
|
||||
{
|
||||
"team_id": 2053,
|
||||
"team_name": "Demian",
|
||||
"team_name_short": "Demian"
|
||||
},
|
||||
{
|
||||
"team_id": 2054,
|
||||
"team_name": "Hilde",
|
||||
"team_name_short": "Hilde"
|
||||
},
|
||||
{
|
||||
"team_id": 2055,
|
||||
"team_name": "Oliver",
|
||||
"team_name_short": "Oliver"
|
||||
},
|
||||
{
|
||||
"team_id": 2056,
|
||||
"team_name": "Martin",
|
||||
"team_name_short": "Martin"
|
||||
},
|
||||
{
|
||||
"team_id": 2057,
|
||||
"team_name": "Matthias",
|
||||
"team_name_short": "Matthias"
|
||||
},
|
||||
{
|
||||
"team_id": 2058,
|
||||
"team_name": "Nicole",
|
||||
"team_name_short": "Nicole"
|
||||
},
|
||||
{
|
||||
"team_id": 2059,
|
||||
"team_name": "Sascha",
|
||||
"team_name_short": "Sascha"
|
||||
},
|
||||
{
|
||||
"team_id": 2060,
|
||||
"team_name": "TG Nürnberg",
|
||||
"team_name_short": "TG Nürnb."
|
||||
},
|
||||
{
|
||||
"team_id": 2061,
|
||||
"team_name": "Friedrich",
|
||||
"team_name_short": "Friedrich"
|
||||
},
|
||||
{
|
||||
"team_id": 2062,
|
||||
"team_name": "Jimmy",
|
||||
"team_name_short": "Jimmy"
|
||||
},
|
||||
{
|
||||
"team_id": 2063,
|
||||
"team_name": "Flo",
|
||||
"team_name_short": "Flo"
|
||||
},
|
||||
{
|
||||
"team_id": 2064,
|
||||
"team_name": "Max",
|
||||
"team_name_short": "Max"
|
||||
},
|
||||
{
|
||||
"team_id": 2065,
|
||||
"team_name": "Fabian",
|
||||
"team_name_short": "Fabian"
|
||||
},
|
||||
{
|
||||
"team_id": 2066,
|
||||
"team_name": "Bastian",
|
||||
"team_name_short": "Bastian"
|
||||
},
|
||||
{
|
||||
"team_id": 2067,
|
||||
"team_name": "Kevin",
|
||||
"team_name_short": "Kevin"
|
||||
},
|
||||
{
|
||||
"team_id": 2068,
|
||||
"team_name": "Tristan",
|
||||
"team_name_short": "Tristan"
|
||||
},
|
||||
{
|
||||
"team_id": 2069,
|
||||
"team_name": "Werner",
|
||||
"team_name_short": "Werner"
|
||||
},
|
||||
{
|
||||
"team_id": 2070,
|
||||
"team_name": "Johnny",
|
||||
"team_name_short": "Werner"
|
||||
},
|
||||
{
|
||||
"team_id": 2071,
|
||||
"team_name": "Marcel",
|
||||
"team_name_short": "Marcel"
|
||||
},
|
||||
{
|
||||
"team_id": 2072,
|
||||
"team_name": "TG Sportbild/Fifa",
|
||||
"team_name_short": "TG Sportb."
|
||||
},
|
||||
{
|
||||
"team_id": 2073,
|
||||
"team_name": "Marcel U.",
|
||||
"team_name_short": "Marcel U."
|
||||
},
|
||||
{
|
||||
"team_id": 2074,
|
||||
"team_name": "Kay",
|
||||
"team_name_short": "Kay"
|
||||
},
|
||||
{
|
||||
"team_id": 2075,
|
||||
"team_name": "Maxi H.",
|
||||
"team_name_short": "Maxi H."
|
||||
},
|
||||
{
|
||||
"team_id": 2076,
|
||||
"team_name": "Frank",
|
||||
"team_name_short": "Frank"
|
||||
},
|
||||
{
|
||||
"team_id": 2077,
|
||||
"team_name": "Stefanie",
|
||||
"team_name_short": "Stefanie"
|
||||
},
|
||||
{
|
||||
"team_id": 2078,
|
||||
"team_name": "Jaron",
|
||||
"team_name_short": "Jaron"
|
||||
},
|
||||
{
|
||||
"team_id": 2079,
|
||||
"team_name": "Jonas",
|
||||
"team_name_short": "Jonas"
|
||||
},
|
||||
{
|
||||
"team_id": 2082,
|
||||
"team_name": "Klaus",
|
||||
"team_name_short": "Klaus"
|
||||
},
|
||||
{
|
||||
"team_id": 2083,
|
||||
"team_name": "Eduard",
|
||||
"team_name_short": "Eduard"
|
||||
},
|
||||
{
|
||||
"team_id": 2084,
|
||||
"team_name": "Kristina",
|
||||
"team_name_short": "Kristina"
|
||||
},
|
||||
{
|
||||
"team_id": 2085,
|
||||
"team_name": "Andreas",
|
||||
"team_name_short": "Andreas"
|
||||
},
|
||||
{
|
||||
"team_id": 2086,
|
||||
"team_name": "Maxi U.",
|
||||
"team_name_short": "Maxi U."
|
||||
},
|
||||
{
|
||||
"team_id": 2087,
|
||||
"team_name": "Franz",
|
||||
"team_name_short": "Franz"
|
||||
},
|
||||
{
|
||||
"team_id": 2088,
|
||||
"team_name": "Vincent",
|
||||
"team_name_short": "Vincent"
|
||||
},
|
||||
{
|
||||
"team_id": 2089,
|
||||
"team_name": "Martin H.",
|
||||
"team_name_short": "Martin H."
|
||||
},
|
||||
{
|
||||
"team_id": 2090,
|
||||
"team_name": "Dome",
|
||||
"team_name_short": "Dome"
|
||||
},
|
||||
{
|
||||
"team_id": 2091,
|
||||
"team_name": "Dom",
|
||||
"team_name_short": "Dom"
|
||||
},
|
||||
{
|
||||
"team_id": 2096,
|
||||
"team_name": "Jan",
|
||||
"team_name_short": "Jan"
|
||||
},
|
||||
{
|
||||
"team_id": 2102,
|
||||
"team_name": "Maxi Z.",
|
||||
"team_name_short": "Maxi Z."
|
||||
},
|
||||
{
|
||||
"team_id": 2103,
|
||||
"team_name": "Patrick",
|
||||
"team_name_short": "Patrick"
|
||||
},
|
||||
{
|
||||
"team_id": 2104,
|
||||
"team_name": "Jan K.",
|
||||
"team_name_short": "Jan K."
|
||||
},
|
||||
{
|
||||
"team_id": 2105,
|
||||
"team_name": "Muck",
|
||||
"team_name_short": "Muck"
|
||||
},
|
||||
{
|
||||
"team_id": 2106,
|
||||
"team_name": "Philipp",
|
||||
"team_name_short": "Philipp"
|
||||
},
|
||||
{
|
||||
"team_id": 2108,
|
||||
"team_name": "Lukas",
|
||||
"team_name_short": "Lukas"
|
||||
},
|
||||
{
|
||||
"team_id": 2109,
|
||||
"team_name": "Sandro",
|
||||
"team_name_short": "Sandro"
|
||||
},
|
||||
{
|
||||
"team_id": 2110,
|
||||
"team_name": "Bernd",
|
||||
"team_name_short": "Bernd"
|
||||
},
|
||||
{
|
||||
"team_id": 2112,
|
||||
"team_name": "Arno",
|
||||
"team_name_short": "Arno"
|
||||
},
|
||||
{
|
||||
"team_id": 2113,
|
||||
"team_name": "Stefan",
|
||||
"team_name_short": "Stefan"
|
||||
},
|
||||
{
|
||||
"team_id": 2114,
|
||||
"team_name": "Armin",
|
||||
"team_name_short": "Armin"
|
||||
},
|
||||
{
|
||||
"team_id": 2119,
|
||||
"team_name": "Dominik",
|
||||
"team_name_short": "Dominik"
|
||||
},
|
||||
{
|
||||
"team_id": 2123,
|
||||
"team_name": "Michael",
|
||||
"team_name_short": "Michael"
|
||||
},
|
||||
{
|
||||
"team_id": 2124,
|
||||
"team_name": "Olli L.",
|
||||
"team_name_short": "Olli L."
|
||||
},
|
||||
{
|
||||
"team_id": 2131,
|
||||
"team_name": "Adrian",
|
||||
"team_name_short": "Adrian"
|
||||
},
|
||||
{
|
||||
"team_id": 2133,
|
||||
"team_name": "Barb",
|
||||
"team_name_short": "Barb"
|
||||
},
|
||||
{
|
||||
"team_id": 2137,
|
||||
"team_name": "Johannes",
|
||||
"team_name_short": "Johannes"
|
||||
},
|
||||
{
|
||||
"team_id": 2138,
|
||||
"team_name": "TG ChatGPT",
|
||||
"team_name_short": "ChatGPT"
|
||||
},
|
||||
{
|
||||
"team_id": 2139,
|
||||
"team_name": "Dustin",
|
||||
"team_name_short": "Dustin"
|
||||
},
|
||||
{
|
||||
"team_id": 2140,
|
||||
"team_name": "Marcel W.",
|
||||
"team_name_short": "Marcel W."
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,114 @@
|
||||
{
|
||||
"numberOfMatchdays": 5,
|
||||
"matchesPerMatchday": 0,
|
||||
"pointMode": 4,
|
||||
"pointsTendency": 1,
|
||||
"pointsDifference": 2,
|
||||
"pointsDirectHit": 3,
|
||||
"ko": 1,
|
||||
"matchdayConfig": [
|
||||
{
|
||||
"TLWMatchday": 1,
|
||||
"matchdayName": "1. Runde",
|
||||
"numberOfMatches": 32,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 5275,
|
||||
"leagueMatchday": 1,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "Placeholder",
|
||||
"placeholderDatetime": "2022-07-29 20:45:00"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 2,
|
||||
"numberOfMatches": 12,
|
||||
"matchdayName": "2. Spieltag",
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 5275,
|
||||
"leagueMatchday": 2,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "Placeholder",
|
||||
"placeholderDatetime": "2022-10-18 18:30:00"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 3,
|
||||
"numberOfMatches": 12,
|
||||
"matchdayName": "3. Spieltag",
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 5275,
|
||||
"leagueMatchday": 3,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "Placeholder",
|
||||
"placeholderDatetime": "2023-01-31 18:30:00"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 4,
|
||||
"numberOfMatches": 8,
|
||||
"matchdayName": "Achtelfinale",
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 5275,
|
||||
"leagueMatchday": 4,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "Placeholder",
|
||||
"placeholderDatetime": "2023-04-04 18:30:00"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 5,
|
||||
"numberOfMatches": 4,
|
||||
"matchdayName": "Viertelfinale",
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 5275,
|
||||
"leagueMatchday": 5,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 5275,
|
||||
"leagueMatchday": 5,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 5275,
|
||||
"leagueMatchday": 6,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 5275,
|
||||
"leagueMatchday": 6,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "Placeholder",
|
||||
"placeholderDatetime": "2023-05-02 20:45:00"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
{
|
||||
"numberOfMatchdays": 5,
|
||||
"matchesPerMatchday": 0,
|
||||
"pointMode": 4,
|
||||
"pointsTendency": 1,
|
||||
"pointsDifference": 2,
|
||||
"pointsDirectHit": 3,
|
||||
"ko": 1,
|
||||
"matchdayConfig": [
|
||||
{
|
||||
"TLWMatchday": 1,
|
||||
"matchdayName": "1. Runde",
|
||||
"numberOfMatches": 32,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 5858,
|
||||
"leagueMatchday": 1,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 2,
|
||||
"numberOfMatches": 12,
|
||||
"matchdayName": "2. Spieltag",
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 5858,
|
||||
"leagueMatchday": 2,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 3,
|
||||
"numberOfMatches": 12,
|
||||
"matchdayName": "3. Spieltag",
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 5858,
|
||||
"leagueMatchday": 3,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 4,
|
||||
"numberOfMatches": 8,
|
||||
"matchdayName": "Achtelfinale",
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 5858,
|
||||
"leagueMatchday": 4,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "Placeholder",
|
||||
"placeholderDatetime": "2024-06-29 18:00:00"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 5,
|
||||
"numberOfMatches": 4,
|
||||
"matchdayName": "Viertelfinale",
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 5858,
|
||||
"leagueMatchday": 5,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "Placeholder",
|
||||
"placeholderDatetime": "2024-07-05 18:00:00"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 6,
|
||||
"numberOfMatches": 2,
|
||||
"matchdayName": "Halbfinale",
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 5858,
|
||||
"leagueMatchday": 6,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "Placeholder",
|
||||
"placeholderDatetime": "2024-07-09 21:00:00"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 7,
|
||||
"numberOfMatches": 1,
|
||||
"matchdayName": "Finale",
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 5858,
|
||||
"leagueMatchday": 7,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "Placeholder",
|
||||
"placeholderDatetime": "2024-07-14 21:00:00"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,435 @@
|
||||
{
|
||||
"numberOfMatchdays": 39,
|
||||
"matchesPerMatchday": 12,
|
||||
"pointMode": 4,
|
||||
"pointsTendency": 1,
|
||||
"pointsDifference": 2,
|
||||
"pointsDirectHit": 3,
|
||||
"ko": 0,
|
||||
"matchdayConfig": [
|
||||
{
|
||||
"TLWMatchday": 1,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 6387,
|
||||
"leagueMatchday": 1,
|
||||
"showTable": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 2,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 6387,
|
||||
"leagueMatchday": 2,
|
||||
"showTable": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 3,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 6375,
|
||||
"leagueMatchday": 1,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 4,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 6375,
|
||||
"leagueMatchday": 2,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 5,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 6375,
|
||||
"leagueMatchday": 3,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 6,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 6375,
|
||||
"leagueMatchday": 4,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 7,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 6375,
|
||||
"leagueMatchday": 5,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 8,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 6375,
|
||||
"leagueMatchday": 6,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 9,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 6375,
|
||||
"leagueMatchday": 7,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 10,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 6375,
|
||||
"leagueMatchday": 8,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 11,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 6375,
|
||||
"leagueMatchday": 9,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 12,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 6375,
|
||||
"leagueMatchday": 10,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 13,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 6375,
|
||||
"leagueMatchday": 11,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 14,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 6375,
|
||||
"leagueMatchday": 12,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 15,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 6375,
|
||||
"leagueMatchday": 13,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 16,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 6375,
|
||||
"leagueMatchday": 14,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 17,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 6375,
|
||||
"leagueMatchday": 15,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 18,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "Placeholder",
|
||||
"placeholderDatetime": "2024-12-26 18:00:00"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 19,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 6375,
|
||||
"leagueMatchday": 16,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 20,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 6375,
|
||||
"leagueMatchday": 17,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 21,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 6375,
|
||||
"leagueMatchday": 18,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 22,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 6375,
|
||||
"leagueMatchday": 19,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 23,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 6375,
|
||||
"leagueMatchday": 20,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 24,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 6375,
|
||||
"leagueMatchday": 21,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 25,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 6375,
|
||||
"leagueMatchday": 22,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 26,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 6375,
|
||||
"leagueMatchday": 23,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 27,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 6375,
|
||||
"leagueMatchday": 24,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 28,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 6375,
|
||||
"leagueMatchday": 25,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 29,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 6375,
|
||||
"leagueMatchday": 26,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 30,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "Placeholder",
|
||||
"placeholderDatetime": "2025-03-18 18:00:00"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 31,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 6375,
|
||||
"leagueMatchday": 27,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 32,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 6375,
|
||||
"leagueMatchday": 28,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 33,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 6375,
|
||||
"leagueMatchday": 29,
|
||||
"showTable": true
|
||||
}
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 34,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "Placeholder",
|
||||
"placeholderDatetime": "2025-04-15 18:00:00"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 35,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 6375,
|
||||
"leagueMatchday": 30,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 36,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 6375,
|
||||
"leagueMatchday": 31,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 37,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 6375,
|
||||
"leagueMatchday": 32,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 38,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 6375,
|
||||
"leagueMatchday": 33,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 39,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 6375,
|
||||
"leagueMatchday": 34,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,152 @@
|
||||
{
|
||||
"numberOfMatchdays": 5,
|
||||
"matchesPerMatchday": 0,
|
||||
"pointMode": 4,
|
||||
"pointsTendency": 1,
|
||||
"pointsDifference": 2,
|
||||
"pointsDirectHit": 3,
|
||||
"ko": 1,
|
||||
"matchdayConfig": [
|
||||
{
|
||||
"TLWMatchday": 1,
|
||||
"matchdayName": "1. Runde",
|
||||
"numberOfMatches": 32,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 6244,
|
||||
"leagueMatchday": 1,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "Placeholder",
|
||||
"placeholderDatetime": "2024-08-16 18:00:00"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 2,
|
||||
"numberOfMatches": 16,
|
||||
"matchdayName": "Achtelfinale",
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 6244,
|
||||
"leagueMatchday": 2,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "Placeholder",
|
||||
"placeholderDatetime": "2024-10-29 18:00:00"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 3,
|
||||
"numberOfMatches": 8,
|
||||
"matchdayName": "Viertelfinale",
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 6244,
|
||||
"leagueMatchday": 3,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "Placeholder",
|
||||
"placeholderDatetime": "2024-12-03 18:30:00"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 4,
|
||||
"numberOfMatches": 4,
|
||||
"matchdayName": "Halbfinale",
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 6244,
|
||||
"leagueMatchday": 4,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "Placeholder",
|
||||
"placeholderDatetime": "2025-02-04 18:30:00"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 5,
|
||||
"numberOfMatches": 6,
|
||||
"matchdayName": "Finale",
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 6244,
|
||||
"leagueMatchday": 5,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 6244,
|
||||
"leagueMatchday": 5,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 6244,
|
||||
"leagueMatchday": 6,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 6244,
|
||||
"leagueMatchday": 6,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "PlaceholderSingleMatch",
|
||||
"koMatch": true,
|
||||
"placeholderDatetime": "2025-04-01 20:45:00",
|
||||
"formulaHome": "D",
|
||||
"formulaGuest": "D"
|
||||
},
|
||||
{
|
||||
"type": "PlaceholderSingleMatch",
|
||||
"koMatch": true,
|
||||
"placeholderDatetime": "2025-04-02 20:45:00",
|
||||
"formulaHome": "D",
|
||||
"formulaGuest": "D"
|
||||
},
|
||||
{
|
||||
"type": "PlaceholderSingleMatch",
|
||||
"koMatch": true,
|
||||
"placeholderDatetime": "2025-04-01 20:45:00",
|
||||
"formulaHome": "D",
|
||||
"formulaGuest": "D"
|
||||
},
|
||||
{
|
||||
"type": "PlaceholderSingleMatch",
|
||||
"koMatch": true,
|
||||
"placeholderDatetime": "2025-04-02 20:45:00",
|
||||
"formulaHome": "D",
|
||||
"formulaGuest": "D"
|
||||
},
|
||||
{
|
||||
"type": "PlaceholderSingleMatch",
|
||||
"koMatch": true,
|
||||
"placeholderDatetime": "2025-05-24 20:00:00",
|
||||
"formulaHome": "D",
|
||||
"formulaGuest": "D"
|
||||
},
|
||||
{
|
||||
"type": "PlaceholderSingleMatch",
|
||||
"koMatch": true,
|
||||
"placeholderDatetime": "2025-05-24 20:00:00",
|
||||
"formulaHome": "D",
|
||||
"formulaGuest": "D"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
{
|
||||
"numberOfMatchdays": 5,
|
||||
"matchesPerMatchday": 0,
|
||||
"pointMode": 4,
|
||||
"pointsTendency": 1,
|
||||
"pointsDifference": 2,
|
||||
"pointsDirectHit": 3,
|
||||
"ko": 1,
|
||||
"matchdayConfig": [
|
||||
{
|
||||
"TLWMatchday": 1,
|
||||
"matchdayName": "1. Runde",
|
||||
"numberOfMatches": 32,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 81,
|
||||
"leagueMatchday": 1,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "Placeholder",
|
||||
"placeholderDatetime": "2024-08-16 18:00:00"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 2,
|
||||
"numberOfMatches": 16,
|
||||
"matchdayName": "Achtelfinale",
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 81,
|
||||
"leagueMatchday": 2,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "Placeholder",
|
||||
"placeholderDatetime": "2024-10-29 18:00:00"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 3,
|
||||
"numberOfMatches": 8,
|
||||
"matchdayName": "Viertelfinale",
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 81,
|
||||
"leagueMatchday": 3,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "Placeholder",
|
||||
"placeholderDatetime": "2024-12-03 18:30:00"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 4,
|
||||
"numberOfMatches": 4,
|
||||
"matchdayName": "Halbfinale",
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 81,
|
||||
"leagueMatchday": 4,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "Placeholder",
|
||||
"placeholderDatetime": "2025-02-04 18:30:00"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 5,
|
||||
"numberOfMatches": 6,
|
||||
"matchdayName": "Finale",
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 81,
|
||||
"leagueMatchday": 5,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 81,
|
||||
"leagueMatchday": 5,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 81,
|
||||
"leagueMatchday": 6,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 81,
|
||||
"leagueMatchday": 6,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "PlaceholderSingleMatch",
|
||||
"koMatch": true,
|
||||
"placeholderDatetime": "2025-04-01 20:45:00",
|
||||
"formulaHome": "D",
|
||||
"formulaGuest": "D"
|
||||
},
|
||||
{
|
||||
"type": "PlaceholderSingleMatch",
|
||||
"koMatch": true,
|
||||
"placeholderDatetime": "2025-04-02 20:45:00",
|
||||
"formulaHome": "D",
|
||||
"formulaGuest": "D"
|
||||
},
|
||||
{
|
||||
"type": "PlaceholderSingleMatch",
|
||||
"koMatch": true,
|
||||
"placeholderDatetime": "2025-04-01 20:45:00",
|
||||
"formulaHome": "D",
|
||||
"formulaGuest": "D"
|
||||
},
|
||||
{
|
||||
"type": "PlaceholderSingleMatch",
|
||||
"koMatch": true,
|
||||
"placeholderDatetime": "2025-04-02 20:45:00",
|
||||
"formulaHome": "D",
|
||||
"formulaGuest": "D"
|
||||
},
|
||||
{
|
||||
"type": "PlaceholderSingleMatch",
|
||||
"koMatch": true,
|
||||
"placeholderDatetime": "2025-05-24 20:00:00",
|
||||
"formulaHome": "D",
|
||||
"formulaGuest": "D"
|
||||
},
|
||||
{
|
||||
"type": "PlaceholderSingleMatch",
|
||||
"koMatch": true,
|
||||
"placeholderDatetime": "2025-05-24 20:00:00",
|
||||
"formulaHome": "D",
|
||||
"formulaGuest": "D"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
{
|
||||
"numberOfMatchdays": 8,
|
||||
"matchesPerMatchday": 0,
|
||||
"pointMode": 4,
|
||||
"pointsTendency": 1,
|
||||
"pointsDifference": 2,
|
||||
"pointsDirectHit": 3,
|
||||
"ko": 1,
|
||||
"matchdayConfig": [
|
||||
{
|
||||
"TLWMatchday": 1,
|
||||
"numberOfMatches": 24,
|
||||
"matchdayName": "1. Spieltag",
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 1,
|
||||
"leagueMatchday": 1,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 2,
|
||||
"numberOfMatches": 24,
|
||||
"matchdayName": "2. Spieltag",
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 1,
|
||||
"leagueMatchday": 2,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 3,
|
||||
"numberOfMatches": 24,
|
||||
"matchdayName": "3. Spieltag",
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 1,
|
||||
"leagueMatchday": 3,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 4,
|
||||
"numberOfMatches": 16,
|
||||
"matchdayName": "Sechzentelfinale",
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 1,
|
||||
"leagueMatchday": 4,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "Placeholder",
|
||||
"placeholderDatetime": "2026-06-28 21:00:00"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 5,
|
||||
"numberOfMatches": 8,
|
||||
"matchdayName": "Achtelfinale",
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 1,
|
||||
"leagueMatchday": 5,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "Placeholder",
|
||||
"placeholderDatetime": "2026-07-04 19:00:00"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 6,
|
||||
"numberOfMatches": 4,
|
||||
"matchdayName": "Viertelfinale",
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 1,
|
||||
"leagueMatchday": 6,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "Placeholder",
|
||||
"placeholderDatetime": "2026-07-09 22:00:00"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 7,
|
||||
"numberOfMatches": 2,
|
||||
"matchdayName": "Halbfinale",
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 1,
|
||||
"leagueMatchday": 7,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "Placeholder",
|
||||
"placeholderDatetime": "2026-07-14 21:00:00"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 8,
|
||||
"numberOfMatches": 2,
|
||||
"matchdayName": "Finale",
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 1,
|
||||
"leagueMatchday": 8,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "Placeholder",
|
||||
"placeholderDatetime": "2026-07-18 23:00:00"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,434 @@
|
||||
{
|
||||
"numberOfMatchdays": 39,
|
||||
"matchesPerMatchday": 12,
|
||||
"pointMode": 4,
|
||||
"pointsTendency": 1,
|
||||
"pointsDifference": 2,
|
||||
"pointsDirectHit": 3,
|
||||
"ko": 0,
|
||||
"matchdayConfig": [
|
||||
{
|
||||
"TLWMatchday": 1,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 79,
|
||||
"leagueMatchday": 1,
|
||||
"showTable": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 2,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 79,
|
||||
"leagueMatchday": 2,
|
||||
"showTable": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 3,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 1,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 4,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 2,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 5,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 3,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 6,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 4,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 7,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 5,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 8,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 6,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 9,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 7,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 10,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 8,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 11,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 9,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 12,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 10,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 13,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 11,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 14,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 12,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 15,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 13,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 16,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 14,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 17,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 15,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 18,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "Placeholder",
|
||||
"placeholderDatetime": "2025-12-26 18:00:00"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 19,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 16,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 20,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 17,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 21,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 18,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 22,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 19,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 23,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 20,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 24,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 21,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 25,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 22,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 26,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 23,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 27,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 24,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 28,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 25,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 29,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 26,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 30,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "Placeholder",
|
||||
"placeholderDatetime": "2026-03-17 18:00:00"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 31,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 27,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 32,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 28,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 33,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 29,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 34,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "Placeholder",
|
||||
"placeholderDatetime": "2026-04-14 18:00:00"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 35,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 30,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 36,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 31,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 37,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 32,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 38,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 33,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 39,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 34,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
INSERT INTO `phpbb_footb_leagues` (`season`, `league`, `league_name`, `league_name_short`, `league_type`, `matchdays`, `matches_on_matchday`, `win_result`, `win_result_02`, `win_matchday`, `win_season`, `points_mode`, `points_result`, `points_tendency`, `points_diff`, `points_last`, `join_by_user`, `join_in_season`, `bet_in_time`, `rules_post_id`, `sort`, `bet_ko_type`, `bet_points`, `bet_type`) VALUES (2026, 1, '1. Tippliga Würzburg', '1TL', 1, 39, 12, '0', '0', '0', '0', 4, 3, 1, 2, 0, 0, 0, 0, 561, 0, 1, 0.00, 0);
|
||||
INSERT INTO `phpbb_footb_leagues` (`season`, `league`, `league_name`, `league_name_short`, `league_type`, `matchdays`, `matches_on_matchday`, `win_result`, `win_result_02`, `win_matchday`, `win_season`, `points_mode`, `points_result`, `points_tendency`, `points_diff`, `points_last`, `join_by_user`, `join_in_season`, `bet_in_time`, `rules_post_id`, `sort`, `bet_ko_type`, `bet_points`, `bet_type`) VALUES (2026, 2, '2. Tippliga Würzburg', '2TL', 1, 39, 12, '0', '0', '0', '0', 4, 3, 1, 2, 0, 0, 0, 0, 561, 0, 1, 0.00, 0);
|
||||
INSERT INTO `phpbb_footb_leagues` (`season`, `league`, `league_name`, `league_name_short`, `league_type`, `matchdays`, `matches_on_matchday`, `win_result`, `win_result_02`, `win_matchday`, `win_season`, `points_mode`, `points_result`, `points_tendency`, `points_diff`, `points_last`, `join_by_user`, `join_in_season`, `bet_in_time`, `rules_post_id`, `sort`, `bet_ko_type`, `bet_points`, `bet_type`) VALUES (2026, 45, 'Supercup', 'SC', 2, 1, 0, '0', '0', '0', '0', 4, 3, 1, 2, 0, 0, 0, 1, 561, 0, 1, 0.00, 0);
|
||||
INSERT INTO `phpbb_footb_leagues` (`season`, `league`, `league_name`, `league_name_short`, `league_type`, `matchdays`, `matches_on_matchday`, `win_result`, `win_result_02`, `win_matchday`, `win_season`, `points_mode`, `points_result`, `points_tendency`, `points_diff`, `points_last`, `join_by_user`, `join_in_season`, `bet_in_time`, `rules_post_id`, `sort`, `bet_ko_type`, `bet_points`, `bet_type`) VALUES (2026, 47, 'Relegation', 'REL', 2, 1, 0, '0', '0', '0', '0', 4, 3, 1, 2, 0, 0, 0, 1, 561, 0, 1, 0.00, 1);
|
||||
INSERT INTO `phpbb_footb_leagues` (`season`, `league`, `league_name`, `league_name_short`, `league_type`, `matchdays`, `matches_on_matchday`, `win_result`, `win_result_02`, `win_matchday`, `win_season`, `points_mode`, `points_result`, `points_tendency`, `points_diff`, `points_last`, `join_by_user`, `join_in_season`, `bet_in_time`, `rules_post_id`, `sort`, `bet_ko_type`, `bet_points`, `bet_type`) VALUES (2026, 48, 'WTL-Pokal', 'WTL', 2, 5, 0, '0', '0', '0', '0', 4, 3, 1, 2, 0, 0, 0, 0, 561, 0, 1, 0.00, 0);
|
||||
INSERT INTO `phpbb_footb_leagues` (`season`, `league`, `league_name`, `league_name_short`, `league_type`, `matchdays`, `matches_on_matchday`, `win_result`, `win_result_02`, `win_matchday`, `win_season`, `points_mode`, `points_result`, `points_tendency`, `points_diff`, `points_last`, `join_by_user`, `join_in_season`, `bet_in_time`, `rules_post_id`, `sort`, `bet_ko_type`, `bet_points`, `bet_type`) VALUES (2026, 49, 'WM-Tippspiel', 'EM', 2, 7, 0, '0', '0', '0', '0', 4, 3, 1, 2, 0, 0, 0, 0, 0, 0, 1, 0.00, 1);
|
||||
INSERT INTO `phpbb_footb_leagues` (`season`, `league`, `league_name`, `league_name_short`, `league_type`, `matchdays`, `matches_on_matchday`, `win_result`, `win_result_02`, `win_matchday`, `win_season`, `points_mode`, `points_result`, `points_tendency`, `points_diff`, `points_last`, `join_by_user`, `join_in_season`, `bet_in_time`, `rules_post_id`, `sort`, `bet_ko_type`, `bet_points`, `bet_type`) VALUES (2026, 51, '1. Tippliga Würzburg', '1TL', 1, 39, 7, '0', '0', '0', '0', 1, 0, 0, 0, 1, 0, 0, 0, 561, 0, 1, 0.00, 0);
|
||||
INSERT INTO `phpbb_footb_leagues` (`season`, `league`, `league_name`, `league_name_short`, `league_type`, `matchdays`, `matches_on_matchday`, `win_result`, `win_result_02`, `win_matchday`, `win_season`, `points_mode`, `points_result`, `points_tendency`, `points_diff`, `points_last`, `join_by_user`, `join_in_season`, `bet_in_time`, `rules_post_id`, `sort`, `bet_ko_type`, `bet_points`, `bet_type`) VALUES (2026, 52, '2. Tippliga Würzburg', '2TL', 1, 39, 7, '0', '0', '0', '0', 1, 0, 0, 0, 1, 0, 0, 0, 561, 0, 1, 0.00, 0);
|
||||
INSERT INTO `phpbb_footb_leagues` (`season`, `league`, `league_name`, `league_name_short`, `league_type`, `matchdays`, `matches_on_matchday`, `win_result`, `win_result_02`, `win_matchday`, `win_season`, `points_mode`, `points_result`, `points_tendency`, `points_diff`, `points_last`, `join_by_user`, `join_in_season`, `bet_in_time`, `rules_post_id`, `sort`, `bet_ko_type`, `bet_points`, `bet_type`) VALUES (2026, 95, 'Supercup', 'SC', 2, 2, 0, '0', '0', '0', '0', 1, 0, 0, 0, 1, 0, 0, 0, 561, 0, 1, 0.00, 0);
|
||||
INSERT INTO `phpbb_footb_leagues` (`season`, `league`, `league_name`, `league_name_short`, `league_type`, `matchdays`, `matches_on_matchday`, `win_result`, `win_result_02`, `win_matchday`, `win_season`, `points_mode`, `points_result`, `points_tendency`, `points_diff`, `points_last`, `join_by_user`, `join_in_season`, `bet_in_time`, `rules_post_id`, `sort`, `bet_ko_type`, `bet_points`, `bet_type`) VALUES (2026, 97, 'Relegation', 'REL', 2, 1, 0, '0', '0', '0', '0', 1, 0, 0, 0, 1, 0, 0, 0, 561, 0, 1, 0.00, 0);
|
||||
INSERT INTO `phpbb_footb_leagues` (`season`, `league`, `league_name`, `league_name_short`, `league_type`, `matchdays`, `matches_on_matchday`, `win_result`, `win_result_02`, `win_matchday`, `win_season`, `points_mode`, `points_result`, `points_tendency`, `points_diff`, `points_last`, `join_by_user`, `join_in_season`, `bet_in_time`, `rules_post_id`, `sort`, `bet_ko_type`, `bet_points`, `bet_type`) VALUES (2026, 98, 'WTL-Pokal', 'WTL', 2, 6, 0, '0', '0', '0', '0', 1, 0, 0, 0, 1, 0, 0, 0, 561, 0, 1, 0.00, 0);
|
||||
@@ -0,0 +1,152 @@
|
||||
{
|
||||
"numberOfMatchdays": 5,
|
||||
"matchesPerMatchday": 0,
|
||||
"pointMode": 4,
|
||||
"pointsTendency": 1,
|
||||
"pointsDifference": 2,
|
||||
"pointsDirectHit": 3,
|
||||
"ko": 1,
|
||||
"matchdayConfig": [
|
||||
{
|
||||
"TLWMatchday": 1,
|
||||
"matchdayName": "1. Runde",
|
||||
"numberOfMatches": 32,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 81,
|
||||
"leagueMatchday": 1,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "Placeholder",
|
||||
"placeholderDatetime": "2025-08-15 18:00:00"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 2,
|
||||
"numberOfMatches": 16,
|
||||
"matchdayName": "Achtelfinale",
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 81,
|
||||
"leagueMatchday": 2,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "Placeholder",
|
||||
"placeholderDatetime": "2025-10-28 18:00:00"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 3,
|
||||
"numberOfMatches": 8,
|
||||
"matchdayName": "Viertelfinale",
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 81,
|
||||
"leagueMatchday": 3,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "Placeholder",
|
||||
"placeholderDatetime": "2025-12-02 18:30:00"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 4,
|
||||
"numberOfMatches": 4,
|
||||
"matchdayName": "Halbfinale",
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 81,
|
||||
"leagueMatchday": 4,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "Placeholder",
|
||||
"placeholderDatetime": "2026-02-03 18:30:00"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 5,
|
||||
"numberOfMatches": 6,
|
||||
"matchdayName": "Finale",
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 81,
|
||||
"leagueMatchday": 5,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 81,
|
||||
"leagueMatchday": 5,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 81,
|
||||
"leagueMatchday": 6,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 81,
|
||||
"leagueMatchday": 6,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "PlaceholderSingleMatch",
|
||||
"koMatch": true,
|
||||
"placeholderDatetime": "2026-04-21 20:45:00",
|
||||
"formulaHome": "D",
|
||||
"formulaGuest": "D"
|
||||
},
|
||||
{
|
||||
"type": "PlaceholderSingleMatch",
|
||||
"koMatch": true,
|
||||
"placeholderDatetime": "2026-04-21 20:45:00",
|
||||
"formulaHome": "D",
|
||||
"formulaGuest": "D"
|
||||
},
|
||||
{
|
||||
"type": "PlaceholderSingleMatch",
|
||||
"koMatch": true,
|
||||
"placeholderDatetime": "2026-04-22 20:45:00",
|
||||
"formulaHome": "D",
|
||||
"formulaGuest": "D"
|
||||
},
|
||||
{
|
||||
"type": "PlaceholderSingleMatch",
|
||||
"koMatch": true,
|
||||
"placeholderDatetime": "2026-04-22 20:45:00",
|
||||
"formulaHome": "D",
|
||||
"formulaGuest": "D"
|
||||
},
|
||||
{
|
||||
"type": "PlaceholderSingleMatch",
|
||||
"koMatch": true,
|
||||
"placeholderDatetime": "2026-05-23 20:00:00",
|
||||
"formulaHome": "W 61",
|
||||
"formulaGuest": "W 63"
|
||||
},
|
||||
{
|
||||
"type": "PlaceholderSingleMatch",
|
||||
"koMatch": true,
|
||||
"placeholderDatetime": "2026-05-23 20:00:00",
|
||||
"formulaHome": "W 62",
|
||||
"formulaGuest": "W 64"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
{
|
||||
"numberOfMatchdays": 1,
|
||||
"matchesPerMatchday": 4,
|
||||
"pointMode": 4,
|
||||
"pointsTendency": 1,
|
||||
"pointsDifference": 2,
|
||||
"pointsDirectHit": 3,
|
||||
"ko": 1,
|
||||
"matchdayConfig": [
|
||||
{
|
||||
"TLWMatchday": 1,
|
||||
"matchdayName": "Relegation",
|
||||
"numberOfMatches": 4,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 35,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "PlaceholderSingleMatch",
|
||||
"koMatch": true,
|
||||
"placeholderDatetime": "2027-05-27 20:30:00",
|
||||
"formulaHome": "D",
|
||||
"formulaGuest": "D"
|
||||
},
|
||||
{
|
||||
"type": "PlaceholderSingleMatch",
|
||||
"koMatch": true,
|
||||
"placeholderDatetime": "2027-05-31 20:30:00",
|
||||
"formulaHome": "D",
|
||||
"formulaGuest": "D"
|
||||
},
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 79,
|
||||
"leagueMatchday": 35,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "PlaceholderSingleMatch",
|
||||
"koMatch": true,
|
||||
"placeholderDatetime": "2027-05-28 20:30:00",
|
||||
"formulaHome": "D",
|
||||
"formulaGuest": "D"
|
||||
},
|
||||
{
|
||||
"type": "PlaceholderSingleMatch",
|
||||
"koMatch": true,
|
||||
"placeholderDatetime": "2027-06-01 20:30:00",
|
||||
"formulaHome": "D",
|
||||
"formulaGuest": "D"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
{
|
||||
"numberOfMatchdays": 2,
|
||||
"matchesPerMatchday": 4,
|
||||
"pointMode": 4,
|
||||
"pointsTendency": 1,
|
||||
"pointsDifference": 2,
|
||||
"pointsDirectHit": 3,
|
||||
"ko": 1,
|
||||
"matchdayConfig": [
|
||||
{
|
||||
"TLWMatchday": 1,
|
||||
"matchdayName": "Supercup",
|
||||
"numberOfMatches": 4,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"matchday": 1,
|
||||
"matchtime": "2026-08-22 20:30",
|
||||
"match": "Borussia Dortmund - Bayern München",
|
||||
"showTable": false,
|
||||
"matchLeague": 529,
|
||||
"type": "SingleMatch",
|
||||
"matchId": 1582362
|
||||
},
|
||||
{
|
||||
"matchday": 1,
|
||||
"matchtime": "2026-08-22 20:30",
|
||||
"match": "Borussia Dortmund - Bayern München",
|
||||
"showTable": false,
|
||||
"matchLeague": 529,
|
||||
"type": "SingleMatch",
|
||||
"matchId": 1582362
|
||||
},
|
||||
{
|
||||
"matchday": 1,
|
||||
"matchtime": "2026-08-12 21:00",
|
||||
"match": "Paris Saint Germain - Aston Villa",
|
||||
"showTable": false,
|
||||
"matchLeague": 531,
|
||||
"type": "SingleMatch",
|
||||
"matchId": 1583664
|
||||
},
|
||||
{
|
||||
"matchday": 1,
|
||||
"matchtime": "2026-08-12 21:00",
|
||||
"match": "Paris Saint Germain - Aston Villa",
|
||||
"showTable": false,
|
||||
"matchLeague": 531,
|
||||
"type": "SingleMatch",
|
||||
"matchId": 1583664
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"1": "Sascha",
|
||||
"2": "Stefan"
|
||||
}
|
||||
@@ -0,0 +1,434 @@
|
||||
{
|
||||
"numberOfMatchdays": 39,
|
||||
"matchesPerMatchday": 12,
|
||||
"pointMode": 4,
|
||||
"pointsTendency": 1,
|
||||
"pointsDifference": 2,
|
||||
"pointsDirectHit": 3,
|
||||
"ko": 0,
|
||||
"matchdayConfig": [
|
||||
{
|
||||
"TLWMatchday": 1,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 79,
|
||||
"leagueMatchday": 1,
|
||||
"showTable": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 2,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 79,
|
||||
"leagueMatchday": 2,
|
||||
"showTable": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 3,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 1,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 4,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 2,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 5,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 3,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 6,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 4,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 7,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 5,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 8,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 6,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 9,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 7,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 10,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 8,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 11,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 9,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 12,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 10,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 13,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 11,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 14,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 12,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 15,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 13,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 16,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 14,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 17,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "Placeholder",
|
||||
"placeholderDatetime": "2026-12-26 18:00:00"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 18,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 15,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 19,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 16,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 20,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 17,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 21,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 18,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 22,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 19,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 23,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 20,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 24,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 21,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 25,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 22,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 26,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 23,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 27,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 24,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 28,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 25,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 29,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 26,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 30,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "Placeholder",
|
||||
"placeholderDatetime": "2027-03-17 18:00:00"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 31,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 27,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 32,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 28,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 33,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 29,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 34,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "Placeholder",
|
||||
"placeholderDatetime": "2027-04-14 18:00:00"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 35,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 30,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 36,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 31,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 37,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 32,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 38,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 33,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 39,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 78,
|
||||
"leagueMatchday": 34,
|
||||
"showTable": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"1": "Flo",
|
||||
"2": "Michael",
|
||||
"3": "Demian",
|
||||
"4": "Sascha",
|
||||
"5": "Maxi Z.",
|
||||
"6": "Julian",
|
||||
"7": "Dustin",
|
||||
"8": "Kay",
|
||||
"9": "Lukas",
|
||||
"10": "Marcel U.",
|
||||
"11": "TG Nürnberg",
|
||||
"12": "Nicole",
|
||||
"13": "Franz",
|
||||
"14": "Tristan"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"1": "Philipp",
|
||||
"2": "Marcel",
|
||||
"3": "Matthias",
|
||||
"4": "Max",
|
||||
"5": "Marcel W.",
|
||||
"6": "Friedrich",
|
||||
"7": "Stefan",
|
||||
"8": "Armin",
|
||||
"9": "Barb",
|
||||
"10": "Hilde",
|
||||
"11": "Olli L.",
|
||||
"12": "Jimmy",
|
||||
"13": "Johannes",
|
||||
"14": "Patrick"
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
INSERT INTO `phpbb_footb_leagues` (`season`, `league`, `league_name`, `league_name_short`, `league_type`, `matchdays`, `matches_on_matchday`, `win_result`, `win_result_02`, `win_matchday`, `win_season`, `points_mode`, `points_result`, `points_tendency`, `points_diff`, `points_last`, `join_by_user`, `join_in_season`, `bet_in_time`, `rules_post_id`, `sort`, `bet_ko_type`, `bet_points`, `bet_type`) VALUES (2027, 1, '1. Tippliga Würzburg', '1TL', 1, 39, 12, '0', '0', '0', '0', 4, 3, 1, 2, 0, 0, 0, 0, 561, 0, 1, 0.00, 0);
|
||||
INSERT INTO `phpbb_footb_leagues` (`season`, `league`, `league_name`, `league_name_short`, `league_type`, `matchdays`, `matches_on_matchday`, `win_result`, `win_result_02`, `win_matchday`, `win_season`, `points_mode`, `points_result`, `points_tendency`, `points_diff`, `points_last`, `join_by_user`, `join_in_season`, `bet_in_time`, `rules_post_id`, `sort`, `bet_ko_type`, `bet_points`, `bet_type`) VALUES (2027, 2, '2. Tippliga Würzburg', '2TL', 1, 39, 12, '0', '0', '0', '0', 4, 3, 1, 2, 0, 0, 0, 0, 561, 0, 1, 0.00, 0);
|
||||
INSERT INTO `phpbb_footb_leagues` (`season`, `league`, `league_name`, `league_name_short`, `league_type`, `matchdays`, `matches_on_matchday`, `win_result`, `win_result_02`, `win_matchday`, `win_season`, `points_mode`, `points_result`, `points_tendency`, `points_diff`, `points_last`, `join_by_user`, `join_in_season`, `bet_in_time`, `rules_post_id`, `sort`, `bet_ko_type`, `bet_points`, `bet_type`) VALUES (2027, 45, 'Supercup', 'SC', 2, 1, 0, '0', '0', '0', '0', 4, 3, 1, 2, 0, 0, 0, 1, 561, 0, 1, 0.00, 0);
|
||||
INSERT INTO `phpbb_footb_leagues` (`season`, `league`, `league_name`, `league_name_short`, `league_type`, `matchdays`, `matches_on_matchday`, `win_result`, `win_result_02`, `win_matchday`, `win_season`, `points_mode`, `points_result`, `points_tendency`, `points_diff`, `points_last`, `join_by_user`, `join_in_season`, `bet_in_time`, `rules_post_id`, `sort`, `bet_ko_type`, `bet_points`, `bet_type`) VALUES (2027, 47, 'Relegation', 'REL', 2, 1, 0, '0', '0', '0', '0', 4, 3, 1, 2, 0, 0, 0, 1, 561, 0, 1, 0.00, 1);
|
||||
INSERT INTO `phpbb_footb_leagues` (`season`, `league`, `league_name`, `league_name_short`, `league_type`, `matchdays`, `matches_on_matchday`, `win_result`, `win_result_02`, `win_matchday`, `win_season`, `points_mode`, `points_result`, `points_tendency`, `points_diff`, `points_last`, `join_by_user`, `join_in_season`, `bet_in_time`, `rules_post_id`, `sort`, `bet_ko_type`, `bet_points`, `bet_type`) VALUES (2027, 48, 'WTL-Pokal', 'WTL', 2, 5, 0, '0', '0', '0', '0', 4, 3, 1, 2, 0, 0, 0, 0, 561, 0, 1, 0.00, 0);
|
||||
INSERT INTO `phpbb_footb_leagues` (`season`, `league`, `league_name`, `league_name_short`, `league_type`, `matchdays`, `matches_on_matchday`, `win_result`, `win_result_02`, `win_matchday`, `win_season`, `points_mode`, `points_result`, `points_tendency`, `points_diff`, `points_last`, `join_by_user`, `join_in_season`, `bet_in_time`, `rules_post_id`, `sort`, `bet_ko_type`, `bet_points`, `bet_type`) VALUES (2027, 51, '1. Tippliga Würzburg', '1TL', 1, 39, 7, '0', '0', '0', '0', 1, 0, 0, 0, 1, 0, 0, 0, 561, 0, 1, 0.00, 0);
|
||||
INSERT INTO `phpbb_footb_leagues` (`season`, `league`, `league_name`, `league_name_short`, `league_type`, `matchdays`, `matches_on_matchday`, `win_result`, `win_result_02`, `win_matchday`, `win_season`, `points_mode`, `points_result`, `points_tendency`, `points_diff`, `points_last`, `join_by_user`, `join_in_season`, `bet_in_time`, `rules_post_id`, `sort`, `bet_ko_type`, `bet_points`, `bet_type`) VALUES (2027, 52, '2. Tippliga Würzburg', '2TL', 1, 39, 7, '0', '0', '0', '0', 1, 0, 0, 0, 1, 0, 0, 0, 561, 0, 1, 0.00, 0);
|
||||
INSERT INTO `phpbb_footb_leagues` (`season`, `league`, `league_name`, `league_name_short`, `league_type`, `matchdays`, `matches_on_matchday`, `win_result`, `win_result_02`, `win_matchday`, `win_season`, `points_mode`, `points_result`, `points_tendency`, `points_diff`, `points_last`, `join_by_user`, `join_in_season`, `bet_in_time`, `rules_post_id`, `sort`, `bet_ko_type`, `bet_points`, `bet_type`) VALUES (2027, 95, 'Supercup', 'SC', 2, 2, 0, '0', '0', '0', '0', 1, 0, 0, 0, 1, 0, 0, 0, 561, 0, 1, 0.00, 0);
|
||||
INSERT INTO `phpbb_footb_leagues` (`season`, `league`, `league_name`, `league_name_short`, `league_type`, `matchdays`, `matches_on_matchday`, `win_result`, `win_result_02`, `win_matchday`, `win_season`, `points_mode`, `points_result`, `points_tendency`, `points_diff`, `points_last`, `join_by_user`, `join_in_season`, `bet_in_time`, `rules_post_id`, `sort`, `bet_ko_type`, `bet_points`, `bet_type`) VALUES (2027, 97, 'Relegation', 'REL', 2, 1, 0, '0', '0', '0', '0', 1, 0, 0, 0, 1, 0, 0, 0, 561, 0, 1, 0.00, 0);
|
||||
INSERT INTO `phpbb_footb_leagues` (`season`, `league`, `league_name`, `league_name_short`, `league_type`, `matchdays`, `matches_on_matchday`, `win_result`, `win_result_02`, `win_matchday`, `win_season`, `points_mode`, `points_result`, `points_tendency`, `points_diff`, `points_last`, `join_by_user`, `join_in_season`, `bet_in_time`, `rules_post_id`, `sort`, `bet_ko_type`, `bet_points`, `bet_type`) VALUES (2027, 98, 'WTL-Pokal', 'WTL', 2, 6, 0, '0', '0', '0', '0', 1, 0, 0, 0, 1, 0, 0, 0, 561, 0, 1, 0.00, 0);
|
||||
@@ -0,0 +1,152 @@
|
||||
{
|
||||
"numberOfMatchdays": 5,
|
||||
"matchesPerMatchday": 0,
|
||||
"pointMode": 4,
|
||||
"pointsTendency": 1,
|
||||
"pointsDifference": 2,
|
||||
"pointsDirectHit": 3,
|
||||
"ko": 1,
|
||||
"matchdayConfig": [
|
||||
{
|
||||
"TLWMatchday": 1,
|
||||
"matchdayName": "1. Runde",
|
||||
"numberOfMatches": 32,
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 81,
|
||||
"leagueMatchday": 1,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "Placeholder",
|
||||
"placeholderDatetime": "2026-08-21 18:00:00"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 2,
|
||||
"numberOfMatches": 16,
|
||||
"matchdayName": "Achtelfinale",
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 81,
|
||||
"leagueMatchday": 2,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "Placeholder",
|
||||
"placeholderDatetime": "2026-10-27 18:00:00"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 3,
|
||||
"numberOfMatches": 8,
|
||||
"matchdayName": "Viertelfinale",
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 81,
|
||||
"leagueMatchday": 3,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "Placeholder",
|
||||
"placeholderDatetime": "2026-12-01 18:30:00"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 4,
|
||||
"numberOfMatches": 4,
|
||||
"matchdayName": "Halbfinale",
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 81,
|
||||
"leagueMatchday": 4,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "Placeholder",
|
||||
"placeholderDatetime": "2027-02-02 18:30:00"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TLWMatchday": 5,
|
||||
"numberOfMatches": 6,
|
||||
"matchdayName": "Finale",
|
||||
"matchesConfig": [
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 81,
|
||||
"leagueMatchday": 5,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 81,
|
||||
"leagueMatchday": 5,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 81,
|
||||
"leagueMatchday": 6,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "AllMatchesOfMatchday",
|
||||
"matchesLeague": 81,
|
||||
"leagueMatchday": 6,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "PlaceholderSingleMatch",
|
||||
"koMatch": true,
|
||||
"placeholderDatetime": "2027-04-20 20:45:00",
|
||||
"formulaHome": "D",
|
||||
"formulaGuest": "D"
|
||||
},
|
||||
{
|
||||
"type": "PlaceholderSingleMatch",
|
||||
"koMatch": true,
|
||||
"placeholderDatetime": "2027-04-20 20:45:00",
|
||||
"formulaHome": "D",
|
||||
"formulaGuest": "D"
|
||||
},
|
||||
{
|
||||
"type": "PlaceholderSingleMatch",
|
||||
"koMatch": true,
|
||||
"placeholderDatetime": "2027-04-21 20:45:00",
|
||||
"formulaHome": "D",
|
||||
"formulaGuest": "D"
|
||||
},
|
||||
{
|
||||
"type": "PlaceholderSingleMatch",
|
||||
"koMatch": true,
|
||||
"placeholderDatetime": "2027-04-21 20:45:00",
|
||||
"formulaHome": "D",
|
||||
"formulaGuest": "D"
|
||||
},
|
||||
{
|
||||
"type": "PlaceholderSingleMatch",
|
||||
"koMatch": true,
|
||||
"placeholderDatetime": "2027-05-29 20:00:00",
|
||||
"formulaHome": "W 61",
|
||||
"formulaGuest": "W 63"
|
||||
},
|
||||
{
|
||||
"type": "PlaceholderSingleMatch",
|
||||
"koMatch": true,
|
||||
"placeholderDatetime": "2027-05-29 20:00:00",
|
||||
"formulaHome": "W 62",
|
||||
"formulaGuest": "W 64"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"1": "Matthias",
|
||||
"2": "Marcel U.",
|
||||
"3": "Marcel",
|
||||
"4": "Dustin",
|
||||
"5": "Johannes",
|
||||
"6": "Tristan",
|
||||
"7": "Philipp",
|
||||
"8": "Nicole",
|
||||
"9": "Barb",
|
||||
"10": "TG Nürnberg",
|
||||
"11": "Marcel W.",
|
||||
"12": "Maxi Z.",
|
||||
"13": "Olli L.",
|
||||
"14": "Lukas",
|
||||
"15": "Jimmy",
|
||||
"16": "Franz",
|
||||
"17": "Armin",
|
||||
"18": "Demian",
|
||||
"19": "Hilde",
|
||||
"20": "Kay",
|
||||
"21": "Patrick",
|
||||
"22": "Flo",
|
||||
"23": "Stefan",
|
||||
"24": "Max"
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
UPDATE phpbb_footb_matchdays SET status = 0 WHERE season = 2027 AND status > 0;
|
||||
UPDATE phpbb_footb_matches SET status = 0 WHERE season = 2027 AND status > 0;
|
||||
@@ -0,0 +1,14 @@
|
||||
package de.jeyp91;
|
||||
|
||||
import org.json.simple.JSONObject;
|
||||
import org.junit.Test;
|
||||
|
||||
public class S3ProviderTest {
|
||||
|
||||
@Test
|
||||
public void getFixturesFromS3Test() {
|
||||
S3Provider prov = new S3Provider();
|
||||
JSONObject rounds = prov.getFixturesJSONFromS3(2026, 1240);
|
||||
System.out.println(rounds.toJSONString());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package de.jeyp91;
|
||||
import de.jeyp91.apifootball.APIFootballMatch;
|
||||
import de.jeyp91.teamidmatcher.TeamIDMatcher;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class TeamIDMatcherTest {
|
||||
|
||||
@Test
|
||||
public void getAPIFootballIdFromTippligaIdTest() {
|
||||
int apiFootballId;
|
||||
|
||||
apiFootballId = TeamIDMatcher.getApiFootballIdFromTippligaId(505);
|
||||
assertEquals(80, apiFootballId);
|
||||
apiFootballId = TeamIDMatcher.getApiFootballIdFromTippligaId(160);
|
||||
assertEquals(91, apiFootballId);
|
||||
apiFootballId = TeamIDMatcher.getApiFootballIdFromTippligaId(182);
|
||||
assertEquals(12754, apiFootballId);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getTippligaIdFromAPIFootballIdTest() throws Exception {
|
||||
int tlwId;
|
||||
String jsonMatch = "{" +
|
||||
"\"fixture_id\":1," +
|
||||
"\"league_id\":1240," +
|
||||
"\"league\":{" +
|
||||
"\"name\":\"Testliga\"" +
|
||||
"}," +
|
||||
"\"event_date\":\"2020-01-01T00:00:00+02:00\"" +
|
||||
"\"round\":\"Bayern - 1\"," +
|
||||
"\"statusShort\":\"FT\"" +
|
||||
"\"homeTeam\":{" +
|
||||
"\"team_id\":9330," +
|
||||
"\"team_name\":\"TestHome\"" +
|
||||
"}," +
|
||||
"\"awayTeam\":{" +
|
||||
"\"team_id\":9331," +
|
||||
"\"team_name\":\"TestGuest\"" +
|
||||
"}" +
|
||||
"}";
|
||||
JSONObject matchObject;
|
||||
JSONParser jsonParser = new JSONParser();
|
||||
matchObject = (JSONObject) jsonParser.parse(jsonMatch);
|
||||
APIFootballMatch match = new APIFootballMatch(matchObject, 2021);
|
||||
|
||||
match.teamIdHome = 80;
|
||||
tlwId = TeamIDMatcher.getTippligaIdFromApiFootballId(match, TeamIDMatcher.HOME);
|
||||
assertEquals(505, tlwId);
|
||||
match.teamIdHome = 91;
|
||||
tlwId = TeamIDMatcher.getTippligaIdFromApiFootballId(match, TeamIDMatcher.HOME);
|
||||
assertEquals(160, tlwId);
|
||||
match.teamIdHome = 12754;
|
||||
tlwId = TeamIDMatcher.getTippligaIdFromApiFootballId(match, TeamIDMatcher.HOME);
|
||||
assertEquals(182, tlwId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package de.jeyp91.apifootball;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class APIFootballConnectorTest {
|
||||
/*
|
||||
@Test
|
||||
public void APITestGetMatchDataOfMatchdayBundesliga() {
|
||||
APIFootballConnector apiFootballConnector = APIFootballConnector.getAPIFootballConnectorInstance(2020);
|
||||
ArrayList<APIFootballMatch> matchesOfMatchday = apiFootballConnector.getMatchDataByLeagueAndMatchday(2677, 1);
|
||||
assert matchesOfMatchday.get(0).getTeamIdHome() == 744;
|
||||
assert matchesOfMatchday.get(0).getTeamIdGuest() == 159;
|
||||
}
|
||||
*/
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package de.jeyp91.apifootball;
|
||||
|
||||
import org.json.simple.JSONObject;
|
||||
import org.junit.Test;
|
||||
|
||||
import static de.jeyp91.apifootball.APIFootballConnector.stringToJSONObject;
|
||||
|
||||
public class APIFootballMatchTest {
|
||||
/*
|
||||
@Test
|
||||
public void withExtratime() throws Exception {
|
||||
String matchString = "{\"fixture_id\":958530,\"league_id\":4303,\"league\":{\"name\":\"DFB Pokal\",\"country\":\"Germany\",\"logo\":\"https:\\/\\/media-3.api-sports.io\\/football\\/leagues\\/81.png\",\"flag\":\"https:\\/\\/media-1.api-sports.io\\/flags\\/de.svg\"},\"event_date\":\"2022-10-19T18:00:00+02:00\",\"event_timestamp\":1666195200,\"firstHalfStart\":1666195200,\"secondHalfStart\":1666198800,\"round\":\"2nd Round\",\"status\":\"Match Finished\",\"statusShort\":\"PEN\",\"elapsed\":120,\"venue\":\"Home Deluxe Arena\",\"referee\":\"Frank Willenborg, Germany\",\"homeTeam\":{\"team_id\":185,\"team_name\":\"SC Paderborn 07\",\"logo\":\"https:\\/\\/media-2.api-sports.io\\/football\\/teams\\/185.png\"},\"awayTeam\":{\"team_id\":162,\"team_name\":\"Werder Bremen\",\"logo\":\"https:\\/\\/media-3.api-sports.io\\/football\\/teams\\/162.png\"},\"goalsHomeTeam\":2,\"goalsAwayTeam\":2,\"score\":{\"halftime\":\"2-0\",\"fulltime\":\"2-2\",\"extratime\":\"0-0\",\"penalty\":\"5-4\"}}";
|
||||
JSONObject matchJson = stringToJSONObject(matchString);
|
||||
APIFootballMatch match = new APIFootballMatch(matchJson, 2023);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withoutExtratime() throws Exception {
|
||||
String matchString = "{\"fixture_id\":958530,\"league_id\":4303,\"league\":{\"name\":\"DFB Pokal\",\"country\":\"Germany\",\"logo\":\"https:\\/\\/media-3.api-sports.io\\/football\\/leagues\\/81.png\",\"flag\":\"https:\\/\\/media-1.api-sports.io\\/flags\\/de.svg\"},\"event_date\":\"2022-10-19T18:00:00+02:00\",\"event_timestamp\":1666195200,\"firstHalfStart\":1666195200,\"secondHalfStart\":1666198800,\"round\":\"2nd Round\",\"status\":\"Match Finished\",\"statusShort\":\"PEN\",\"elapsed\":120,\"venue\":\"Home Deluxe Arena\",\"referee\":\"Frank Willenborg, Germany\",\"homeTeam\":{\"team_id\":185,\"team_name\":\"SC Paderborn 07\",\"logo\":\"https:\\/\\/media-2.api-sports.io\\/football\\/teams\\/185.png\"},\"awayTeam\":{\"team_id\":162,\"team_name\":\"Werder Bremen\",\"logo\":\"https:\\/\\/media-3.api-sports.io\\/football\\/teams\\/162.png\"},\"goalsHomeTeam\":2,\"goalsAwayTeam\":2,\"score\":{\"halftime\":\"2-0\",\"fulltime\":\"2-2\",\"extratime\":null,\"penalty\":null}}";
|
||||
JSONObject matchJson = stringToJSONObject(matchString);
|
||||
APIFootballMatch match = new APIFootballMatch(matchJson, 2023);
|
||||
}
|
||||
*/
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package de.jeyp91.apifootball;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class APIFootballUpdaterTest {
|
||||
|
||||
int season = 2027;
|
||||
/*
|
||||
@Test
|
||||
public void checkErrorsTest() {
|
||||
String rateLimitError = "{\"results\":0,\"errors\":{\"rateLimit\":\"Too many requests. Your rate limit is 10 requests per minute.\"}}";
|
||||
APIFootballUpdater updater = new APIFootballUpdater();
|
||||
try {
|
||||
updater.checkErrors("https://test.url/api", rateLimitError);
|
||||
} catch (Exception e) {
|
||||
System.out.println(e.getMessage());
|
||||
assert e.getMessage().equals("https://test.url/api returned error: '{\"rateLimit\":\"Too many requests. Your rate limit is 10 requests per minute.\"}'");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateFixturesTest() {
|
||||
APIFootballUpdater updater = new APIFootballUpdater();
|
||||
updater.updateFixtures(season, 218);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateAllFixturesTest() {
|
||||
APIFootballUpdater updater = new APIFootballUpdater();
|
||||
updater.updateAllFixtures(season);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateRoundsTest() {
|
||||
APIFootballUpdater updater = new APIFootballUpdater();
|
||||
// updater.updateRounds(2777);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateAllRoundsTest() {
|
||||
APIFootballUpdater updater = new APIFootballUpdater();
|
||||
updater.updateAllRounds(season);
|
||||
}
|
||||
*/
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user