diff --git a/layout.css b/layout.css
index 252ce87..7db5de7 100644
--- a/layout.css
+++ b/layout.css
@@ -32,4 +32,12 @@ tr:nth-child(2n) {
.colwidth {
width: 80px;
+}
+
+.training {
+ color: #185886;
+}
+
+.event {
+ color: green;
}
\ No newline at end of file
diff --git a/sched.py b/sched.py
old mode 100644
new mode 100755
index 439e33b..7a0f219
--- a/sched.py
+++ b/sched.py
@@ -1,5 +1,9 @@
+#!/usr/bin/env python3
from vatsched import *
+import os
+# outputdirectory, filename = os.path.split(__file__) # to place in current directory
+outputdirectory = "/home/daniel/html/vatsim"
stations = [
"EDWW_CTR",
@@ -47,6 +51,8 @@ stations = [
displaydates = EveryXWeeksFromStartdate("26.02.2021", 4, 2)
#displaydates = EveryWeekday(1,2) # MONDAY = 0
-#displaydates = WholeWeek()
-createImage(displaydates, stations, 'test.jpg')
\ No newline at end of file
+createImage(displaydates, stations, outputdirectory + os.sep + 'ber-fra-shuttle.jpg')
+
+#displaydates = WholeWeek()
+#createImage(displaydates, stations, outputdirectory + os.sep + 'woche.jpg')
\ No newline at end of file
diff --git a/vatsched.py b/vatsched.py
index 53cbcdf..8d31b16 100644
--- a/vatsched.py
+++ b/vatsched.py
@@ -1,8 +1,10 @@
-import imgkit, requests
+import imgkit, requests, os
from dateutil.parser import parse
from datetime import datetime, timedelta
abbreviations = {}
+training = 0
+event = 0
def EveryXDaysFromStartdate(startdate, x, numberofdates = 1):
startdate = parse(startdate)
@@ -33,19 +35,28 @@ def WholeWeek(shift = 0):
def getDatePositionData(station, date, bookings):
- global abbreviations
+ global abbreviations, training, event
text = []
for booking in bookings[station]:
+ color1 = color2 = ""
if date.date() == booking['starts_at'].date():
abbr = booking['firstname'][:2] + booking['lastname'].split(" ")[-1][:2]
abbreviations[abbr] = booking['firstname'] + " " + booking['lastname']
- text.append(abbr + " " + booking['starts_at'].strftime("%H") + "-" + booking['ends_at'].strftime("%H"))
+ if(booking['event'] == 1):
+ color1 = ""
+ color2 = ""
+ event = 1
+ if(booking['training'] == 1):
+ color1 = ""
+ color2 = ""
+ training = 1
+ text.append(color1 + abbr + " " + booking['starts_at'].strftime("%H") + "-" + booking['ends_at'].strftime("%H") + color2)
if len(text) < 1:
text.append("--")
return "
".join(text)
def maketable(stations, displaydates, bookings):
- global abbreviations
+ global abbreviations, training, event
text = "
Stationen | " for date in displaydates: @@ -73,10 +84,22 @@ def maketable(stations, displaydates, bookings): if i > 4: text += "
---|