Unofficial TG-Timetable API for Java.
A Java library to get the current timetable from your DSBmobile account.
A very simple example to get the timetable.
TG tg = new TG("username", "password");
TimeTable timeTable = tg.getTimeTable();
Date lastChange = timeTable.getDate();
for (Table table : timeTable.getTables()) {
Date targetDate = table.getDate();
for (TableEntry tableEntry : table.getTableEntries()) {
String schoolClass = tableEntry.getSchoolClass();
String time = tableEntry.getTime();
String type = tableEntry.getType();
String subject = tableEntry.getSubject();
String replacementSubject = tableEntry.getReplacementSubject();
String room = tableEntry.getRoom();
String replacementRoom = tableEntry.getReplacementRoom();
String text = tableEntry.getText();
}
}
Some options:
- If you like to summarize the timetable, you can appand
.summarize()
behindtg.getTimeTable()
. Would look like this:TimeTable timeTable = tg.getTimeTable().summarize();
- Another option is the
.split()
methode, witch also appand behindtg.getTimeTable()
. It splits the TableEntry, if there are more then one classes in theschoolClass
field. - The third option is the
.sort()
methode. It sorts the time table alphabetic (0-9, A-Z) by the class name.
News:
TG tg = new TG("username", "password");
ArrayList<News> newsList = tg.getNews();
for (News news : newsList) {
UUID uuid = news.getUUID();
Date date = news.getDate();
String title = news.getTitle();
String text = news.getText();
}
Gradle:
dependencies {
implementation 'de.sematre.tg:TG-API:1.12'
}
Maven:
<dependency>
<groupId>de.sematre.tg</groupId>
<artifactId>TG-API</artifactId>
<version>1.12</version>
</dependency>
- 1.12
- News implementation
- 1.7 / 1.8 / 1.9 / 1.10 / 1.11
- DSBmobile-API update
- 1.6
- Add
sort()
function to TimeTable - Remove non ASCII character 0xA0 from input
- Add
- 1.5
- Add
sort()
function
- Add
- 1.4
- Dependencies update
- Charset fix
- 1.3
- Maven implementation
- 1.2
- DSBmobile-API update
- 1.1
- Java 7 compatibility
toString()
update
- 1.0
- Initial version
© Sematre 2019
Distributed under the MIT License. See LICENSE
for more information.