39 lines
694 B
Go
39 lines
694 B
Go
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))
|
|
}
|