MpdData * mpd_database_get_artists(MpdObj *mi) { char *string = NULL; MpdData *data = NULL; if(!mpd_check_connected(mi)) { debug_printf(DEBUG_WARNING,"not connected\n"); return NULL; } if(mpd_lock_conn(mi)) { debug_printf(DEBUG_ERROR,"lock failed\n"); return NULL; } mpd_sendListCommand(mi->connection,MPD_TABLE_ARTIST,NULL); while (( string = mpd_getNextArtist(mi->connection)) != NULL) { data = mpd_new_data_struct_append(data); data->type = MPD_DATA_TYPE_TAG; data->tag_type = MPD_TAG_ITEM_ARTIST; data->tag = string; } mpd_finishCommand(mi->connection); /* unlock */ mpd_unlock_conn(mi); if(data == NULL) { return NULL; } data = mpd_misc_sort_tag_list(data); return mpd_data_get_first(data); }
QStringList MPDConnection::artists() const { ASSERT; QStringList ret; for (char *a; (a = mpd_getNextArtist(d->connection)) != NULL; ) { ret << QString::fromUtf8(a); } return ret; }