Thanks! So you just poll the now_playing file every second or something? I'm still banging my head against the fifo file. I can redirect it to a file using cat now_playing > output, but can't get awk to work like some of the other examples. It's frustrating because I think the named pipe would make it so you didn't have to keep checking file status over and over. Back to google....
I found this script which seems to work for me:
https://github.com/ironiridis/shairport ... capture.sh
The way to test if the fifo style metadata pipe is working is to:
1. Set up your init.d/shairport file to include the -M /path argument
2. Restart the shairport deamon via sudo /etc/init.d/shairport restart
3. Navigate to your the folder you identified as path in step 1
4. cat now_playing
At this point the cursor will go away. This is called blocking and what is happening is that the cat command is waiting for the fifo file to be opened on the other end of the pipe. When this happens it will read the metadata and then wait again. So to test if the transfer is working, we need to wait for a song change.
5. Connect a source to shairplay and change songs a few times.
6. Check for metadata to be displayed in the shell.
1. Make sure the permissions on both the metadata folder and the now_playing file itself are set correctly. They should have both read and write for the appropriate user / group.
2. Open /etc/init.d/shairport and double check that the -M argument is added and that the target path is correct.
Now create a new script:
1. nano getinfo.sh (you may have to adjust permissions here)
2. Paste the script linked above
3. Edit TARGET_SCRIPT="/home/user/shairport_now_playing.sh" and METADATA_DIR="/tmp/shairport" to reflect your paths
4. Save and exit.
5. nano shairport_now_playing.sh (you may have to adjust permissions here)
6. In this script arguments containing the metadata information can be accessed through the use of these variables:
$6: The full pathname to the artwork file
That means you can add something like the following to shairport_now_playing.sh:
This will just echo the artist but you can set it up to do whatever you want. fbi -T 2 "$6" displays the cover art out hdmi for example.
7. Save and exit.
8. Now run ./getinfo.sh &
The & at the end of the line causes getinfo.sh to run in the background. To stop it:
2. Note down the job id
3. kill id
What happens is that getinfo.sh runs in the background and waits for incoming metadata. When it detects that the fifo is open for writing it automatically triggers whatever you have in shairport_now_playing.sh. That's as far as I've gotten. The only problem I've still got left to crack is that the above setup seems to echo all the metadata correctly but fbi always loads the previous cover image instead of the current one. I'm going to work on that tonight.
If anybody else wants to chip in and help us understand what we're doing right (or wrong) here it would be greatly appreciated!