/* * Another Music Player Client * * ampc (c) 2005 Trevor Caira * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include "libmpdclient.h" #include "ampc.h" #include "mpdclient.h" #include "command.h" void my_send_command (mpdclient_t *mpdclient, command_t command) { switch (command) { case CMD_SHUFFLE: mpd_sendShuffleCommand (mpdclient->connection); break; case CMD_CLEAR: mpd_sendClearCommand (mpdclient->connection); break; case CMD_STOP: mpd_sendStopCommand (mpdclient->connection); break; case CMD_PAUSE: mpd_sendPauseCommand (mpdclient->connection, 1); break; case CMD_NEXT: mpd_sendNextCommand (mpdclient->connection); break; case CMD_PREVIOUS: mpd_sendPrevCommand (mpdclient->connection); break; case CMD_PLAY: if (mpdclient->status->state == MPD_STATUS_STATE_PAUSE) mpd_sendPlayCommand (mpdclient->connection, mpdclient->status->song); else mpd_sendPlayCommand (mpdclient->connection, MPD_PLAY_AT_BEGINNING); break; default: fprintf (stderr, "Incorrect command %d passed to my_send_command", command); } my_check_error (mpdclient->connection); my_finish_command (mpdclient->connection); }