예제 #1
0
파일: mpd.c 프로젝트: mattx86/aprq2
/*
=================
MPD_Play - start playback
=================
*/
void MPD_Play(void)
{
	if(!MP3_Status())
		return;

	if(Cmd_Argc() == 2)	// User gave song id to play
		mpd_sendPlayIdCommand(conn, atoi(Cmd_Argv(1))-1);
	else
		mpd_sendPlayCommand(conn, -1);

	mpd_finishCommand(conn);

	MPD_Status();
}
예제 #2
0
int mpd_player_play_id(MpdObj * mi, int id)
{
	debug_printf(DEBUG_INFO, "trying to play id: %i\n", id);
	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_sendPlayIdCommand(mi->connection, id);
	mpd_finishCommand(mi->connection);


	mpd_unlock_conn(mi);
	if (mpd_status_update(mi)) {
		return MPD_STATUS_FAILED;
	}
	return MPD_OK;
}