mirror of
https://github.com/Monibuca/plugin-hdl.git
synced 2025-10-04 16:32:42 +08:00
添加自动拉流功能
This commit is contained in:
8
main.go
8
main.go
@@ -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) {
|
||||
|
Reference in New Issue
Block a user