2025-03-14 13:38:42 +05:00

41 lines
691 B
Go

package main
import (
"flag"
"log"
"net/http"
_ "net/http/pprof"
"writer/internal/config"
"writer/internal/procRTSP"
)
func main() {
// Profile.
go func() {
log.Println(http.ListenAndServe("localhost:6060", nil))
}()
directory := flag.String("dir", "home/psa/GoRepository/", "directory")
flag.Parse()
// Parse camera links from YAML file into struct Cameras.
c, err := config.ParseCamerasYAML(*directory)
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(*directory, 1, link)
if err != nil {
panic(err)
}
}()
}
select {}
}