Exemplo n.º 1
0
MpdData * mpd_database_get_albums(MpdObj *mi,char *artist)
{
	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_ALBUM,artist);
	while (( string = mpd_getNextAlbum(mi->connection)) != NULL)
	{
		data = mpd_new_data_struct_append(data);
		data->type = MPD_DATA_TYPE_TAG;
		data->tag_type = MPD_TAG_ITEM_ALBUM;
		data->tag = string;
	}
	mpd_finishCommand(mi->connection);

	/* unlock */
	mpd_unlock_conn(mi);
	if(data == NULL)
	{
		return NULL;
	}
	return mpd_data_get_first(data);
}
Exemplo n.º 2
0
QStringList MPDConnection::albums() const {
	ASSERT;
	QStringList ret;
	for (char *a; (a = mpd_getNextAlbum(d->connection)) != NULL; ) {
		ret << QString::fromUtf8(a);
	}
	return ret;
}
Exemplo n.º 3
0
static void queue_artist(ttk_menu_item *item)
{
    char *album;
    if (mpdc_tickle() < 0)
        return;
    mpd_sendListCommand(mpdz, MPD_TABLE_ALBUM, item->name);
    if (mpdz->error) {
        mpdc_tickle();
        return;
    }
    while ((album = mpd_getNextAlbum(mpdz))) {
        mpdc_queue_data(1, strdup(album), NULL, NULL);
    }
    mpd_finishCommand(mpdz);
    mpdc_queue_data(1, (void *)item->name, enqueue_album, NULL);
}