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

WebradioDB update functions. More...

#include "compile_time.h"
#include "src/mympd_worker/webradiodb.h"
#include "dist/mongoose/mongoose.h"
#include "dist/rax/rax.h"
#include "src/lib/api.h"
#include "src/lib/filehandler.h"
#include "src/lib/http_client/http_client.h"
#include "src/lib/json/json_query.h"
#include "src/lib/log.h"
#include "src/lib/msg_queue.h"
#include "src/lib/sds/sds_extras.h"
#include "src/lib/webradio.h"
Include dependency graph for webradiodb.c:

Functions

static bool parse_webradiodb (sds str, struct t_webradios *webradiodb)
static bool icb_webradio_alternate (const char *path, sds key, sds value, enum json_vtype vtype, validate_callback vcb, void *userdata, struct t_json_parse_error *error)
static struct t_webradio_dataparse_webradiodb_data (sds str)
bool mympd_worker_webradiodb_update (struct t_mympd_worker_state *mympd_worker_state, bool force)

Detailed Description

WebradioDB update functions.

Function Documentation

◆ icb_webradio_alternate()

bool icb_webradio_alternate ( const char * path,
sds key,
sds value,
enum json_vtype vtype,
validate_callback vcb,
void * userdata,
struct t_json_parse_error * error )
static

Iteration callback function to parse the alternate webradio streams

Parameters
pathjson path
keynot used
valuevalue to parse as mpd tag
vtypemjson value type
vcbnot used - we validate directly
userdatavoid pointer to t_tags struct
errorpointer to t_json_parse_error
Returns
true on success else false

◆ mympd_worker_webradiodb_update()

bool mympd_worker_webradiodb_update ( struct t_mympd_worker_state * mympd_worker_state,
bool force )

Updates the WebradioDB from the cloud

Parameters
mympd_worker_statempd worker state
forcetrue = force update, false = update only if database is outdated
Returns
true on success, else false

◆ parse_webradiodb()

bool parse_webradiodb ( sds str,
struct t_webradios * webradiodb )
static

Parses the downloaded webradios.min.json

Parameters
strstring to parse
webradiodbwebradios struct to populate
Returns
true on success, else false

◆ parse_webradiodb_data()

struct t_webradio_data * parse_webradiodb_data ( sds str)
static

Parses a webradioDB entry

Parameters
strstring to parse
Returns
struct t_webradio_data*