<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Airplay &#x27;Now Playing&#x27; module - help badly needed]]></title><description><![CDATA[<p dir="auto">I’ve really been struggling to write my first module.</p>
<p dir="auto">I’ve used Shairport-Sync to allow my mirror to act as an Airplay device - something which works a treat.<br />
I’ve added Shairport-Sync-Metadata-Reader in order to base64-decode the playing track metadata, which Shairport outputs in xml format to a FiFo file.</p>
<p dir="auto">What I’m trying to do is create a module to read the FiFo stream, base64-decode the values and it sees, and display a couple of the fields (Artist/Track)</p>
<p dir="auto">I think I’ll need a node-helper to do the watch/decode/filter and then send any Artist &amp; Track fields it sees to the module which then displays it.</p>
<p dir="auto">I’ve created this which pops up the decoded result for a hardcoded string</p>
<pre><code>&lt;script&gt;
var string = 'RGFycmVu';
var decodedString = atob(string);
window.alert(decodedString);
&lt;/script&gt;
</code></pre>
<p dir="auto">I’ve tried without success though to incoporate this as a function into a .js file, so that I can display my test-decode on the mirror.<br />
I’ve been looking through all the modules I can find to find something I can use as an example but no luck. I know I need to pass the decodedString variable somehow but have struggled to work out how  :(</p>
]]></description><link>https://forum.magicmirror.builders/topic/873/airplay-now-playing-module-help-badly-needed</link><generator>RSS for Node</generator><lastBuildDate>Mon, 11 May 2026 20:50:52 GMT</lastBuildDate><atom:link href="https://forum.magicmirror.builders/topic/873.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 25 Oct 2016 17:01:56 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Airplay &#x27;Now Playing&#x27; module - help badly needed on Mon, 30 Jan 2017 11:29:49 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/brice" aria-label="Profile: Brice">@<bdi>Brice</bdi></a> changes made. Check out the “alignment” config  option.</p>
<p dir="auto">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.</p>
<p dir="auto">Tested with playing and pausing repeatedly.</p>
]]></description><link>https://forum.magicmirror.builders/post/12999</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/12999</guid><dc:creator><![CDATA[surekap]]></dc:creator><pubDate>Mon, 30 Jan 2017 11:29:49 GMT</pubDate></item><item><title><![CDATA[Reply to Airplay &#x27;Now Playing&#x27; module - help badly needed on Mon, 30 Jan 2017 08:51:01 GMT]]></title><description><![CDATA[<p dir="auto">Thanks a lot <a class="plugin-mentions-user plugin-mentions-a" href="/user/surekap" aria-label="Profile: surekap">@<bdi>surekap</bdi></a> for this amazing module. It works !<br />
Quick suggestions :</p>
<ul>
<li>hide the module if no airplay device is connected / no song playing</li>
<li>align text &amp; image on left/right depending on the module position (currently both centered in its container)</li>
</ul>
]]></description><link>https://forum.magicmirror.builders/post/12982</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/12982</guid><dc:creator><![CDATA[Brice]]></dc:creator><pubDate>Mon, 30 Jan 2017 08:51:01 GMT</pubDate></item><item><title><![CDATA[Reply to Airplay &#x27;Now Playing&#x27; module - help badly needed on Sun, 29 Jan 2017 21:25:53 GMT]]></title><description><![CDATA[<p dir="auto">ANNOUNCE: Check out <a href="https://github.com/surekap/MMM-ShairportMetadata" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/surekap/MMM-ShairportMetadata</a></p>
<p dir="auto">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.<br />
The module manages a child process which pipes the XML to the Py script and reads the json and displays it.</p>
]]></description><link>https://forum.magicmirror.builders/post/12936</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/12936</guid><dc:creator><![CDATA[surekap]]></dc:creator><pubDate>Sun, 29 Jan 2017 21:25:53 GMT</pubDate></item><item><title><![CDATA[Reply to Airplay &#x27;Now Playing&#x27; module - help badly needed on Wed, 25 Jan 2017 13:24:52 GMT]]></title><description><![CDATA[<p dir="auto">I’m also interested in the development of this module.<br />
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 !</p>
]]></description><link>https://forum.magicmirror.builders/post/12436</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/12436</guid><dc:creator><![CDATA[Brice]]></dc:creator><pubDate>Wed, 25 Jan 2017 13:24:52 GMT</pubDate></item><item><title><![CDATA[Reply to Airplay &#x27;Now Playing&#x27; module - help badly needed on Tue, 17 Jan 2017 14:12:58 GMT]]></title><description><![CDATA[<p dir="auto">Are there any updates to this module?</p>
]]></description><link>https://forum.magicmirror.builders/post/11413</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/11413</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Tue, 17 Jan 2017 14:12:58 GMT</pubDate></item><item><title><![CDATA[Reply to Airplay &#x27;Now Playing&#x27; module - help badly needed on Thu, 05 Jan 2017 17:02:53 GMT]]></title><description><![CDATA[<p dir="auto">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 :)</p>
]]></description><link>https://forum.magicmirror.builders/post/10479</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/10479</guid><dc:creator><![CDATA[vogelboy]]></dc:creator><pubDate>Thu, 05 Jan 2017 17:02:53 GMT</pubDate></item><item><title><![CDATA[Reply to Airplay &#x27;Now Playing&#x27; module - help badly needed on Tue, 13 Dec 2016 03:52:02 GMT]]></title><description><![CDATA[<p dir="auto">Hi <a class="plugin-mentions-user plugin-mentions-a" href="/user/darrene" aria-label="Profile: darrene">@<bdi>darrene</bdi></a> ,</p>
<p dir="auto">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).</p>
<p dir="auto">As forked-daapd can also use mpd commands I’ve been trying to use <a href="https://www.npmjs.com/package/komponist" target="_blank" rel="noopener noreferrer nofollow ugc">komponist</a>, 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.</p>
<p dir="auto">If you’ve made any progress on your module, I’d love to see it as it may help me finish mine.</p>
]]></description><link>https://forum.magicmirror.builders/post/9270</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/9270</guid><dc:creator><![CDATA[jdfraser]]></dc:creator><pubDate>Tue, 13 Dec 2016 03:52:02 GMT</pubDate></item><item><title><![CDATA[Reply to Airplay &#x27;Now Playing&#x27; module - help badly needed on Sat, 29 Oct 2016 12:04:37 GMT]]></title><description><![CDATA[<p dir="auto">Hmm, using a child process doesn’t return anything either :(</p>
<p dir="auto">The shairport metadata reader is a compiled C program which uses printf to return the metadata to the console:</p>
<pre><code>pi@raspberrypi:~/fifo-js $ ~/shairport-sync-metadata-reader/shairport-sync-metadata-reader &lt; /tmp/shairport-sync-metadata

Artist: "Sohn".
Title: "Tremors".

^C
pi@raspberrypi:~/fifo-js $ 
</code></pre>
<p dir="auto">But I dont’ seem to be able to parse what’s being sent to stdout from my javascript</p>
<p dir="auto">If anyone has any examples that work, I’d be grateful.</p>
]]></description><link>https://forum.magicmirror.builders/post/7253</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/7253</guid><dc:creator><![CDATA[darrene]]></dc:creator><pubDate>Sat, 29 Oct 2016 12:04:37 GMT</pubDate></item><item><title><![CDATA[Reply to Airplay &#x27;Now Playing&#x27; module - help badly needed on Fri, 28 Oct 2016 23:01:47 GMT]]></title><description><![CDATA[<p dir="auto">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.</p>
<p dir="auto">The fifo-js approach works with a fifo file that I <em>echo</em> things into to test, but doesn’t return anything while the Shairport service has it open for some reason?</p>
<p dir="auto">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?</p>
]]></description><link>https://forum.magicmirror.builders/post/7221</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/7221</guid><dc:creator><![CDATA[darrene]]></dc:creator><pubDate>Fri, 28 Oct 2016 23:01:47 GMT</pubDate></item><item><title><![CDATA[Reply to Airplay &#x27;Now Playing&#x27; module - help badly needed on Fri, 28 Oct 2016 17:34:45 GMT]]></title><description><![CDATA[<p dir="auto">Luckily there is a fifo-js package available, which makes things super-easy!<br />
npm install fifo-js</p>
<pre><code>const FIFO = require('fifo-js')

let fifo = new FIFO('fifo-testfile')

var count = 1
while (count == 1)
    {
    let text = fifo.readSync(fifo)
    console.log(text)
    }
fifo.close()
</code></pre>
<p dir="auto">I’m getting there. I have an IN and I have an OUT in javascript. Now the hard work of joining the two together - interpreting and the decoding the appropriate metadata begins!</p>
]]></description><link>https://forum.magicmirror.builders/post/7179</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/7179</guid><dc:creator><![CDATA[darrene]]></dc:creator><pubDate>Fri, 28 Oct 2016 17:34:45 GMT</pubDate></item><item><title><![CDATA[Reply to Airplay &#x27;Now Playing&#x27; module - help badly needed on Thu, 27 Oct 2016 20:27:16 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/darrene" aria-label="Profile: darrene">@<bdi>darrene</bdi></a> checkout the file watcher of the nodejs filesystem <a href="https://nodejs.org/docs/latest/api/fs.html#fs_class_fs_fswatcher" target="_blank" rel="noopener noreferrer nofollow ugc">https://nodejs.org/docs/latest/api/fs.html#fs_class_fs_fswatcher</a></p>
]]></description><link>https://forum.magicmirror.builders/post/7091</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/7091</guid><dc:creator><![CDATA[strawberry 3.141]]></dc:creator><pubDate>Thu, 27 Oct 2016 20:27:16 GMT</pubDate></item><item><title><![CDATA[Reply to Airplay &#x27;Now Playing&#x27; module - help badly needed on Thu, 27 Oct 2016 20:11:40 GMT]]></title><description><![CDATA[<p dir="auto">So step 2, I have made a short javascript file that will read a fifo file and decode what it sees in the  buffer.</p>
<pre><code>var fs = require('fs')
var fifo = fs.createReadStream('shairport-sync-metadata')
fifo.on('data', function(fifoHexBuffer) {
    fifoHexBuffer = fifoHexBuffer.toString();
    console.log(fifoHexBuffer)    
})
</code></pre>
<p dir="auto">At the moment, the code runs once and stops once it reads. My next task is to have it continue, then I’ll have to make it into a node-helper script, to interact with my base64 decoder/display</p>
]]></description><link>https://forum.magicmirror.builders/post/7085</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/7085</guid><dc:creator><![CDATA[darrene]]></dc:creator><pubDate>Thu, 27 Oct 2016 20:11:40 GMT</pubDate></item><item><title><![CDATA[Reply to Airplay &#x27;Now Playing&#x27; module - help badly needed on Thu, 27 Oct 2016 08:19:05 GMT]]></title><description><![CDATA[<p dir="auto">Ah! Thanks so much <a class="plugin-mentions-user plugin-mentions-a" href="/user/alexyak" aria-label="Profile: alexyak">@<bdi>alexyak</bdi></a> - that’s fantastic. I can now move forwards :)</p>
<p dir="auto">So parenthesis are needed to call the function and explicitly not pass it a parameter. Is that right?</p>
]]></description><link>https://forum.magicmirror.builders/post/7027</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/7027</guid><dc:creator><![CDATA[darrene]]></dc:creator><pubDate>Thu, 27 Oct 2016 08:19:05 GMT</pubDate></item><item><title><![CDATA[Reply to Airplay &#x27;Now Playing&#x27; module - help badly needed on Thu, 27 Oct 2016 02:35:25 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/darrene" aria-label="Profile: darrene">@<bdi>darrene</bdi></a> You’re missing parenthesis in your call to frombase64:</p>
<p dir="auto">this.frombase64();</p>
]]></description><link>https://forum.magicmirror.builders/post/7022</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/7022</guid><dc:creator><![CDATA[alexyak]]></dc:creator><pubDate>Thu, 27 Oct 2016 02:35:25 GMT</pubDate></item><item><title><![CDATA[Reply to Airplay &#x27;Now Playing&#x27; module - help badly needed on Wed, 26 Oct 2016 21:53:34 GMT]]></title><description><![CDATA[<p dir="auto">The first step of my module, which simply displays a base64-decoded string in the mirror reads like this.</p>
<pre><code>/* global Module */
/* Magic Mirror
* Module: base64
*
* By Michael Teeuw http://michaelteeuw.nl
* MIT Licensed.
*/

Module.register("base64",{

    // Default module config.
    defaults: {
            text: "Hello World!"
    },


  frombase64: function() {
    var string = 'RGFycmVu';
    var decodedString = atob(string);
    return decodedString;
    },

    // Override dom generator.
    getDom: function() {
            var wrapper = document.createElement("div");
            var decstr = this.frombase64
            var msgstr = document.createTextNode(decstr);
            wrapper.appendChild(msgstr);
            return wrapper;
    }
});
</code></pre>
<p dir="auto">It seems like it should work, but I get a literal string rather than a value returned…<br />
<img src="/uploads/files/1477518804232-mm.jpg" alt="0_1477518803379_mm.jpg" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.magicmirror.builders/post/7008</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/7008</guid><dc:creator><![CDATA[darrene]]></dc:creator><pubDate>Wed, 26 Oct 2016 21:53:34 GMT</pubDate></item></channel></rss>