MCPcopy Create free account
hub / github.com/Monibuca/engine / Push

Method Push

plugin.go:326–351  ·  view source on GitHub ↗
(streamPath string, url string, pusher IPusher, save bool)

Source from the content-addressed store, hash-verified

324var Pushers sync.Map
325
326func (opt *Plugin) Push(streamPath string, url string, pusher IPusher, save bool) (err error) {
327 zp, zu := zap.String("stream", streamPath), zap.String("url", url)
328 opt.Info("push", zp, zu)
329 defer func() {
330 if err != nil {
331 opt.Error("push faild", zap.Error(err))
332 }
333 }()
334 conf, ok := opt.Config.(config.PushConfig)
335 if !ok {
336 return ErrNoPushConfig
337 }
338 pushConfig := conf.GetPushConfig()
339 pusher.init(streamPath, url, pushConfig)
340 pusher.SetLogger(opt.Logger.With(zp, zu))
341 opt.AssignSubConfig(pusher.GetSubscriber())
342 go pusher.startPush(pusher)
343 if save {
344 pushConfig.AddPush(url, streamPath)
345 opt.RawConfig.Get("push").Get("pushlist").Modify = pushConfig.PushList
346 if err = opt.Save(); err != nil {
347 opt.Error("save faild", zap.Error(err))
348 }
349 }
350 return
351}

Callers

nothing calls this directly

Calls 13

AssignSubConfigMethod · 0.95
SaveMethod · 0.95
AddPushMethod · 0.80
InfoMethod · 0.65
ErrorMethod · 0.65
GetPushConfigMethod · 0.65
initMethod · 0.65
SetLoggerMethod · 0.65
WithMethod · 0.65
GetSubscriberMethod · 0.65
startPushMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected