Search for media nodes with metadata properties matching a search string.


#include <mmplayer/mmplayerclient.h>
int mm_player_search( mmplayer_hdl_t *hdl, 
                      const int media_source_id, 
                      const char *filter, 
                      const char *search_term, 
                      const int offset, 
                      int *limit, 
                      mmp_ms_node_t **media_nodes )


The mm-player connection handle
The ID of the media source to search
A JSON-formatted string listing the metadata fields to examine for values matching the search string (can be NULL to examine all fields)
The search string
The offset to start searching from within the root folder of the media source
On input, the maximum number of items requested. On output, the number of items actually found (if the function succeeded).
The media nodes found in the media source that have metadata matching the search string




Search the media source identified by media_source_id for media nodes with metadata properties matching a search string. The filter parameter lets you list which properties are examined. You can set this field to NULL to examine all properties. Otherwise, this parameter must reference a JSON-formatted string that lists the properties between square brackets:

Note: This sample string shows all available filter fields. When assigning such a string to a const char* variable in C code, be sure to escape each double quote within the string by using a backslash (\).

The search_term parameter contains the text to match; regular expressions or wildcards aren't supported so it must be an exact match.

You can set offset to make mm-player search media nodes starting from a certain index within the set of child items (i.e., contained media nodes) in the root of the media source being searched. You can also set limit to restrict how many child items can be returned.

The library allocates memory for media_nodes but it's the caller's responsibility to later deallocate that memory.


0 on success, -1 on failure