Logo Search packages:      
Sourcecode: libmpdclient version File versions  Download package

bool mpd_search_db_tags ( struct mpd_connection connection,
enum mpd_tag_type  type 
)

Obtains a list of unique tag values from the database. Constraints may be specified with mpd_search_add_tag_constraint(). Send the search command with mpd_search_commit(), and read the response items with mpd_recv_pair_tag().

Parameters:
connection the connection to MPD
type The type of the tags to search for
Returns:
true on success, false on error

Definition at line 91 of file search.c.

References mpd_connection::error, MPD_ERROR_ARGUMENT, MPD_ERROR_OOM, MPD_ERROR_STATE, mpd_search_db_tags(), and mpd_connection::request.

Referenced by mpd_search_db_tags().

{
      const char *strtype;
      int len;

      assert(connection != NULL);

      if (mpd_error_is_defined(&connection->error))
            return false;

      if (connection->request) {
            mpd_error_code(&connection->error, MPD_ERROR_STATE);
            mpd_error_message(&connection->error,
                          "search already in progress");
            return false;
      }

      strtype = mpd_tag_name(type);
      if (strtype == NULL) {
            mpd_error_code(&connection->error, MPD_ERROR_ARGUMENT);
            mpd_error_message(&connection->error,
                          "invalid type specified");
            return false;
      }

      len = 5+strlen(strtype)+1;
      connection->request = malloc(len);
      if (connection->request == NULL) {
            mpd_error_code(&connection->error, MPD_ERROR_OOM);
            return false;
      }

      snprintf(connection->request, len, "list %s", strtype);

      return true;
}


Generated by  Doxygen 1.6.0   Back to index