Play this song and is the current song done soon?

Need help with MPD?
Post Reply
Doedelpumpe
Posts: 1
Joined: November 20th, 2020, 7:22 pm

Play this song and is the current song done soon?

Post by Doedelpumpe »

Hey guys,

i have tried to study the mpd-operators a bit but i am kinda confused at the moment. My actual task sounds quite simple. I want to tell the mpd-server/-player what to play (next).

More detailed:

I ve written a php-homepage where people can vote for songs. Songs and votes are saved in a sql-database.
Now i want to use a C++ program to check which song has the highest votes and tell mpd to play this song. The path of the musicfile is saved in the sql and could be send to the mpd. A couple seconds before the current song is over the C++ programm asks again for the song with the highest votes and sends the path to the mpd to play it next.

So i need functions like
play_song(connection, filepath)
playtime_remaining(connection)
play_song_next(connection, filepath)

I am just jumping from .h-file to .h-file trying to find the functions i need but getting frustrated so i hope you guys might be able to help me :)
max
Forum team
Posts: 1257
Joined: January 15th, 2013, 3:43 pm

Re: Play this song and is the current song done soon?

Post by max »

play_song is: "addid FILE" (which returns the song id) and then "playid ID".
For "playtime_remaining", call "status" and you'll get the elapsed time in the current song, and the total song time.
"play_song_next" is "addid" and "moveid" (move the new song to the position after the current song, determined by "status")
Post Reply