Scripts API functions.
More...
#include "dist/sds/sds.h"
#include "src/lib/list.h"
#include "src/scripts/util.h"
#include <stdbool.h>
Go to the source code of this file.
|
| bool | scripts_file_reload (struct t_scripts_state *scripts_state) |
| |
| bool | scripts_file_read (struct t_scripts_state *scripts_state) |
| |
| bool | script_save (struct t_scripts_state *scripts_state, sds scriptname, sds oldscript, sds file, int order, int version, sds content, struct t_list *arguments, sds *error) |
| |
| bool | script_delete (struct t_scripts_state *scripts_state, sds scriptname) |
| |
| sds | script_get (struct t_list *script_list, sds buffer, unsigned request_id, sds scriptname) |
| |
| sds | script_list (struct t_list *script_list, sds buffer, unsigned request_id, bool all) |
| |
◆ script_delete()
| bool script_delete |
( |
struct t_scripts_state * |
scripts_state, |
|
|
sds |
scriptname |
|
) |
| |
Deletes a script
- Parameters
-
| scripts_state | pointer to scripts_state |
| scriptname | script to delete (name without extension) |
- Returns
- true on success, else false
◆ script_get()
| sds script_get |
( |
struct t_list * |
script_list, |
|
|
sds |
buffer, |
|
|
unsigned |
request_id, |
|
|
sds |
scriptname |
|
) |
| |
Gets the script and its details
- Parameters
-
| script_list | list of scripts |
| buffer | already allocated sds string to append the response |
| request_id | jsonrpc request id |
| scriptname | scriptname to read from filesystem |
- Returns
- pointer to buffer
◆ script_list()
| sds script_list |
( |
struct t_list * |
script_list, |
|
|
sds |
buffer, |
|
|
unsigned |
request_id, |
|
|
bool |
all |
|
) |
| |
Lists scripts
- Parameters
-
| script_list | list of scripts |
| buffer | already allocated sds string to append the response |
| request_id | jsonrpc request id |
| all | true = print all scripts, false = print only scripts with order > 0 |
- Returns
- pointer to buffer
◆ script_save()
| bool script_save |
( |
struct t_scripts_state * |
scripts_state, |
|
|
sds |
scriptname, |
|
|
sds |
oldscript, |
|
|
sds |
file, |
|
|
int |
order, |
|
|
int |
version, |
|
|
sds |
content, |
|
|
struct t_list * |
arguments, |
|
|
sds * |
error |
|
) |
| |
Saves a script
- Parameters
-
| scripts_state | pointer to scripts_state |
| scriptname | scriptname |
| oldscript | old scriptname (leave empty for a new script) |
| file | imported script filename (empty for local scripts) |
| order | script list is ordered by this value |
| version | imported script version (0 for local scripts) |
| content | script content |
| arguments | arguments for the script |
| error | already allocated sds string to hold the error message |
- Returns
- true on success, else false
◆ scripts_file_read()
Reads the scripts from the scripts directory
- Parameters
-
| scripts_state | pointer to scripts_state |
- Returns
- true on success, else false
◆ scripts_file_reload()
Public functions Reload the scripts from disk.
- Parameters
-
| scripts_state | pointer to scripts_state |
- Returns
- true on success, else false