Skip to content

Commit

Permalink
rename 'external commands' into 'hooks' (#2400)
Browse files Browse the repository at this point in the history
  • Loading branch information
aler9 authored Sep 23, 2023
1 parent 3a7d86e commit cadc6b3
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**
Expand Down
2 changes: 1 addition & 1 deletion apidocs/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ components:
rpiCameraTextOverlay:
type: string

# External commands
# Hooks
runOnInit:
type: string
runOnInitRestart:
Expand Down
6 changes: 3 additions & 3 deletions internal/conf/path.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion internal/core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down
2 changes: 1 addition & 1 deletion mediamtx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit cadc6b3

Please sign in to comment.