添加自动拉流功能

This commit is contained in:
dexter
2021-12-26 15:59:08 +08:00
parent 9d98f5b8dd
commit 7b96cf8d8e
2 changed files with 58 additions and 1 deletions

View File

@@ -18,8 +18,9 @@ var config struct {
ListenAddrTLS string
CertFile string
KeyFile string
AutoPullList map[string]string
}
var streamPathReg = regexp.MustCompile("/(hdl/)?((.+)(\\.flv)|(.+))")
var streamPathReg = regexp.MustCompile(`/(hdl/)?((.+)(\.flv)|(.+))`)
func init() {
InstallPlugin(&PluginConfig{
@@ -37,6 +38,11 @@ func run() {
utils.Print(Green("HDL start reuse gateway port"))
http.HandleFunc("/hdl/", HDLHandler)
}
for streamPath, url := range config.AutoPullList {
if err := PullStream(streamPath, url); err != nil {
utils.Println(err)
}
}
}
func HDLHandler(w http.ResponseWriter, r *http.Request) {