Ejemplo n.º 1
0
struct mpd_stats *
mpd_run_stats(struct mpd_connection *connection)
{
	return mpd_send_stats(connection)
		? mpd_recv_stats(connection)
		: NULL;
}
Ejemplo n.º 2
0
void mpd_query_stats(struct mpd_connection *conn)
{
    struct mpd_stats *stats;

    if (!conn)
	return;

    if (!mpd_command_list_begin(conn, true) || !mpd_send_stats(conn) || !mpd_command_list_end(conn)) {
	mpd_printerror("queue_commands");
	return;
    }

    stats = mpd_recv_stats(conn);
    if (stats == NULL) {
	mpd_printerror("recv_stats");
	return;
    }

    l_numberOfSongs = mpd_stats_get_number_of_songs(stats);
    l_uptime = mpd_stats_get_uptime(stats);
    l_playTime = mpd_stats_get_play_time(stats);
    l_dbPlayTime = mpd_stats_get_db_play_time(stats);

    mpd_stats_free(stats);

    if (!mpd_response_finish(conn)) {
	mpd_printerror("response_finish");
	return;
    }
}