this commit is a lie
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
// much faster than file()
|
||||
$lines = explode(
|
||||
"\n",
|
||||
str_replace(
|
||||
["\r\n", "\r"],
|
||||
"\n",
|
||||
file_get_contents('championships.txt')
|
||||
)
|
||||
);
|
||||
|
||||
$location = "Unknown";
|
||||
$championships_by_time = [];
|
||||
|
||||
// get the data into a per-event format
|
||||
foreach ($lines as $line) {
|
||||
$line = trim($line);
|
||||
if (empty($line)) continue;
|
||||
|
||||
if (str_contains($line, ":")) {
|
||||
$day_and_times = explode(": ", $line);
|
||||
$day = trim($day_and_times[0]);
|
||||
foreach (explode(",", trim($day_and_times[1])) as $time) {
|
||||
$championships_by_time[] = [$day, trim($time), $location];
|
||||
}
|
||||
}
|
||||
else {
|
||||
$location = str_replace(["The ", " Championship"], "", $line);
|
||||
}
|
||||
}
|
||||
|
||||
// native JS expects dates in this format
|
||||
$days = [
|
||||
'Monday' => 1,
|
||||
'Tuesday' => 2,
|
||||
'Wednesday' => 3,
|
||||
'Thursday' => 4,
|
||||
'Friday' => 5,
|
||||
'Saturday' => 6,
|
||||
'Sunday' => 0,
|
||||
];
|
||||
|
||||
$championships_by_days = [];
|
||||
|
||||
foreach ($championships_by_time as $championship) {
|
||||
[$day_raw, $time_raw, $location] = $championship;
|
||||
|
||||
$day = $days[$day_raw];
|
||||
|
||||
$time_components = explode(':', $time_raw);
|
||||
$time = 60*intval($time_components[0]) + intval($time_components[1]);
|
||||
|
||||
if (!isset($championships_by_days[$day])) {
|
||||
$championships_by_days[$day] = [];
|
||||
}
|
||||
|
||||
$championships_by_days[$day][$time] = $location;
|
||||
}
|
||||
|
||||
// optional, but it's compile time so sorting doesn't really hurt performance
|
||||
foreach ($championships_by_days as $key => $_value) { ksort($championships_by_days[$key]); }
|
||||
|
||||
$json = json_encode($championships_by_days, JSON_PRETTY_PRINT) . "\n";
|
||||
file_put_contents("championships.json", $json);
|
||||
@@ -0,0 +1,61 @@
|
||||
This is just a sample, and it might be updated!
|
||||
|
||||
The Firgrove Championship
|
||||
|
||||
Monday: 03:30, 09:30, 15:30, 21:30
|
||||
Tuesday: 03:00, 09:00, 15:00, 21:00
|
||||
Wednesday: 02:30, 08:30, 14:30, 20:30
|
||||
Thursday: 02:00, 08:00, 12:00, 14:00, 20:00
|
||||
Friday: 01:00, 07:00, 13:00, 19:00
|
||||
Saturday: 00:00, 06:00, 10:00, 15:00, 19:00
|
||||
Sunday: 04:00, 09:00, 17:30, 23:00
|
||||
|
||||
The Fort Pinta Championship
|
||||
|
||||
Monday: 00:30, 04:30, 08:30, 12:30, 16:30, 18:00, 20:30
|
||||
Tuesday: 00:00, 04:00, 08:00, 12:00, 16:00, 20:00
|
||||
Wednesday: 03:30, 07:30, 11:30, 15:30, 19:30, 23:30
|
||||
Thursday: 03:00, 07:00, 11:00, 15:00, 19:00, 23:00
|
||||
Friday: 02:00, 06:00, 10:00, 14:00, 18:00, 22:00
|
||||
Saturday: 01:30, 07:30, 12:00, 16:30, 21:00
|
||||
Sunday: 00:30, 05:00, 06:30, 11:00, 15:30, 20:00
|
||||
|
||||
The Jorvik Stables Championship
|
||||
|
||||
Monday: 02:30, 07:00, 14:30, 22:30
|
||||
Tuesday: 02:00, 06:30, 14:00, 22:00
|
||||
Wednesday: 01:30, 06:00, 13:30, 21:30
|
||||
Thursday: 01:00, 05:30, 13:00, 21:00
|
||||
Friday: 00:00, 04:30, 12:00, 15:30, 20:00
|
||||
Saturday: 03:30, 06:30, 10:30, 17:30, 19:30
|
||||
Sunday: 02:30, 09:30, 14:00, 18:30
|
||||
|
||||
The Moorland Championship
|
||||
|
||||
Monday: 00:00, 04:00, 08:00, 12:00, 16:00, 20:00
|
||||
Tuesday: 03:30, 07:30, 11:30, 15:30, 19:30, 23:30
|
||||
Wednesday: 03:00, 07:00, 11:00, 15:00, 17:00, 19:00, 23:00
|
||||
Thursday: 02:30, 06:30, 10:30, 14:30, 18:30, 22:30
|
||||
Friday: 01:30, 05:30, 09:30, 13:30, 17:30, 21:30
|
||||
Saturday: 01:00, 07:00, 11:30, 16:00, 20:30
|
||||
Sunday: 00:00, 04:30, 06:00, 10:30, 15:00, 19:30
|
||||
|
||||
The Silversong Pony Championship
|
||||
|
||||
Monday: 01:00, 05:00, 09:00, 13:00, 17:00, 21:00
|
||||
Tuesday: 00:30, 04:30, 08:30, 12:30, 16:30, 20:30
|
||||
Wednesday: 00:00, 04:00, 08:00, 12:00, 16:00, 20:00
|
||||
Thursday: 03:30, 07:30, 11:30, 15:30, 19:30, 23:30
|
||||
Friday: 02:30, 06:30, 10:30, 14:30, 16:30, 18:30, 22:30
|
||||
Saturday: 02:00, 08:00, 12:30, 17:00, 21:30
|
||||
Sunday: 01:00, 05:30, 07:00, 11:30, 16:00, 20:30
|
||||
|
||||
The Silverglade Village Championship
|
||||
|
||||
Monday: 03:00, 07:30, 13:30, 17:30, 19:30
|
||||
Tuesday: 02:30, 07:00, 17:00, 19:00
|
||||
Wednesday: 02:00, 06:30, 16:30, 18:30
|
||||
Thursday: 01:30, 06:00, 16:00, 18:00
|
||||
Friday: 00:30, 05:00, 15:00, 17:00
|
||||
Saturday: 04:00, 05:30, 14:00, 18:00, 23:00
|
||||
Sunday: 03:00, 13:00, 18:00, 22:00
|
||||
Reference in New Issue
Block a user