37 lines
574 B
Go
37 lines
574 B
Go
package main
|
|
|
|
import (
|
|
"log"
|
|
"net/http"
|
|
_ "net/http/pprof"
|
|
"writer/internal/config"
|
|
"writer/internal/procRTSP"
|
|
)
|
|
|
|
func main() {
|
|
// Profile.
|
|
go func() {
|
|
log.Println(http.ListenAndServe("localhost:6060", nil))
|
|
}()
|
|
|
|
// Parse camera links from YAML file into struct Cameras.
|
|
c, err := config.ParseCamerasYAML()
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
// Connect to each camera.
|
|
for _, link := range c {
|
|
log.Printf("start recording on camera: %s\n", link)
|
|
|
|
go func() {
|
|
err = procRTSP.ProcRTSP(1, link)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
}()
|
|
}
|
|
|
|
select {}
|
|
}
|