myMPD
Internal API documentation
Loading...
Searching...
No Matches
search.h File Reference

Helper functions for MPD search. More...

#include "src/lib/album.h"
#include "src/lib/mympd_state.h"
Include dependency graph for search.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

bool mympd_client_search_add_to_plist (struct t_partition_state *partition_state, const char *expression, const char *plist, unsigned to, const char *sort, bool sortdesc, sds *error)
 
bool mympd_client_search_add_to_plist_window (struct t_partition_state *partition_state, const char *expression, const char *plist, unsigned to, const char *sort, bool sortdesc, unsigned start, unsigned end, sds *error)
 
bool mympd_client_search_add_to_queue (struct t_partition_state *partition_state, const char *expression, unsigned to, enum mpd_position_whence whence, const char *sort, bool sortdesc, sds *error)
 
bool mympd_client_search_add_to_queue_window (struct t_partition_state *partition_state, const char *expression, unsigned to, enum mpd_position_whence whence, const char *sort, bool sortdesc, unsigned start, unsigned end, sds *error)
 
bool mympd_client_add_search_sort_param (struct t_partition_state *partition_state, const char *sort, bool sortdesc)
 
bool mympd_client_add_search_group_param (struct mpd_connection *conn, enum mpd_tag_type tag)
 
bool mympd_client_add_search_window_param_mpd_025 (struct t_partition_state *partition_state, unsigned start, unsigned end)
 
sds get_search_expression_album (sds buffer, enum mpd_tag_type tag_albumartist, struct t_album *album, const struct t_albums_config *album_config)
 
sds get_search_expression_album_tag (sds buffer, enum mpd_tag_type tag_albumartist, struct t_album *album, enum mpd_tag_type tag, const char *tag_value, const struct t_albums_config *album_config)
 
sds escape_mpd_search_expression (sds buffer, const char *tag, const char *operator, const char *value)
 

Detailed Description

Helper functions for MPD search.

Function Documentation

◆ escape_mpd_search_expression()

sds escape_mpd_search_expression ( sds  buffer,
const char *  tag,
const char *  operator,
const char *  value 
)

Escapes a mpd search expression

Parameters
bufferalready allocated sds string to append
tagsearch tag
operatorsearch operator
valuesearch value
Returns
pointer to buffer

◆ get_search_expression_album()

sds get_search_expression_album ( sds  buffer,
enum mpd_tag_type  tag_albumartist,
struct t_album album,
const struct t_albums_config album_config 
)

Creates a mpd search expression to find all songs in an album

Parameters
bufferBuffer to set the search expression
tag_albumartistalbumartist tag
albumthe album
album_configalbum configuration
Returns
Pointer to buffer

◆ get_search_expression_album_tag()

sds get_search_expression_album_tag ( sds  buffer,
enum mpd_tag_type  tag_albumartist,
struct t_album album,
enum mpd_tag_type  tag,
const char *  tag_value,
const struct t_albums_config album_config 
)

Creates a mpd search expression to find all songs of specified disc of an album

Parameters
bufferBuffer to set the search expression
tag_albumartistalbumartist tag
albumthe album
tagMPD tag
tag_valueMPD tag value
album_configalbum configuration
Returns
Pointer to buffer

◆ mympd_client_add_search_group_param()

bool mympd_client_add_search_group_param ( struct mpd_connection *  conn,
enum mpd_tag_type  tag 
)

Adds the group parameter to the search command. Ignores MPD_TAG_UNKNOWN.

Parameters
connmpd connection
taggroup tag to add
Returns
true on success or on MPD_TAG_UNKNOWN, else false

◆ mympd_client_add_search_sort_param()

bool mympd_client_add_search_sort_param ( struct t_partition_state partition_state,
const char *  sort,
bool  sortdesc 
)

Adds the sort parameter to the search command

Parameters
partition_statepointer to partition state
sorttag to sort
sortdescdescending sort in reverse order?
Returns
true on success, else false

◆ mympd_client_add_search_window_param_mpd_025()

bool mympd_client_add_search_window_param_mpd_025 ( struct t_partition_state partition_state,
unsigned  start,
unsigned  end 
)

Adds the window parameter to the search command. Ignores the parameter if MPD < 0.25.0.

Parameters
partition_statepointer to partition state
startStart of the range (including)
endEnd of the range (excluding), use UINT_MAX for open end
Returns
true on success or on MPD < 0.25.0, else false

◆ mympd_client_search_add_to_plist()

bool mympd_client_search_add_to_plist ( struct t_partition_state partition_state,
const char *  expression,
const char *  plist,
unsigned  to,
const char *  sort,
bool  sortdesc,
sds *  error 
)

Searches the mpd database for songs by expression and adds the result to a playlist

Parameters
partition_statepointer to partition specific states
expressionmpd search expression
plistplaylist to create or to append the result
toposition to insert the songs, UINT_MAX to append
sorttag to sort
sortdescfalse = ascending, true = descending
errorpointer to already allocated sds string for the error message or NULL to return no response
Returns
true on success else false

◆ mympd_client_search_add_to_plist_window()

bool mympd_client_search_add_to_plist_window ( struct t_partition_state partition_state,
const char *  expression,
const char *  plist,
unsigned  to,
const char *  sort,
bool  sortdesc,
unsigned  start,
unsigned  end,
sds *  error 
)

Searches the mpd database for songs by expression and adds the result to a playlist

Parameters
partition_statepointer to partition specific states
expressionmpd search expression
plistplaylist to create or to append the result
toposition to insert the songs, UINT_MAX to append
sorttag to sort
sortdescfalse = ascending, true = descending
startwindow start (including)
endwindow end (excluding), UINT_MAX for open end
errorpointer to already allocated sds string for the error message or NULL to return no response
Returns
true on success else false

◆ mympd_client_search_add_to_queue()

bool mympd_client_search_add_to_queue ( struct t_partition_state partition_state,
const char *  expression,
unsigned  to,
enum mpd_position_whence  whence,
const char *  sort,
bool  sortdesc,
sds *  error 
)

Searches the mpd database for songs by expression and adds the result to the queue

Parameters
partition_statepointer to partition specific states
expressionmpd search expression
toposition to insert the songs, UINT_MAX to append
whenceenum mpd_position_whence: 0 = MPD_POSITION_ABSOLUTE 1 = MPD_POSITION_AFTER_CURRENT 2 = MPD_POSITION_BEFORE_CURRENT
sorttag to sort
sortdescfalse = ascending, true = descending
errorpointer to already allocated sds string for the error message or NULL to return no response
Returns
true on success else false

◆ mympd_client_search_add_to_queue_window()

bool mympd_client_search_add_to_queue_window ( struct t_partition_state partition_state,
const char *  expression,
unsigned  to,
enum mpd_position_whence  whence,
const char *  sort,
bool  sortdesc,
unsigned  start,
unsigned  end,
sds *  error 
)

Searches the mpd database for songs by expression and adds the result window to the queue

Parameters
partition_statepointer to partition specific states
expressionmpd search expression
toposition to insert the songs, UINT_MAX to append
whenceenum mpd_position_whence: 0 = MPD_POSITION_ABSOLUTE 1 = MPD_POSITION_AFTER_CURRENT 2 = MPD_POSITION_BEFORE_CURRENT
sorttag to sort
sortdescfalse = ascending, true = descending
startStart of the range (including)
endEnd of the range (excluding), use UINT_MAX for open end
errorpointer to already allocated sds string for the error message or NULL to return no response
Returns
true on success else false