Variables API functions.
More...
#include "compile_time.h"
#include "src/scripts/api_vars.h"
#include "src/lib/filehandler.h"
#include "src/lib/json/json_print.h"
#include "src/lib/json/json_query.h"
#include "src/lib/json/json_rpc.h"
#include "src/lib/log.h"
#include "src/lib/sds_extras.h"
#include <errno.h>
◆ scripts_vars_delete()
| bool scripts_vars_delete |
( |
struct t_list * |
script_var_list, |
|
|
sds |
key |
|
) |
| |
Deletes a variable in the list
- Parameters
-
| script_var_list | pointer to script var list |
| key | key to remove |
- Returns
- true on success, else false
◆ scripts_vars_file_read()
| bool scripts_vars_file_read |
( |
struct t_list * |
script_var_list, |
|
|
sds |
workdir |
|
) |
| |
Reads the scripts variables from the filesystem
- Parameters
-
| script_var_list | pointer to script var list |
| workdir | working directory |
- Returns
- true on success, else false
◆ scripts_vars_file_save()
| bool scripts_vars_file_save |
( |
struct t_list * |
script_var_list, |
|
|
sds |
workdir |
|
) |
| |
Writes the home icons to the filesystem
- Parameters
-
| script_var_list | pointer to script var list |
| workdir | working directory |
- Returns
- true on success, else false
◆ scripts_vars_list()
| sds scripts_vars_list |
( |
struct t_list * |
script_var_list, |
|
|
sds |
buffer, |
|
|
unsigned |
request_id |
|
) |
| |
Returns a jsonrpc response with all script variables
- Parameters
-
| script_var_list | pointer to script var list |
| buffer | buffer to append the response |
| request_id | jsonrpc request id |
- Returns
- pointer to buffer
◆ scripts_vars_save()
| bool scripts_vars_save |
( |
struct t_list * |
script_var_list, |
|
|
sds |
key, |
|
|
sds |
value |
|
) |
| |
Adds/modifies a variable in the list
- Parameters
-
| script_var_list | pointer to script var list |
| key | name of the variable |
| value | value of the variable |
- Returns
- true on success, else false
◆ var_to_line_cb()
| static sds var_to_line_cb |
( |
sds |
buffer, |
|
|
struct t_list_node * |
current, |
|
|
bool |
newline |
|
) |
| |
|
static |
Callback function for mympd_api_script_vars_file_save
- Parameters
-
| buffer | buffer to append the line |
| current | list node to print |
| newline | append a newline char |
- Returns
- pointer to buffer