Browse Source

Smol updates

Daniel 2 years ago
parent
commit
04298d4498
5 changed files with 53 additions and 34 deletions
  1. BIN
      EuroScope.ttf
  2. 5 3
      Schedule.php
  3. 6 1
      Tuesday.jpg.php
  4. BIN
      UbuntuMono-Bold.ttf
  5. 42 30
      config.php

BIN
EuroScope.ttf


+ 5 - 3
Schedule.php

@@ -37,6 +37,7 @@ class Schedule {
         $this->wantedstations = $wantedstations;
         $this->improps = [];
         $this->darkmode = $darkmode;
+        //$this->debug = true;
     }
     
     public function createImage() {
@@ -125,7 +126,7 @@ class Schedule {
         }
 
         $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, 200, $height, $this->improps['event'], $this->improps['font'], 'Event');
         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]);
 
         return $this->image;
-
     }
     
     private function addBookingData($station, $date, $bookings, $x, $height) {
@@ -179,7 +179,9 @@ class Schedule {
     }
 
     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_setopt($curl, CURLOPT_URL, $url ) ;
         curl_setopt($curl, CURLOPT_HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]);

+ 6 - 1
Tuesday.jpg.php

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

BIN
UbuntuMono-Bold.ttf


+ 42 - 30
config.php

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