new
This commit is contained in:
parent
fef2ec79b8
commit
573f8fff0a
2 changed files with 12 additions and 7 deletions
9
main.go
9
main.go
|
|
@ -12,6 +12,7 @@ import (
|
||||||
"sort"
|
"sort"
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
Untis "untislogger/Untis"
|
Untis "untislogger/Untis"
|
||||||
|
|
||||||
BotStart "untislogger/Botrun"
|
BotStart "untislogger/Botrun"
|
||||||
|
|
@ -68,6 +69,7 @@ func main() {
|
||||||
<-sigChan
|
<-sigChan
|
||||||
log.Println("Shutting down...")
|
log.Println("Shutting down...")
|
||||||
}
|
}
|
||||||
|
|
||||||
func scheduleTimetableUpdate() {
|
func scheduleTimetableUpdate() {
|
||||||
prevData := make(map[string][]byte)
|
prevData := make(map[string][]byte)
|
||||||
|
|
||||||
|
|
@ -219,6 +221,7 @@ func NextRoomForTime(roomByStartTime map[string]string, current string) (string,
|
||||||
}
|
}
|
||||||
return "", "", false
|
return "", "", false
|
||||||
}
|
}
|
||||||
|
|
||||||
func NextSubjectForTime(subjectByStartTime map[string]string, current string) (string, bool) {
|
func NextSubjectForTime(subjectByStartTime map[string]string, current string) (string, bool) {
|
||||||
layout := "15:04"
|
layout := "15:04"
|
||||||
now, err := time.Parse(layout, current)
|
now, err := time.Parse(layout, current)
|
||||||
|
|
@ -243,8 +246,8 @@ func NextSubjectForTime(subjectByStartTime map[string]string, current string) (s
|
||||||
}
|
}
|
||||||
return "", false
|
return "", false
|
||||||
}
|
}
|
||||||
func NextCodeForTime(codeByStartTime map[string]string, current string) (string, bool) {
|
|
||||||
|
|
||||||
|
func NextCodeForTime(codeByStartTime map[string]string, current string) (string, bool) {
|
||||||
layout := "15:04"
|
layout := "15:04"
|
||||||
now, err := time.Parse(layout, current)
|
now, err := time.Parse(layout, current)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -267,8 +270,8 @@ func NextCodeForTime(codeByStartTime map[string]string, current string) (string,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "", false
|
return "", false
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func MapTimeToRoom(path string) (map[string]string, error) {
|
func MapTimeToRoom(path string) (map[string]string, error) {
|
||||||
data, err := os.ReadFile(path)
|
data, err := os.ReadFile(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -287,6 +290,7 @@ func MapTimeToRoom(path string) (map[string]string, error) {
|
||||||
}
|
}
|
||||||
return roomByStartTime, nil
|
return roomByStartTime, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func MapTimeToCode(path string) (map[string]string, error) {
|
func MapTimeToCode(path string) (map[string]string, error) {
|
||||||
data, err := os.ReadFile(path)
|
data, err := os.ReadFile(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -307,6 +311,7 @@ func MapTimeToCode(path string) (map[string]string, error) {
|
||||||
}
|
}
|
||||||
return codeByStartTime, nil
|
return codeByStartTime, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func MapTimeToSubject(path string) (map[string]string, error) {
|
func MapTimeToSubject(path string) (map[string]string, error) {
|
||||||
data, err := os.ReadFile(path)
|
data, err := os.ReadFile(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
BIN
untislogger
BIN
untislogger
Binary file not shown.
Loading…
Reference in a new issue