Browse Source

rename 'external commands' into 'hooks' (#2400)

pull/2401/head
Alessandro Ros 3 years ago committed by GitHub
parent
commit
cadc6b3ea7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      README.md
  2. 2
      apidocs/openapi.yaml
  3. 6
      internal/conf/path.go
  4. 2
      internal/core/core.go
  5. 2
      mediamtx.yml

2
README.md

@ -54,7 +54,7 @@ And can be read from the server with:
* Query and control the server through the API * Query and control the server through the API
* Reload the configuration without disconnecting existing clients (hot reloading) * Reload the configuration without disconnecting existing clients (hot reloading)
* Read Prometheus-compatible metrics * Read Prometheus-compatible metrics
* Run external commands (hooks) when clients connect, disconnect, read or publish streams * Run hooks (external commands) when clients connect, disconnect, read or publish streams
* Compatible with Linux, Windows and macOS, does not require any dependency or interpreter, it's a single executable * Compatible with Linux, Windows and macOS, does not require any dependency or interpreter, it's a single executable
**Note about rtsp-simple-server** **Note about rtsp-simple-server**

2
apidocs/openapi.yaml

@ -320,7 +320,7 @@ components:
rpiCameraTextOverlay: rpiCameraTextOverlay:
type: string type: string
# External commands # Hooks
runOnInit: runOnInit:
type: string type: string
runOnInitRestart: runOnInitRestart:

6
internal/conf/path.go

@ -107,7 +107,7 @@ type PathConf struct {
RPICameraTextOverlayEnable bool `json:"rpiCameraTextOverlayEnable"` RPICameraTextOverlayEnable bool `json:"rpiCameraTextOverlayEnable"`
RPICameraTextOverlay string `json:"rpiCameraTextOverlay"` RPICameraTextOverlay string `json:"rpiCameraTextOverlay"`
// External commands // Hooks
RunOnInit string `json:"runOnInit"` RunOnInit string `json:"runOnInit"`
RunOnInitRestart bool `json:"runOnInitRestart"` RunOnInitRestart bool `json:"runOnInitRestart"`
RunOnDemand string `json:"runOnDemand"` RunOnDemand string `json:"runOnDemand"`
@ -362,7 +362,7 @@ func (pconf *PathConf) check(conf *Conf, name string) error {
} }
} }
// External commands // Hooks
if pconf.RunOnInit != "" && pconf.Regexp != nil { if pconf.RunOnInit != "" && pconf.Regexp != nil {
return fmt.Errorf("a path with a regular expression does not support option 'runOnInit'; use another path") return fmt.Errorf("a path with a regular expression does not support option 'runOnInit'; use another path")
@ -451,7 +451,7 @@ func (pconf *PathConf) UnmarshalJSON(b []byte) error {
pconf.RPICameraAfSpeed = "normal" pconf.RPICameraAfSpeed = "normal"
pconf.RPICameraTextOverlay = "%Y-%m-%d %H:%M:%S - MediaMTX" pconf.RPICameraTextOverlay = "%Y-%m-%d %H:%M:%S - MediaMTX"
// External commands // Hooks
pconf.RunOnDemandStartTimeout = 10 * StringDuration(time.Second) pconf.RunOnDemandStartTimeout = 10 * StringDuration(time.Second)
pconf.RunOnDemandCloseAfter = 10 * StringDuration(time.Second) pconf.RunOnDemandCloseAfter = 10 * StringDuration(time.Second)

2
internal/core/core.go

@ -769,7 +769,7 @@ func (p *Core) closeResources(newConf *conf.Conf, calledByAPI bool) {
} }
if newConf == nil && p.externalCmdPool != nil { if newConf == nil && p.externalCmdPool != nil {
p.Log(logger.Info, "waiting for external commands") p.Log(logger.Info, "waiting for running hooks")
p.externalCmdPool.Close() p.externalCmdPool.Close()
} }

2
mediamtx.yml

@ -448,7 +448,7 @@ paths:
rpiCameraTextOverlay: '%Y-%m-%d %H:%M:%S - MediaMTX' rpiCameraTextOverlay: '%Y-%m-%d %H:%M:%S - MediaMTX'
############################################### ###############################################
# External commands path settings # Hooks path settings
# Command to run when this path is initialized. # Command to run when this path is initialized.
# This can be used to publish a stream when the server is launched. # This can be used to publish a stream when the server is launched.

Loading…
Cancel
Save