libmpd in debian


/ Published in: C++
Save to your folder(s)



Copy this code and paste it in your HTML
  1. #include <iostream>
  2. #include <libmpd-1.0/libmpd/libmpd.h>
  3.  
  4. using namespace std;
  5.  
  6. int main(int argc, char *argv[])
  7. {
  8. MpdObj *obj = NULL;
  9.  
  10. // Establishing connection
  11. obj = mpd_new("192.168.0.101", 6600, NULL);
  12.  
  13. mpd_connect(obj);
  14.  
  15.  
  16. cout << "Playing " << mpd_get_hostname(obj) << endl;;
  17. //mpd_player_next(obj);
  18.  
  19. int id = mpd_player_get_current_song_id(obj);
  20. mpd_Song *song = mpd_playlist_get_song (obj, id);
  21.  
  22. cout << song->artist << " - " << song->title << endl;
  23.  
  24. mpd_disconnect(obj);
  25.  
  26. mpd_free(obj);
  27. return 0;
  28. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.