Smol updates

This commit is contained in:
2022-04-25 23:40:54 +02:00
parent 303b8bc5ea
commit 04298d4498
5 changed files with 53 additions and 34 deletions

BIN
EuroScope.ttf Normal file

Binary file not shown.

View File

@@ -37,6 +37,7 @@ class Schedule {
$this->wantedstations = $wantedstations; $this->wantedstations = $wantedstations;
$this->improps = []; $this->improps = [];
$this->darkmode = $darkmode; $this->darkmode = $darkmode;
//$this->debug = true;
} }
public function createImage() { public function createImage() {
@@ -125,7 +126,7 @@ class Schedule {
} }
$height += $this->improps['lineheight'] + 5; $height += $this->improps['lineheight'] + 5;
imagefttext($this->image, 11, 0, 10, $height, $this->improps['wanted'], $this->improps['font'], 'Wanted'); //imagefttext($this->image, 11, 0, 10, $height, $this->improps['wanted'], $this->improps['font'], 'Wanted');
imagefttext($this->image, 11, 0, 100, $height, $this->improps['training'], $this->improps['font'], 'Training'); imagefttext($this->image, 11, 0, 100, $height, $this->improps['training'], $this->improps['font'], 'Training');
imagefttext($this->image, 11, 0, 200, $height, $this->improps['event'], $this->improps['font'], 'Event'); imagefttext($this->image, 11, 0, 200, $height, $this->improps['event'], $this->improps['font'], 'Event');
imagefttext($this->image, 11, 0, 300, $height, $this->improps['eventtraining'], $this->improps['font'], 'Event + Training'); imagefttext($this->image, 11, 0, 300, $height, $this->improps['eventtraining'], $this->improps['font'], 'Event + Training');
@@ -151,7 +152,6 @@ class Schedule {
$this->image = imagecrop($this->image, ['x' => 0, 'y' => 0, 'width' => $this->improps['width'], 'height' => $height+5]); $this->image = imagecrop($this->image, ['x' => 0, 'y' => 0, 'width' => $this->improps['width'], 'height' => $height+5]);
return $this->image; return $this->image;
} }
private function addBookingData($station, $date, $bookings, $x, $height) { private function addBookingData($station, $date, $bookings, $x, $height) {
@@ -179,7 +179,9 @@ class Schedule {
} }
private function fetchData() { private function fetchData() {
$url = sprintf("https://vatsim-germany.org/api/booking/atc/daterange/%s/%s", $this->displaydates[0]->format("d.m.Y"), $this->displaydates[count($this->displaydates) -1]->format("d.m.Y")); $url = sprintf("https://vatsim-germany.org/api/booking/atc/daterange/%s/%s", $this->displaydates[0]->modify("-1 day")->format("d.m.Y"), $this->displaydates[count($this->displaydates) -1]->format("d.m.Y"));
$this->displaydates[0]->modify("+1 day");
if($this->debug) echo "\nUrl: $url";
$curl = curl_init(); $curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url ) ; curl_setopt($curl, CURLOPT_URL, $url ) ;
curl_setopt($curl, CURLOPT_HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]); curl_setopt($curl, CURLOPT_HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]);

View File

@@ -3,8 +3,13 @@
require_once "Schedule.php"; require_once "Schedule.php";
require_once "config.php"; require_once "config.php";
//echo "<pre>";
$sched = new Schedule(Schedule::EveryWeekday("Tuesday", 2), $stations_berlin, $optional, $wanted, $darkmode); $sched = new Schedule(Schedule::EveryWeekday("Tuesday", 2), $stations_berlin, $optional, $wanted, $darkmode);
$image = $sched->createImage(); $image = $sched->createImage();
header("Content-Type: image/jpg"); header("Content-Type: image/jpg");
imagejpeg($image); imagejpeg($image);
//imagejpeg($image, "test23.jpg");
//echo "\n\n<img src='test23.jpg'>";

BIN
UbuntuMono-Bold.ttf Normal file

Binary file not shown.

View File

@@ -10,16 +10,20 @@ $stations = [
"EDWW_K_CTR", "EDWW_K_CTR",
"EDWW_F_CTR", "EDWW_F_CTR",
"EDMM_M_CTR", "EDMM_M_CTR",
"EDMM_H_CTR",
"EDMM_G_CTR", "EDMM_G_CTR",
"EDUU_O_CTR", "EDMM_O_CTR",
"EDUU_E_CTR", "EDUU_H_CTR",
"EDUU_P_CTR",
"EDUU_A_CTR",
"EDUU_R_CTR",
"--", "--",
"EDBB_S_APP", "EDDB_S_APP",
"EDBB_N_APP", "EDDB_N_APP",
"EDBB_U_APP", "EDDB_U_APP",
"EDBB_F_APP", "EDDB_F_APP",
"EDBB_S_DEP", "EDDB_S_DEP",
"EDBB_N_DEP", "EDDB_N_DEP",
"--", "--",
"EDDB_N_TWR", "EDDB_N_TWR",
"EDDB_S_TWR", "EDDB_S_TWR",
@@ -55,16 +59,20 @@ $stations_berlin = [
"EDWW_K_CTR", "EDWW_K_CTR",
"EDWW_F_CTR", "EDWW_F_CTR",
"EDMM_M_CTR", "EDMM_M_CTR",
"EDMM_H_CTR",
"EDMM_G_CTR", "EDMM_G_CTR",
"EDUU_O_CTR", "EDMM_O_CTR",
"EDUU_E_CTR", "EDUU_H_CTR",
"EDUU_P_CTR",
"EDUU_A_CTR",
"EDUU_R_CTR",
"--", "--",
"EDBB_S_APP", "EDDB_S_APP",
"EDBB_N_APP", "EDDB_N_APP",
"EDBB_U_APP", "EDDB_U_APP",
"EDBB_F_APP", "EDDB_F_APP",
"EDBB_S_DEP", "EDDB_S_DEP",
"EDBB_N_DEP", "EDDB_N_DEP",
"--", "--",
"EDDB_N_TWR", "EDDB_N_TWR",
"EDDB_S_TWR", "EDDB_S_TWR",
@@ -83,17 +91,21 @@ $optional = [
"EDWW_K_CTR", "EDWW_K_CTR",
"EDWW_F_CTR", "EDWW_F_CTR",
"EDMM_M_CTR", "EDMM_M_CTR",
"EDUU_O_CTR", "EDMM_O_CTR",
"EDUU_E_CTR", "EDMM_H_CTR",
"EDBB_N_APP", "EDUU_H_CTR",
"EDBB_F_APP", "EDUU_P_CTR",
"EDBB_N_DEP", "EDUU_A_CTR",
"EDDB_S_TWR", "EDUU_R_CTR",
"EDDB_N_APP",
"EDDB_F_APP",
"EDDB_N_DEP",
"EDDB_N_TWR",
"EDDB_E_GND", "EDDB_E_GND",
"EDDB_S_GND", "EDDB_N_GND",
"EDDP_F_APP", "EDDP_F_APP",
"EDDP_N_APP", "EDDP_N_APP",
"EDDP_S_TWR", "EDDP_N_TWR",
"EDDP_GND", "EDDP_GND",
"EDDP_DEL", "EDDP_DEL",
"EDDC_APP", "EDDC_APP",
@@ -106,13 +118,13 @@ $optional = [
$wantedstns = [ $wantedstns = [
'EDWW_B_CTR', 'EDWW_B_CTR',
'EDMM_G_CTR', 'EDMM_G_CTR',
'EDBB_S_APP', 'EDDB_S_APP',
'EDBB_U_APP', 'EDDB_U_APP',
'EDBB_S_DEP', 'EDDB_S_DEP',
'EDDB_N_TWR', 'EDDB_S_TWR',
'EDDB_A_GND', 'EDDB_A_GND',
'EDDB_DEL', 'EDDB_DEL',
'EDDB_N_GND' 'EDDB_S_GND'
]; ];
$wanted = Schedule::processWantedDays( $wanted = Schedule::processWantedDays(