Update MensaParser for new Mensa website #24

Merged
Seil0 merged 3 commits from fix-mensaparser into master 2022-12-22 15:38:20 +01:00
Showing only changes of commit 795ddc516d - Show all commits

View File

@ -77,29 +77,21 @@ class StartupController {
val properties = Properties() val properties = Properties()
properties.loadFromXML(FileInputStream(fileConfig)) properties.loadFromXML(FileInputStream(fileConfig))
cachetAPIKey = try { try {
properties.getProperty("cachetAPIKey") cachetAPIKey = properties.getProperty("cachetAPIKey")
} catch (ex: Exception) { } catch (_: Exception) {}
"0"
}
cachetBaseURL = try { try {
properties.getProperty("cachetBaseURL") cachetBaseURL = properties.getProperty("cachetBaseURL")
} catch (ex: Exception) { } catch (_: Exception) {}
"https://status.mosad.xyz"
}
mensaMenuURL = try { try {
properties.getProperty("mensaMenuURL") mensaMenuURL = properties.getProperty("mensaMenuURL")
} catch (ex: Exception) { } catch (_: Exception) {}
"https://www.swfr.de/essen-trinken/speiseplaene/mensa-offenburg/"
}
mensaName = try { try {
properties.getProperty("mensaName") mensaName = properties.getProperty("mensaName")
} catch (ex: Exception) { } catch (_: Exception) {}
"Offenburg"
}
} catch (ex: Exception) { } catch (ex: Exception) {
logger.error("error while loading config", ex) logger.error("error while loading config", ex)
@ -111,10 +103,10 @@ class StartupController {
private fun createConfig() = try { private fun createConfig() = try {
val properties = Properties() val properties = Properties()
properties.setProperty("cachetAPIKey", "0") properties.setProperty("cachetAPIKey", cachetAPIKey)
properties.setProperty("cachetBaseURL", "https://status.mosad.xyz") properties.setProperty("cachetBaseURL", cachetBaseURL)
properties.setProperty("mensaMenuURL", "https://www.swfr.de/essen-trinken/speiseplaene/mensa-offenburg/") properties.setProperty("mensaMenuURL", mensaMenuURL)
properties.setProperty("mensaName", "Offenburg") properties.setProperty("mensaName", mensaName)
val outputStream = FileOutputStream(fileConfig) val outputStream = FileOutputStream(fileConfig)
properties.storeToXML(outputStream, "tcor configuration") properties.storeToXML(outputStream, "tcor configuration")