Read the statement by Michael Teeuw here.
Airplay 'Now Playing' module - help badly needed
-
So a bit more testing and things aren’t looking as rosy as I’d first thought. Before trying fifo-js, I’d experimented with the filesystem readStream - If i try looping that I end up with a java out of memory condition.
The fifo-js approach works with a fifo file that I echo things into to test, but doesn’t return anything while the Shairport service has it open for some reason?
There is a metadata reader script which I could use to read the metadata and parse it. I’ve compiled the executable and it runs fine. I should be able to call that from my javascript module through child process, right?
-
Hmm, using a child process doesn’t return anything either :(
The shairport metadata reader is a compiled C program which uses printf to return the metadata to the console:
pi@raspberrypi:~/fifo-js $ ~/shairport-sync-metadata-reader/shairport-sync-metadata-reader < /tmp/shairport-sync-metadata Artist: "Sohn". Title: "Tremors". ^C pi@raspberrypi:~/fifo-js $
But I dont’ seem to be able to parse what’s being sent to stdout from my javascript
If anyone has any examples that work, I’d be grateful.
-
Hi @darrene ,
How did you ever make out with your module? I’ve started down the same path, I’m also using shairport-sync but in conjunction with forked-daapd (an airplay server for Raspbian).
As forked-daapd can also use mpd commands I’ve been trying to use komponist, which I’ve managed to make return the playing song, album, etc. print out to the console but as I’ve never really done any javascript before am trying to piece together building a module for MM.
If you’ve made any progress on your module, I’d love to see it as it may help me finish mine.
-
I’m just dropping by to express my encouragement for this effort! I would love to have a now-playing module that used the shairport-sync metadata :)
-
Are there any updates to this module?
-
I’m also interested in the development of this module.
I’ve started to recompile Shairport-sync so it can write a plain .TXT file with the metadata each time a new song is detected, now I have to read the last line of this TXT file through a MM-module. But I don’t know if this is the right direction, editing the core of Shairport-sync seems like a bad idea (no updates, etc). I wish I could read metadatas via the pipe in a less complex way. Anyone has worked on this ? Thanks ! -
ANNOUNCE: Check out https://github.com/surekap/MMM-ShairportMetadata
Its my first attempt at writing anything in node.js so I basically wrote a python script to translate the XML from shairport-sync into json objects.
The module manages a child process which pipes the XML to the Py script and reads the json and displays it. -
Thanks a lot @surekap for this amazing module. It works !
Quick suggestions :- hide the module if no airplay device is connected / no song playing
- align text & image on left/right depending on the module position (currently both centered in its container)
-
@Brice changes made. Check out the “alignment” config option.
The hide behaviour is not perfect - takes a few seconds to hide the module - this is because we issue the hide command in case of ‘pfls’ [play flush] and ‘pend’ [play end] metadata commands. Unfortunately, the ‘pfls’ command is followed up with fresh metadata and it takes a few seconds for the ‘pend’ to come from the iPhone.
Tested with playing and pausing repeatedly.