Unmaintained - Unofficial API for http://summacollege.xedule.nl
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
1.8 KiB

package main
import (
_ "expvar"
To do:
+WeekSchedule.BaseUts // UnixTimeStamp of the first second in the week
+event.Start, event.End <- No Uts but amount of seconds since start of day.
+Fixed time zone stuff
+?nocache=true // Does not look for cache, but does update it of course.
lastupdate and weeks have got their own attendee in cache, can't they share it?
func main() {
err := misc.LoadConfig(misc.CfgFilename)
if err != nil {
// Don't exit program on error. Without a database this application can still
// preform some tasks (WeekSchedule without attendee types).
lid := flag.Int("update-attendees", 0,
"Location Id of which the attendees should be fetched and updated in database.")
if *lid > 0 {
err := attendee.Update(*lid)
if err != nil {
fmt.Println("Error:", err)
go wsched.RunCache()
go weeks.Run()
go lastupdate.Run()
http.HandleFunc("/schedule.json", handlers.WSched)
http.HandleFunc("/weeks.json", handlers.Weeks)
http.HandleFunc("/attendee.json", handlers.Attendee)
http.HandleFunc("/lastupdate.json", handlers.LastUpdate)
http.HandleFunc("/", func(w http.ResponseWriter, _ *http.Request) {
log.Println(http.ListenAndServe(misc.Cfg().Http.Addr, nil))