Hi Richard,
nice project you are working on.
If i were you, i would write a separate program.
I would use python, because it has modules for GPIO and mpd.
RuneAudio is based on mpd and gives you all the necessary data / interfaces.
You have two choices for this task:
1) If you do not need Airplay and Spotify, then you can use mpd directly.
Mpd can be controlled via mpc or via a linux socket.
By polling "mpc status" you can determine when the next song is played.
[root@runeaudio ~]# mpc status
David Gilmour - Echoes
[playing] #3/5 6:30/25:26 (25%)
volume: 56% repeat: off random: off single: off consume: off
With commands like "mpc play" and "mpc pause" you can control the player.
2) If you also like to have Airplay and Spotify, then you can poll the RuneAudio database.
[root@runeaudio ~]# redis-cli get act_player_info
"{\"volume\":\"56\",\"repeat\":\"0\",\"random\":\"0\",\"single\":\"0\",\"consume\":\"0\",\"playlist\":\"4\",\"playlistlength\":\"5\",\"mixrampdb\":\"0.000000\",\"state\":\"play\",\"song\":\"2\",\"songid\":\"3\",\"time\":\"1526\",\"elapsed\":\"165\",\"bitrate\":\"968\",\"audio\":\"44100:16:2\",\"nextsong\":\"3\",\"nextsongid\":\"4\",\"OK\":null,\"song_percent\":11,\"audio_sample_rate\":\"44.1\",\"audio_sample_depth\":\"16\",\"audio_channels\":\"Stereo\",\"changed\":\"player\",\"currentartist\":\"David Gilmour\",\"currentsong\":\"Echoes\",\"currentalbum\":\"Live In Gdansk\\/Disc 2\",\"fileext\":\"flac\",\"radioname\":null,\"actPlayer\":\"MPD\"}"
This is available, if you use our
nightly builds.
With commands like "mpc play" and "mpc pause" you can control the player.
Frank