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

Smart playlist generation. More...

#include "compile_time.h"
#include "src/mympd_worker/smartpls.h"
#include "src/lib/config/mympd_mpd_state.h"
#include "src/lib/datetime.h"
#include "src/lib/filehandler.h"
#include "src/lib/json/json_query.h"
#include "src/lib/log.h"
#include "src/lib/sds/sds_extras.h"
#include "src/lib/sds/sds_file.h"
#include "src/lib/smartpls.h"
#include "src/lib/validate.h"
#include "src/mympd_client/database.h"
#include "src/mympd_client/errorhandler.h"
#include "src/mympd_client/playlists.h"
#include "src/mympd_client/search.h"
#include "src/mympd_client/shortcuts.h"
#include "src/mympd_client/stickerdb.h"
#include <dirent.h>
#include <errno.h>
#include <inttypes.h>
#include <limits.h>
#include <mpd/tag.h>
#include <string.h>
Include dependency graph for smartpls.c:

Functions

static bool mympd_worker_smartpls_per_tag (struct t_mympd_worker_state *mympd_worker_state)
static bool mympd_worker_smartpls_update_search (struct t_mympd_worker_state *mympd_worker_state, const char *playlist, const char *expression, const char *sort, bool sortdesc, unsigned max_entries)
static bool mympd_worker_smartpls_update_sticker (struct t_mympd_worker_state *mympd_worker_state, const char *playlist, const char *sticker, const char *value, const char *op, const char *sort, bool sort_desc, unsigned max_entries)
static bool mympd_worker_smartpls_update_newest (struct t_mympd_worker_state *mympd_worker_state, const char *playlist, unsigned timerange, const char *sort, bool sortdesc, unsigned max_entries)
bool mympd_worker_smartpls_update_all (struct t_mympd_worker_state *mympd_worker_state, bool force)
bool mympd_worker_smartpls_update (struct t_mympd_worker_state *mympd_worker_state, const char *playlist)

Detailed Description

Smart playlist generation.

Function Documentation

◆ mympd_worker_smartpls_per_tag()

bool mympd_worker_smartpls_per_tag ( struct t_mympd_worker_state * mympd_worker_state)
static

Private definitions

Private functions Generates smart playlists for tag values, e.g. one smart playlist for each genre

Parameters
mympd_worker_statepointer to the t_mympd_worker_state struct
Returns
true on success, else false

◆ mympd_worker_smartpls_update()

bool mympd_worker_smartpls_update ( struct t_mympd_worker_state * mympd_worker_state,
const char * playlist )

Updates a smart playlist

Parameters
mympd_worker_statepointer to the t_mympd_worker_state struct
playlistsmart playlist to update
Returns
true on success, else false

◆ mympd_worker_smartpls_update_all()

bool mympd_worker_smartpls_update_all ( struct t_mympd_worker_state * mympd_worker_state,
bool force )

Public functions Updates all smart playlists

Parameters
mympd_worker_statepointer to the t_mympd_worker_state struct
forcetrue = force update false = only update if needed
Returns
true on success, else false

◆ mympd_worker_smartpls_update_newest()

bool mympd_worker_smartpls_update_newest ( struct t_mympd_worker_state * mympd_worker_state,
const char * playlist,
unsigned timerange,
const char * sort,
bool sortdesc,
unsigned max_entries )
static

Updates a newest song smart playlist

Parameters
mympd_worker_statepointer to the t_mympd_worker_state struct
playlistplaylist to update
timerangetimerange in seconds since last database update
sortsort by tag
sortdescsort descending?
max_entriesmax entries to add to the playlist
Returns
true on success, else false

◆ mympd_worker_smartpls_update_search()

bool mympd_worker_smartpls_update_search ( struct t_mympd_worker_state * mympd_worker_state,
const char * playlist,
const char * expression,
const char * sort,
bool sortdesc,
unsigned max_entries )
static

Updates a search based smart playlist

Parameters
mympd_worker_statepointer to the t_mympd_worker_state struct
playlistplaylist to update
expressionmpd search expression
sortsort by tag
sortdescsort descending?
max_entriesmax entries to add to the playlist
Returns
true on success, else false

◆ mympd_worker_smartpls_update_sticker()

bool mympd_worker_smartpls_update_sticker ( struct t_mympd_worker_state * mympd_worker_state,
const char * playlist,
const char * sticker,
const char * value,
const char * op,
const char * sort,
bool sort_desc,
unsigned max_entries )
static

Updates a sticker based smart playlist

Parameters
mympd_worker_statepointer to the t_mympd_worker_state struct
playlistplaylist to update
stickersticker evaluate
valuesticker value
opcompare operator
sortsort by field
sort_descsort descending?
max_entriesmax entries to add to the playlist
Returns
true on success, else false