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.
42 lines
657 B
42 lines
657 B
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"git.aiterp.net/rpdata/api/model/channel"
|
|
|
|
"git.aiterp.net/rpdata/api/internal/store"
|
|
"git.aiterp.net/rpdata/api/model/log"
|
|
)
|
|
|
|
func main() {
|
|
err := store.Init()
|
|
if err != nil {
|
|
fmt.Fprintln(os.Stderr, err)
|
|
return
|
|
}
|
|
|
|
logs, err := log.List(32768)
|
|
if err != nil {
|
|
fmt.Fprintln(os.Stderr, err)
|
|
return
|
|
}
|
|
|
|
added := make(map[string]bool, 1024)
|
|
for _, log := range logs {
|
|
if added[log.Channel] {
|
|
continue
|
|
}
|
|
|
|
_, err := channel.Ensure(log.Channel, false)
|
|
if err != nil {
|
|
fmt.Fprintln(os.Stderr, log.ID, err)
|
|
continue
|
|
}
|
|
|
|
added[log.Channel] = true
|
|
|
|
fmt.Println(log.Channel, "ensured")
|
|
}
|
|
}
|