myMPD
Internal API documentation
Loading...
Searching...
No Matches
api_vars.c File Reference

Variables API functions. More...

#include "compile_time.h"
#include "src/scripts/api_vars.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/list/sort.h"
#include "src/lib/log.h"
#include "src/lib/sds/sds_extras.h"
#include "src/lib/sds/sds_file.h"
#include <errno.h>
Include dependency graph for api_vars.c:

Functions

static sds var_to_line_cb (sds buffer, struct t_list_node *current, bool newline)
bool scripts_vars_delete (struct t_list *script_var_list, sds key)
bool scripts_vars_save (struct t_list *script_var_list, sds key, sds value)
bool scripts_vars_file_read (struct t_list *script_var_list, sds workdir)
bool scripts_vars_file_save (struct t_list *script_var_list, sds workdir)
sds scripts_vars_list (struct t_list *script_var_list, sds buffer, unsigned request_id)

Detailed Description

Variables API functions.

Function Documentation

◆ scripts_vars_delete()

bool scripts_vars_delete ( struct t_list * script_var_list,
sds key )

Deletes a variable in the list

Parameters
script_var_listpointer to script var list
keykey 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_listpointer to script var list
workdirworking 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_listpointer to script var list
workdirworking 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_listpointer to script var list
bufferbuffer to append the response
request_idjsonrpc 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_listpointer to script var list
keyname of the variable
valuevalue of the variable
Returns
true on success, else false

◆ var_to_line_cb()

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
bufferbuffer to append the line
currentlist node to print
newlineappend a newline char
Returns
pointer to buffer