Skip to main content

Push_auto_add

Push_Auto_Add

This call is similar in workings to the push_start call (see that call for details), with the following changes:

Pushes are only started for currently active (active meaning they have at least one sessions attached to them of any type) streams matching the request, and only if no matching push is already active. As such, duplicate pushes will not be created by this call. Should a push target contain a variable that changes the push_ID and target before parsing will be used.

Any matching streams that become active in the future, will upon activation also start a push as requested here, until the automatic push is removed again (using the "push_auto_remove" call.

If a push stops while the stream is still active, it will be restarted if allowed by the automatic push settings.

This behaviour can be be made different by setting a scheduletime and completetime or through a start_rule and end_rule. The scheduletime and completetime combination will start when the scheduletime has been met and will stop when the completetime has been reached. Once a this stream can no longer activate it will delete itself from the configuration.

The start_rule and end_rule combination allows the use of any of MistServers variables to determine when a stream should start. When the start_rule conditions have been reached the push will start. When the end_rule has been reached the push will stop. If both conditions are valid the end_rule will override the start_rule.

push_auto_add works as follows:

{
"push_auto_add": {
"71d6b51b668e1f24973def9210cb5644": { //auto_push_ID generated if not provided
"stream": "mylivestream", //Stream name or #Tag that should be checked for pushing
"target": "/tmp/$stream/$yday_$datetime.mkv", //stream url or file location to push/record towards
"x-LSP-notes": "notes go here!", //Optional field for notes visible in the push panel
"start_rule":["hour",11,9],
"end_rule":["hour",11,17]
},
"f10ye10uhfadf7s89dfh2312312fhjsf": { //auto_push_ID generated if not provided
"stream": "#tagname", //Stream name or #Tag that should be checked for pushing
"target": "/tmp/$stream/$yday_$datetime.mkv", //stream url or file location to push/record towards
"x-LSP-notes": "notes go here!", //Optional field for notes visible in the push panel
"scheduletime":1744880400, //start time in unix
"completetime":1744909200 //end time in unix
},
//Etcetera
},
},
}

Required fields:

  • stream // String containing stream name or tag
  • target // String containing push target

Optional fields:

  • x-LSP-notes // String with notes
  • scheduletime // unix time in seconds the recording should start
  • completetime // unix time in seconds the recording should end
  • start_rule // Array with 3 values, 1: variable name, 2: variable operator, 3: variable value
  • end_rule // Array with 3 values, 1: variable name, 2: variable operator, 3: variable value
info

Start and end rule will require some explanation.

  • Variable name: This should be the name of the variable known to MistServer, that can be from [variable substitutions][variables] or a [custom variable][customvariable]. Do not add the $ sign.
  • Variable operator: Requires a corresponding number from the operator list
  • Variable value: This can be anything from a value to a string of values. Whether it makes sense is up to whatever the variable name value is. example: Variable hour gives the corresponding current server time hour from 0-23
`"start_rule":["hour",11,9]`,
`"end_rule":["hour",11,17]` ,

Would have the push be active from 9:00 to 17:00 (9:00 am to 5:00 pm)

Converted fields

  • startVariableName, startVariableOperator, startVariableValue will be converted into start_rule for backwards compatibility
  • endVariableName, endVariableOperator, endVariableValue will be converted into end_rule for backwards compatibility
  • scheduletime & completetime will be converted to an integer should they not already be one.

Any other value will be ignored for future compatibility.

Operator list

0: boolean true
1: boolean false
2: ==
3: !=
10: > (numerical comparison)
11: >= (numerical comparison)
12: < (numerical comparison)
13: <= (numerical comparison)
20 > (lexical comparison)
21: >= (lexical comparison)
22: < (lexical comparison)
23: <= (lexical comparison)

Deprecated style for MistServer versions 3.5.1 and under

The main difference here is that there's no auto_push_ID.

//Either...
{
"push_auto_add":{
"stream": "STREAMNAME",
"target": "URI",
"scheduletime": 1234567, //Unix timestamp when the push process should be started, optional
"completetime": 1234567 //Unix timestamp when the push process should be terminated, optional
}
}
//Or...
{
//Same parameters as above, in order
//the scheduletime and completetime are both optional
"push_auto_add":["STREAMNAME", "URI", 1234567, 1234567]
}

There is no response to this call.