/ Published in: C++
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#include <iostream> #include <libmpd-1.0/libmpd/libmpd.h> using namespace std; int main(int argc, char *argv[]) { MpdObj *obj = NULL; // Establishing connection obj = mpd_new("192.168.0.101", 6600, NULL); mpd_connect(obj); cout << "Playing " << mpd_get_hostname(obj) << endl;; //mpd_player_next(obj); int id = mpd_player_get_current_song_id(obj); mpd_Song *song = mpd_playlist_get_song (obj, id); cout << song->artist << " - " << song->title << endl; mpd_disconnect(obj); mpd_free(obj); return 0; }