Exemplo n.º 1
0
int cmd_play ( int argc, char ** argv, mpd_Connection * conn )
{
	int song;
	int i;

	if(0==argc) song = MPD_PLAY_AT_BEGINNING;
	else {
		mpd_Status *status;

		for(i=0;i<argc-1;i++)
			printf("skipping: %s\n",argv[i]);

                if(!parse_songnum(argv[i], &song))
			DIE("error parsing song numbers from: %s\n",argv[i]);

		song--;

		/* This is necessary, otherwise mpc will output the wrong playlist number */
		status = getStatus(conn);
		i = status->playlistLength;
		mpd_freeStatus(status);
		if(song >= i)
			DIE("song number greater than playlist length.\n");
	}

	mpd_sendPlayCommand(conn,song);
	my_finishCommand(conn);

	return 1;
}
Exemplo n.º 2
0
static void
_mpdule_cb_play (void *data, Evas_Object * obj, const char *emission,
		 const char *source)
{
  Instance *inst;
  mpd_Connection *mpd;

  inst = data;
  mpd = inst->mpd;
  mpd_sendPlayCommand (mpd, -1);
}
Exemplo n.º 3
0
Arquivo: mpd.c Projeto: 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();
}
Exemplo n.º 4
0
void mpdc_playpause()
{
	int state;
	if (mpdc_tickle() < 0)
		return;
	if ((state = mpdc_status(mpdz)) < 0)
		return;
	if (state == MPD_STATUS_STATE_PLAY)
		mpd_sendPauseCommand(mpdz, 1);
	else if (state == MPD_STATUS_STATE_PAUSE)
		mpd_sendPauseCommand(mpdz, 0);
	else
		mpd_sendPlayCommand(mpdz, -1);
	mpd_finishCommand(mpdz);
}
Exemplo n.º 5
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();
}
Exemplo n.º 6
0
void mpdclient_pause(int state) {
	mpd_Status *status;

	if (state == 1) {
		mpd_sendPauseCommand(conn, state);
		mpd_finishCommand(conn);
		return;
	}

	/* If we are stopped, start playing */
	mpd_sendStatusCommand(conn);
	status = mpd_getStatus(conn);
	if (status->state == MPD_STATUS_STATE_STOP &&
			status->playlistLength > 0) {
		mpd_sendPlayCommand(conn, 0);
		//music_song_active(0);
		//music_playlist_autoscroll(0, 1);
	}
	else
		mpd_sendPauseCommand(conn, 0);

	mpd_finishCommand(conn);
}
Exemplo n.º 7
0
void mpdclient_song_play(int pos) {
	mpd_sendPlayCommand(conn, pos);
	mpd_finishCommand(conn);
}