mirror of
https://github.com/Monibuca/plugin-hdl.git
synced 2025-10-05 00:42:45 +08:00
refactor: remove some stupid code
This commit is contained in:
18
main.go
18
main.go
@@ -20,22 +20,20 @@ type HDLConfig struct {
|
|||||||
config.Pull
|
config.Pull
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func pull(streamPath, url string) {
|
||||||
|
if err := HDLPlugin.Pull(streamPath, url, NewHDLPuller(), 0); err != nil {
|
||||||
|
HDLPlugin.Error("pull", zap.String("streamPath", streamPath), zap.String("url", url), zap.Error(err))
|
||||||
|
}
|
||||||
|
}
|
||||||
func (c *HDLConfig) OnEvent(event any) {
|
func (c *HDLConfig) OnEvent(event any) {
|
||||||
switch v := event.(type) {
|
switch v := event.(type) {
|
||||||
case FirstConfig:
|
case FirstConfig:
|
||||||
for streamPath, url := range c.PullOnStart {
|
for streamPath, url := range c.PullOnStart {
|
||||||
if err := HDLPlugin.Pull(streamPath, url, NewHDLPuller(), 0); err != nil {
|
pull(streamPath, url)
|
||||||
HDLPlugin.Error("pull", zap.String("streamPath", streamPath), zap.String("url", url), zap.Error(err))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
case *Stream: //按需拉流
|
case *Stream: //按需拉流
|
||||||
for streamPath, url := range c.PullOnSub {
|
if url, ok := c.PullOnSub[v.Path]; ok {
|
||||||
if streamPath == v.Path {
|
pull(v.Path, url)
|
||||||
if err := HDLPlugin.Pull(streamPath, url, NewHDLPuller(), 0); err != nil {
|
|
||||||
HDLPlugin.Error("pull", zap.String("streamPath", streamPath), zap.String("url", url), zap.Error(err))
|
|
||||||
}
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user