コード例 #1
0
static TWindow *open_playlist(ttk_menu_item *item)
{
	if (mpdc_tickle() < 0)
		return TTK_MENU_DONOTHING;
	mpd_sendClearCommand(mpdz);
	mpd_finishCommand(mpdz);

	mpd_sendLoadCommand(mpdz, (char *)item->name);
	mpd_finishCommand(mpdz);
	if (mpdz->error) {
		mpdc_tickle();
		return TTK_MENU_DONOTHING;
	}
	mpd_sendPlayCommand(mpdz, -1);
	mpd_finishCommand(mpdz);

	return mpd_currently_playing();
}
コード例 #2
0
ファイル: libmpd-playlist.c プロジェクト: AndTH/Theremin
int mpd_playlist_clear(MpdObj *mi)
{
	if(!mpd_check_connected(mi))
	{
		debug_printf(DEBUG_WARNING,"not connected\n");
		return MPD_NOT_CONNECTED;
	}
	if(mpd_lock_conn(mi))
	{
		debug_printf(DEBUG_WARNING,"lock failed\n");
		return MPD_LOCK_FAILED;
	}

	mpd_sendClearCommand(mi->connection);
	mpd_finishCommand(mi->connection);
	/* hack to make it update correctly when replacing 1 song */
	mi->CurrentState.songid = -1;
	/* unlock */
	mpd_unlock_conn(mi);
	mpd_status_update(mi);
	return FALSE;
}