Brainfart

This commit is contained in:
genuineparts 2024-11-12 18:07:50 +01:00
parent 909754ce31
commit 19c2ab446f
2 changed files with 16 additions and 15 deletions

1
.gitignore vendored
View file

@ -37,3 +37,4 @@ build/
### Mac OS ### ### Mac OS ###
.DS_Store .DS_Store
/config/apiserver.conf /config/apiserver.conf
/logs/logfile.log

View file

@ -95,28 +95,28 @@ public class Main {
text1.put("y",120); text1.put("y",120);
text1.put("text","Abfahrten"); text1.put("text","Abfahrten");
text1.put("font",2); text1.put("font",2);
text1.put("color",conf.getInt("textcolormain")); text1.put("color",conf.getString("textcolormain"));
text1.put("background",conf.getInt("bgcolormain")); text1.put("background",conf.getString("bgcolormain"));
JSONObject text2 = new JSONObject(); JSONObject text2 = new JSONObject();
text2.put("type","text"); text2.put("type","text");
text2.put("x",120); text2.put("x",120);
text2.put("y",170); text2.put("y",170);
text2.put("text", dateFormat.format(updatetime)); text2.put("text", dateFormat.format(updatetime));
text2.put("color",conf.getInt("textcolorupdate")); text2.put("color",conf.getString("textcolorupdate"));
text2.put("font",2); text2.put("font",2);
text2.put("background",conf.getInt("bgcolormain")); text2.put("background",conf.getString("bgcolormain"));
layout.put(text2); layout.put(text2);
layout.put(text1); layout.put(text1);
monitor1.put("data",layout); monitor1.put("data",layout);
monitor1.put("labelColor",conf.getInt("textcolormain")); monitor1.put("labelColor",conf.getString("textcolormain"));
monitor1.put("color",conf.getInt("textcolormain")); monitor1.put("color",conf.getString("textcolormain"));
monitor1.put("background",conf.getInt("bgcolormain")); monitor1.put("background",conf.getString("bgcolormain"));
display.put(monitor1); display.put(monitor1);
JSONObject monitor2 = new JSONObject(); JSONObject monitor2 = new JSONObject();
monitor2.put("label",conf.getString("monitors.monitor1.Title")); monitor2.put("label",conf.getString("monitors.monitor1.Title"));
monitor2.put("labelColor",conf.getInt("labelcolor")); monitor2.put("labelColor",conf.getString("labelcolor"));
monitor2.put("fullDraw",true); monitor2.put("fullDraw",true);
int zug1 = data.get(conf.getString("monitors.monitor1.DepartureTime")); int zug1 = data.get(conf.getString("monitors.monitor1.DepartureTime"));
makeLabel(monitor2, zug1); makeLabel(monitor2, zug1);
@ -124,7 +124,7 @@ public class Main {
JSONObject monitor3 = new JSONObject(); JSONObject monitor3 = new JSONObject();
monitor3.put("label",conf.getString("monitors.monitor2.Title")); monitor3.put("label",conf.getString("monitors.monitor2.Title"));
monitor3.put("labelColor",conf.getInt("labelcolor")); monitor3.put("labelColor",conf.getString("labelcolor"));
monitor3.put("fullDraw",true); monitor3.put("fullDraw",true);
int zug2 = data.get(conf.getString("monitors.monitor2.DepartureTime")); int zug2 = data.get(conf.getString("monitors.monitor2.DepartureTime"));
makeLabel(monitor3, zug2); makeLabel(monitor3, zug2);
@ -132,7 +132,7 @@ public class Main {
JSONObject monitor4 = new JSONObject(); JSONObject monitor4 = new JSONObject();
monitor4.put("label",conf.getString("monitors.monitor3.Title")); monitor4.put("label",conf.getString("monitors.monitor3.Title"));
monitor4.put("labelColor",conf.getInt("labelcolor")); monitor4.put("labelColor",conf.getString("labelcolor"));
monitor4.put("fullDraw",true); monitor4.put("fullDraw",true);
int zug3 = data.get(conf.getString("monitors.monitor3.DepartureTime")); int zug3 = data.get(conf.getString("monitors.monitor3.DepartureTime"));
makeLabel(monitor4, zug3); makeLabel(monitor4, zug3);
@ -140,7 +140,7 @@ public class Main {
JSONObject monitor5 = new JSONObject(); JSONObject monitor5 = new JSONObject();
monitor5.put("label",conf.getString("monitors.monitor4.Title")); monitor5.put("label",conf.getString("monitors.monitor4.Title"));
monitor5.put("labelColor",conf.getInt("labelcolor")); monitor5.put("labelColor",conf.getString("labelcolor"));
monitor5.put("fullDraw",true); monitor5.put("fullDraw",true);
int zug4 = data.get(conf.getString("monitors.monitor4.DepartureTime")); int zug4 = data.get(conf.getString("monitors.monitor4.DepartureTime"));
makeLabel(monitor5, zug4); makeLabel(monitor5, zug4);
@ -151,7 +151,7 @@ public class Main {
private static void makeLabel(JSONObject Monitor, int zeit){ private static void makeLabel(JSONObject Monitor, int zeit){
if(zeit != 0){ if(zeit != 0){
Monitor.put("color",conf.getInt("textcolordelay")); Monitor.put("color",conf.getString("textcolordelay"));
if(zeit > 0 && zeit < 9999){ if(zeit > 0 && zeit < 9999){
Monitor.put("data",zeit); Monitor.put("data",zeit);
}else if(zeit == 9999){ }else if(zeit == 9999){
@ -159,11 +159,11 @@ public class Main {
}else{ }else{
Monitor.put("data","Fehler!"); Monitor.put("data","Fehler!");
} }
Monitor.put("background",conf.getInt("bgcolordelay")); Monitor.put("background",conf.getString("bgcolordelay"));
} else { } else {
Monitor.put("color",conf.getInt("textcolor")); Monitor.put("color",conf.getString("textcolor"));
Monitor.put("data","On time"); Monitor.put("data","On time");
Monitor.put("background",conf.getInt("bgcolor")); Monitor.put("background",conf.getString("bgcolor"));
} }
} }
} }