From cadc6b3ea7060e7ffe74cbe55cef198896e718ed Mon Sep 17 00:00:00 2001 From: Alessandro Ros Date: Sat, 23 Sep 2023 12:49:08 +0200 Subject: [PATCH] rename 'external commands' into 'hooks' (#2400) --- README.md | 2 +- apidocs/openapi.yaml | 2 +- internal/conf/path.go | 6 +++--- internal/core/core.go | 2 +- mediamtx.yml | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index d1f01467..8a12e06a 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ And can be read from the server with: * Query and control the server through the API * Reload the configuration without disconnecting existing clients (hot reloading) * 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 **Note about rtsp-simple-server** diff --git a/apidocs/openapi.yaml b/apidocs/openapi.yaml index ad1f9955..e391aa94 100644 --- a/apidocs/openapi.yaml +++ b/apidocs/openapi.yaml @@ -320,7 +320,7 @@ components: rpiCameraTextOverlay: type: string - # External commands + # Hooks runOnInit: type: string runOnInitRestart: diff --git a/internal/conf/path.go b/internal/conf/path.go index d4156f96..c7199bb4 100644 --- a/internal/conf/path.go +++ b/internal/conf/path.go @@ -107,7 +107,7 @@ type PathConf struct { RPICameraTextOverlayEnable bool `json:"rpiCameraTextOverlayEnable"` RPICameraTextOverlay string `json:"rpiCameraTextOverlay"` - // External commands + // Hooks RunOnInit string `json:"runOnInit"` RunOnInitRestart bool `json:"runOnInitRestart"` 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 { 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.RPICameraTextOverlay = "%Y-%m-%d %H:%M:%S - MediaMTX" - // External commands + // Hooks pconf.RunOnDemandStartTimeout = 10 * StringDuration(time.Second) pconf.RunOnDemandCloseAfter = 10 * StringDuration(time.Second) diff --git a/internal/core/core.go b/internal/core/core.go index dde413a0..c75eaa96 100644 --- a/internal/core/core.go +++ b/internal/core/core.go @@ -769,7 +769,7 @@ func (p *Core) closeResources(newConf *conf.Conf, calledByAPI bool) { } 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() } diff --git a/mediamtx.yml b/mediamtx.yml index 39b6b754..8a55b85a 100644 --- a/mediamtx.yml +++ b/mediamtx.yml @@ -448,7 +448,7 @@ paths: rpiCameraTextOverlay: '%Y-%m-%d %H:%M:%S - MediaMTX' ############################################### - # External commands path settings + # Hooks path settings # Command to run when this path is initialized. # This can be used to publish a stream when the server is launched.