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

myMPD home icons API More...

#include "compile_time.h"
#include "src/mympd_api/home.h"
#include "src/lib/filehandler.h"
#include "src/lib/json/json_print.h"
#include "src/lib/json/json_rpc.h"
#include "src/lib/log.h"
#include "src/lib/sds_extras.h"
#include "src/lib/validate.h"
#include <errno.h>
Include dependency graph for home.c:

Functions

static const char * home_type_name (enum home_type type)
 
bool mympd_api_home_icon_move (struct t_list *home_list, unsigned from, unsigned to)
 
bool mympd_api_home_icon_delete (struct t_list *home_list, unsigned pos)
 
bool mympd_api_home_icon_save (struct t_list *home_list, bool replace, unsigned oldpos, sds name, sds ligature, sds bgcolor, sds color, sds image, sds cmd, struct t_list *option_list)
 
bool mympd_api_home_widget_save (struct t_list *home_list, bool replace, unsigned oldpos, enum home_type type, sds name, unsigned refresh, sds size, sds ref, struct t_list *arguments)
 
bool mympd_api_home_file_read (struct t_list *home_list, sds workdir)
 
static sds homeicon_to_line_cb (sds buffer, struct t_list_node *current, bool newline)
 
bool mympd_api_home_file_save (struct t_list *home_list, sds workdir)
 
sds mympd_api_home_icon_list (struct t_list *home_list, sds buffer, unsigned request_id)
 
sds mympd_api_home_icon_get (struct t_list *home_list, sds buffer, unsigned request_id, unsigned pos)
 

Detailed Description

myMPD home icons API

Function Documentation

◆ home_type_name()

static const char * home_type_name ( enum home_type  type)
static

Returns the string representation for the home element type

Parameters
typeHome element type
Returns
const char*

◆ homeicon_to_line_cb()

static sds homeicon_to_line_cb ( sds  buffer,
struct t_list_node current,
bool  newline 
)
static

Callback function for mympd_api_home_file_save

Parameters
bufferbuffer to append the line
currentlist node to print
newlineappend a newline char
Returns
pointer to buffer

◆ mympd_api_home_file_read()

bool mympd_api_home_file_read ( struct t_list home_list,
sds  workdir 
)

Reads the home icons from the filesystem

Parameters
home_listpointer to home list
workdirworking directory
Returns
true on success, else false

◆ mympd_api_home_file_save()

bool mympd_api_home_file_save ( struct t_list home_list,
sds  workdir 
)

Writes the home icons to the filesystem

Parameters
home_listpointer to home list
workdirworking directory
Returns
true on success, else false

◆ mympd_api_home_icon_delete()

bool mympd_api_home_icon_delete ( struct t_list home_list,
unsigned  pos 
)

Deletes a home icon in the list

Parameters
home_listpointer to home list
posposition to remove
Returns
true on success, else false

◆ mympd_api_home_icon_get()

sds mympd_api_home_icon_get ( struct t_list home_list,
sds  buffer,
unsigned  request_id,
unsigned  pos 
)

Returns a jsonrpc response with the home icon details

Parameters
home_listpointer to home list
bufferbuffer to append the response
request_idjsonrpc request id
posposition of the home icon to get
Returns
pointer to buffer

◆ mympd_api_home_icon_list()

sds mympd_api_home_icon_list ( struct t_list home_list,
sds  buffer,
unsigned  request_id 
)

Returns a jsonrpc response with all home icons

Parameters
home_listpointer to home list
bufferbuffer to append the response
request_idjsonrpc request id
Returns
pointer to buffer

◆ mympd_api_home_icon_move()

bool mympd_api_home_icon_move ( struct t_list home_list,
unsigned  from,
unsigned  to 
)

Moves a home icon in the list

Parameters
home_listpointer to home list
fromfrom pos
toto pos
Returns
true on success, else false

◆ mympd_api_home_icon_save()

bool mympd_api_home_icon_save ( struct t_list home_list,
bool  replace,
unsigned  oldpos,
sds  name,
sds  ligature,
sds  bgcolor,
sds  color,
sds  image,
sds  cmd,
struct t_list option_list 
)

Adds/replaces a home icon in the list

Parameters
home_listpointer to home list
replacetrue to replace the icon at oldpos
oldposoriginal pos of the icon
namename
ligatureligature
bgcolorbackground color
colorcolor
imageimage
cmdcommand
option_listoptions for the command
Returns
true on success, else false

◆ mympd_api_home_widget_save()

bool mympd_api_home_widget_save ( struct t_list home_list,
bool  replace,
unsigned  oldpos,
enum home_type  type,
sds  name,
unsigned  refresh,
sds  size,
sds  ref,
struct t_list arguments 
)

Adds/replaces a home widget in the list

Parameters
home_listPointer to home list
replaceReplace the icon at oldpos?
oldposOriginal pos of the widget
typeType of the home widget
nameWidget name
refreshRefresh interval
sizeWidget size
refName of script or link for iframe
argumentsScript arguments
Returns
true on success, else false