Get titles from DB
This commit is contained in:
parent
6b8a1444df
commit
9dc2c7d9d0
1 changed files with 53 additions and 42 deletions
|
@ -108,6 +108,18 @@ public class Main {
|
|||
}
|
||||
|
||||
private static String createOutput(String user) {
|
||||
List<String> title = new ArrayList<>();
|
||||
try {
|
||||
ResultSet rsu = MariaDB.load_user(user);
|
||||
if (rsu != null) {
|
||||
while (rsu.next()) {
|
||||
title.add(rsu.getString("title"));
|
||||
}
|
||||
}
|
||||
rsu.close();
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
JSONObject dat = new JSONObject();
|
||||
Date updatetime = new Date(time);
|
||||
dat.put("interval", conf.getInt("refreshTime") * 1000);
|
||||
|
@ -150,7 +162,7 @@ public class Main {
|
|||
display.put(monitor1);
|
||||
|
||||
JSONObject monitor2 = new JSONObject();
|
||||
monitor2.put("label",conf.getString("monitors.monitor1.Title"));
|
||||
monitor2.put("label", title.get(0));
|
||||
monitor2.put("labelColor", conf.getString("labelcolor"));
|
||||
monitor2.put("fullDraw", true);
|
||||
int zug1 = udata.get(user).get("1");
|
||||
|
@ -158,7 +170,7 @@ public class Main {
|
|||
display.put(monitor2);
|
||||
|
||||
JSONObject monitor3 = new JSONObject();
|
||||
monitor3.put("label",conf.getString("monitors.monitor2.Title"));
|
||||
monitor3.put("label", title.get(1));
|
||||
monitor3.put("labelColor", conf.getString("labelcolor"));
|
||||
monitor3.put("fullDraw", true);
|
||||
int zug2 = udata.get(user).get("2");
|
||||
|
@ -166,7 +178,7 @@ public class Main {
|
|||
display.put(monitor3);
|
||||
|
||||
JSONObject monitor4 = new JSONObject();
|
||||
monitor4.put("label",conf.getString("monitors.monitor3.Title"));
|
||||
monitor4.put("label", title.get(2));
|
||||
monitor4.put("labelColor", conf.getString("labelcolor"));
|
||||
monitor4.put("fullDraw", true);
|
||||
int zug3 = udata.get(user).get("3");
|
||||
|
@ -174,14 +186,13 @@ public class Main {
|
|||
display.put(monitor4);
|
||||
|
||||
JSONObject monitor5 = new JSONObject();
|
||||
monitor5.put("label",conf.getString("monitors.monitor4.Title"));
|
||||
monitor5.put("label", title.get(3));
|
||||
monitor5.put("labelColor", conf.getString("labelcolor"));
|
||||
monitor5.put("fullDraw", true);
|
||||
int zug4 = udata.get(user).get("4");
|
||||
makeLabel(monitor5, zug4);
|
||||
display.put(monitor5);
|
||||
dat.put("displays", display);
|
||||
System.out.println(display);
|
||||
return dat.toString();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue