Implement consume, single mode.
[libmpd.git] / example / speedtest / test.c
blob741910429eb12321b6f524d2b5dfd0748fd72896
1 /* libmpd (high level libmpdclient library)
2 * Copyright (C) 2004-2009 Qball Cow <qball@sarine.nl>
3 * Project homepage: http://gmpcwiki.sarine.nl/
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #include "libmpd.h"
21 #include "debug_printf.h"
22 #include <stdio.h>
23 #include <stdlib.h>
25 int main(int argc, char *argv)
27 MpdObj *obj = mpd_new("192.150.0.50", 6600, "pass");
28 debug_set_level(DEBUG_INFO);
29 if(!mpd_connect(obj))
30 // for(i=0;i<1000;i++)
32 mpd_send_password(obj);
33 int id = mpd_playlist_add_get_id(obj, "Sorted/0-K/C/Clapton, Eric/1992 - Unplugged/14 - Rollin' & Tumblin'.flac");
34 printf("%i\n", id);
35 mpd_player_play_id(obj, id);
36 /* MpdData * data = mpd_playlist_find(obj, MPD_TABLE_ARTIST,"(General)", TRUE);
37 while(data != NULL)
39 char buffer[1024];
40 mpd_song_markup(buffer, 1024,"[%name%: &[%artist% - ]%title%]|%name%|[%artist% - ]%title% &[(%time%)]|%shortfile%", data->song);
41 printf("%s\n", buffer);
44 data = mpd_data_get_next(data);
48 mpd_free(obj);