kiwimix/cmd/kiwimix-generate/main.go

40 lines
694 B
Go
Raw Normal View History

2023-06-20 21:44:50 +00:00
package main
import (
"fmt"
"io/ioutil"
ics "github.com/PuloV/ics-golang"
// _ "github.com/mattn/go-sqlite3"
)
func assertOk(e error) {
if e != nil {
panic(e)
}
}
func main() {
fmt.Println("Hello world")
icsBytes, err := ioutil.ReadFile("example.ics")
assertOk(err)
// start, end := time.Now(), time.Now().Add(12*30*24*time.Hour)
parser := ics.New()
parser.Load(string(icsBytes))
_, err = parser.GetErrors()
assertOk(err)
calendars, err := parser.GetCalendars()
assertOk(err)
events := calendars[0].GetEvents()
for _, e := range events {
fmt.Printf("%#v\n", e)
// fmt.Printf("%s on %s by %s\n", e.Summary, e.Start, e.Organizer.Cn)
}
// fmt.Print(string(f))
}