|
myMPD
Internal API documentation
|
Helper functions for MPD search. More...
#include "compile_time.h"#include "src/mympd_client/search.h"#include "src/lib/log.h"#include "src/lib/sds_extras.h"#include "src/mympd_client/errorhandler.h"#include "src/mympd_client/tags.h"#include <string.h>
Functions | |
| static sds | append_search_expression_album (enum mpd_tag_type tag_albumartist, struct t_album *album, const struct t_albums_config *album_config, sds expression) |
| static bool | add_search_whence_param (struct t_partition_state *partition_state, unsigned to, unsigned whence) |
| 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_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_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) |
| 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) |
| 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) |
Helper functions for MPD search.
|
static |
Adds the position parameter to the search command
| partition_state | pointer to partition state |
| to | position to insert the songs, UINT_MAX to append |
| whence | enum mpd_position_whence: 0 = MPD_POSITION_ABSOLUTE 1 = MPD_POSITION_AFTER_CURRENT 2 = MPD_POSITION_BEFORE_CURRENT |
|
static |
Creates a mpd search expression to find all songs in one album
| tag_albumartist | albumartist tag |
| album | the album |
| album_config | album configuration |
| expression | already allocated sds string to append the expression |
| sds escape_mpd_search_expression | ( | sds | buffer, |
| const char * | tag, | ||
| const char * | operator, | ||
| const char * | value | ||
| ) |
Escapes a mpd search expression
| buffer | already allocated sds string to append |
| tag | search tag |
| operator | search operator |
| value | search value |
| 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
| buffer | Buffer to set the search expression |
| tag_albumartist | albumartist tag |
| album | the album |
| album_config | album configuration |
| 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
| buffer | Buffer to set the search expression |
| tag_albumartist | albumartist tag |
| album | the album |
| tag | MPD tag |
| tag_value | MPD tag value |
| album_config | album configuration |
| 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.
| conn | mpd connection |
| tag | group tag to add |
| 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
| partition_state | pointer to partition state |
| sort | tag to sort |
| sortdesc | descending sort in reverse order? |
| 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.
| partition_state | pointer to partition state |
| start | Start of the range (including) |
| end | End of the range (excluding), use UINT_MAX for open end |
| 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
| partition_state | pointer to partition specific states |
| expression | mpd search expression |
| plist | playlist to create or to append the result |
| to | position to insert the songs, UINT_MAX to append |
| sort | tag to sort |
| sortdesc | false = ascending, true = descending |
| error | pointer to already allocated sds string for the error message or NULL to return no response |
| 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
| partition_state | pointer to partition specific states |
| expression | mpd search expression |
| plist | playlist to create or to append the result |
| to | position to insert the songs, UINT_MAX to append |
| sort | tag to sort |
| sortdesc | false = ascending, true = descending |
| start | window start (including) |
| end | window end (excluding), UINT_MAX for open end |
| error | pointer to already allocated sds string for the error message or NULL to return no response |
| 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
| partition_state | pointer to partition specific states |
| expression | mpd search expression |
| to | position to insert the songs, UINT_MAX to append |
| whence | enum mpd_position_whence: 0 = MPD_POSITION_ABSOLUTE 1 = MPD_POSITION_AFTER_CURRENT 2 = MPD_POSITION_BEFORE_CURRENT |
| sort | tag to sort |
| sortdesc | false = ascending, true = descending |
| error | pointer to already allocated sds string for the error message or NULL to return no response |
| 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
| partition_state | pointer to partition specific states |
| expression | mpd search expression |
| to | position to insert the songs, UINT_MAX to append |
| whence | enum mpd_position_whence: 0 = MPD_POSITION_ABSOLUTE 1 = MPD_POSITION_AFTER_CURRENT 2 = MPD_POSITION_BEFORE_CURRENT |
| sort | tag to sort |
| sortdesc | false = ascending, true = descending |
| start | Start of the range (including) |
| end | End of the range (excluding), use UINT_MAX for open end |
| error | pointer to already allocated sds string for the error message or NULL to return no response |