Example #1
0
static void getSingleInt(RESULT * result)
{
    double d;
    mpd_update();
    d = (double) l_singleEnabled;
    SetResult(&result, R_NUMBER, &d);
}
Example #2
0
static void getConsumeInt(RESULT * result)
{
    double d;
    mpd_update();
    d = (double) l_consumeEnabled;
    SetResult(&result, R_NUMBER, &d);
}
Example #3
0
static void getRandomInt(RESULT * result)
{
    double d;
    mpd_update();
    d = (double) l_randomEnabled;
    SetResult(&result, R_NUMBER, &d);
}
Example #4
0
static void getMpdPlaylistLength(RESULT * result)
{
    double d;
    mpd_update();
    d = (double) l_playlistLength;
    SetResult(&result, R_NUMBER, &d);
}
Example #5
0
static void totalTimeSec(RESULT * result)
{
    double d;
    mpd_update();
    d = (double) l_totalTimeSec;
    SetResult(&result, R_NUMBER, &d);
}
Example #6
0
static void getCurrentSongPos(RESULT * result)
{
    double d;
    mpd_update();
    d = (double) l_currentSongPos;
    SetResult(&result, R_NUMBER, &d);
}
Example #7
0
static void getAudioChannels(RESULT * result)
{
    double d;
    mpd_update();
    d = (double) l_channels;
    SetResult(&result, R_NUMBER, &d);
}
Example #8
0
static void getMpdDbPlayTime(RESULT * result)
{
    double d;
    mpd_update();
    d = (double) l_dbPlayTime;
    SetResult(&result, R_NUMBER, &d);
}
Example #9
0
static void bitRate(RESULT * result)
{
    double d;
    mpd_update();
    d = (double) l_bitRate;
    SetResult(&result, R_NUMBER, &d);
}
Example #10
0
/* return the # of songs in the mpd db .. */
static void getSongsInDb(RESULT * result)
{
    double d;
    mpd_update();
    d = (double) l_numberOfSongs;
    SetResult(&result, R_NUMBER, &d);
}
Example #11
0
static void getSamplerateHz(RESULT * result)
{
    double d;
    mpd_update();
    d = (double) l_sampleRate;
    SetResult(&result, R_NUMBER, &d);
}
Example #12
0
static void getVolume(RESULT * result)
{
    double d;
    mpd_update();
    d = (double) l_volume;
    /* return 0..100 or < 0 when failed */
    SetResult(&result, R_NUMBER, &d);
}
Example #13
0
static void pauseSong()
{
    mpd_update();
    if (currentSong != NULL) {
	if ((!mpd_send_pause(conn, l_state == MPD_STATE_PAUSE ? 0 : 1))
	    || (!mpd_response_finish(conn))) {
	    mpd_printerror("send_pause");
	}
    }
}
Example #14
0
static void stopSong()
{
    mpd_update();
    if (currentSong != NULL) {
	if ((!mpd_run_stop(conn))
	    || (!mpd_response_finish(conn))) {
	    mpd_printerror("run_stop");
	}
    }
}
Example #15
0
static void prevSong()
{
    mpd_update();
    if (currentSong != NULL) {
	if ((!mpd_run_previous(conn))
	    || (!mpd_response_finish(conn))) {
	    mpd_printerror("run_previous");
	}
    }
}
Example #16
0
static void toggleConsume()
{
    mpd_update();
    if (currentSong != NULL) {
	l_consumeEnabled = !l_consumeEnabled;
	if ((!mpd_run_consume(conn, l_consumeEnabled))
	    || (!mpd_response_finish(conn))) {
	    mpd_printerror("run_consume");
	}
    }
}
Example #17
0
static void toggleRandom()
{
    mpd_update();
    if (currentSong != NULL) {
	l_randomEnabled = !l_randomEnabled;
	if ((!mpd_run_random(conn, l_randomEnabled))
	    || (!mpd_response_finish(conn))) {
	    mpd_printerror("run_random");
	}
    }
}
Example #18
0
static void getFilename(RESULT * result)
{
    const char *value = NULL;
    mpd_update();
    if (currentSong != NULL) {
	value = mpd_song_get_uri(currentSong);
    }
    if (value)
	SetResult(&result, R_STRING, charset_from_utf8(value));
    else
	SetResult(&result, R_STRING, "");
}
Example #19
0
static void getAlbum(RESULT * result)
{
    const char *value = NULL;
    mpd_update();
    if (currentSong != NULL) {
	value = mpd_song_get_tag(currentSong, MPD_TAG_ALBUM, 0);
    }
    if (value)
	SetResult(&result, R_STRING, charset_from_utf8(value));
    else
	SetResult(&result, R_STRING, "");
}
Example #20
0
static void volUp()
{
    mpd_update();
    if (currentSong != NULL) {
	l_volume += 5;
	if (l_volume > 100)
	    l_volume = 100;

	if ((!mpd_run_set_volume(conn, l_volume))
	    || (!mpd_response_finish(conn))) {
	    mpd_printerror("set_volume");
	}
    }
}
Example #21
0
static void volDown()
{
    mpd_update();
    if (currentSong != NULL) {
	if (l_volume > 5)
	    l_volume -= 5;
	else
	    l_volume = 0;

	if ((!mpd_run_set_volume(conn, l_volume))
	    || (!mpd_response_finish(conn))) {
	    mpd_printerror("set_volume");
	}
    }
}
Example #22
0
File: mpd.c Project: cmende/mpd2irc
static gboolean mpd_parse(G_GNUC_UNUSED GIOChannel *channel,
		G_GNUC_UNUSED GIOCondition condition,
		G_GNUC_UNUSED gboolean user_data)
{
	mpd_recv_idle(mpd.conn, FALSE);

	if (!mpd_response_finish(mpd.conn)) {
		mpd_report_error();
		return FALSE;
	}

	mpd_update();

	mpd_send_idle_mask(mpd.conn, MPD_IDLE_PLAYER);
	return TRUE;
}
Example #23
0
/*  
    return player state:
	0=unknown
	1=play
	2=pause
	3=stop
*/
static void getStateInt(RESULT * result)
{
    double ret;

    mpd_update();

    switch (l_state) {
    case MPD_STATE_PLAY:
	ret = 1;
	break;
    case MPD_STATE_PAUSE:
	ret = 2;
	break;
    case MPD_STATE_STOP:
	ret = 3;
	break;
    default:
	ret = 0;
	break;
    }

    SetResult(&result, R_NUMBER, &ret);
}