Sematre / TG-API

Unofficial TG-Timetable API for Java

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TG-API

Release Version Maven Version Build Status License

Unofficial TG-Timetable API for Java.

A Java library to get the current timetable from your DSBmobile account.

Code example

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() behind tg.getTimeTable(). Would look like this: TimeTable timeTable = tg.getTimeTable().summarize();
  • Another option is the .split() methode, witch also appand behind tg.getTimeTable(). It splits the TableEntry, if there are more then one classes in the schoolClass 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();

}

Implementation

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>

Release History

  • 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
  • 1.5
    • Add sort() function
  • 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

Dependencies

Info

© Sematre 2019

Distributed under the MIT License. See LICENSE for more information.

About

Unofficial TG-Timetable API for Java

License:MIT License


Languages

Language:Java 100.0%