Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Is it possible to display now playing artwork for radio streams?
#1
Some radio stations include album artwork in the metadata of the stuff they broadcast – good examples in this respect are Linn Radio (http://89.16.185.174:8003/stream) and Folk Alley (http://stream.wksu.org/famemb.128.mp3).  When I play such stations in Musicbee the artwork is displayed, but for some reason this doesn’t work on my setup of Moode.  Incidentally, I’m still running 4.0 and mainly use UPnP, so have only tested this via  a list of stations in ‘upmpdcli-radio.conf’.  Is there anything that can be done to resolve this?
Reply
#2
To expand on this, I've just noticed that when I click on Radio Paradise (http://stream-uk1.radioparadise.com/aac-320) in Musicbee, another station featuring album artwork, there's a hyperlink to the relevant cover art in the description field – for example, http://img.radioparadise.com/covers/l/B071FL9473.jpg. Can Moode somehow utilise these hyperlinks to display artwork for Radio Paradise and any other stations that use this approach?
Reply
#3
The cover url is not in MPD metadata so possibly there is some sort of online database thats accessed? To see the metadata that MPD maintains try the following commands while the station is playing.

telnet localhost 6600
currentsong

Example

pi@rp3:~ $ telnet localhost 6600
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
OK MPD 0.20.0
currentsong
file: http://stream-tx3.radioparadise.com/aac-320
Title: Donovan - Hurdy Gurdy Man
Name: Radio Paradise - Naim exclusive
Pos: 65
Id: 66
OK
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#4
Thanks for coming back to me Tim. I've looked into this further and from what I can gather there's two optional parameters for upmpdcli - one appropriately referred to as 'artScript', and the other called 'metaScript - which via addiitional scripts seem (???) to enable it to retrive radio station metadata, including I think the cover art of the track that's currently being played. Exploring this further, or indeed the possibility of trying to compile some form of script that may achieve this, is well beyond my capabilities, but I'm really interested in this....
Reply
#5
(06-11-2018, 02:07 PM)Zigzag Wrote: Thanks for coming back to me Tim. I've looked into this further and from what I can gather there's two optional parameters for upmpdcli - one appropriately referred to as 'artScript', and the other called 'metaScript - which via addiitional scripts seem (???) to enable it to retrive radio station metadata, including I think the cover art of the track that's currently being played.  Exploring this further, or indeed the possibility of trying to compile some form of script that may achieve this, is well beyond my capabilities, but I'm really interested in this....

This will only work with Kazoo and Lumin.

I can give you python script to do this for Radio Paradise, to get this to dsplay in the web front end will take some hackery though.
Reply
#6
(06-13-2018, 10:14 PM)serverbaboon Wrote: This will only work with Kazoo and Lumin.

I can give you python script to do this for Radio Paradise, to get this to dsplay in the web front end will take some hackery though.

I would hugely appreciate any guidance and/or script(s) that you may be up to giving me serverbaboon - I only listen via Kazoo, Lumin or Bubble DS so well into this!
Reply
#7
(06-15-2018, 12:55 PM)Zigzag Wrote:
(06-13-2018, 10:14 PM)serverbaboon Wrote: This will only work with Kazoo and Lumin.

I can give you python script to do this for Radio Paradise, to get this to dsplay in the web front end will take some hackery though.

I would hugely appreciate any guidance and/or script(s) that you may be up to giving me serverbaboon - I only listen via Kazoo, Lumin or Bubble DS so well into this!

Sorry for not responding earlier but been busy with work and i am currently travelling , will try and sort out the week after next.
Reply
#8
Ok I  have a simple script (very little error checking)  to get the artwork for the currently playing track on Radio Paradise at the bottom of the page, I don't seem to be able to upload the file.

Once you have entered the code save it as rp3.py.

Transfer this file to you PI either by winscp or equivelant to /home/pi or by copying using what ever file share browser you have to \\x.x.x.x\SDCARD.

ssh to your Raspberry PI

move your file to /usr/local/bin, give the file execute permissions and test.
The stuff in brackets are notes .

Code:
cd /usr/local/bin
sudo mv /mnt/SDCARD/rp3.py .              ( or if you used scp sudo mv /home/pi/rp3.py .)
sudo chmod +x rp3.py

./rp3.py

https://img.radioparadise.com/covers/l/B0006ZXJ3E.jpg


(if you get an error about request missing)

sudo pip install requests


You need to make sure that your Radio Paradise entry in the Radio Config file for UPMPDCLI references this script, make sure the Radio Paradise section in the file /etc/upmpdcli-radio.conf looks something like this and save.

To edit type you can use nano at the terminal prompt.

sudo nano etc/upmpdcli-radio.conf



Code:
[radio Radio Paradise]
url = http://stream-uk1.radioparadise.com/aac-320
artUrl = https://www.radioparadise.com/graphics/fb_logo.png
artScript = /usr/local/bin/rp3.py

You will need to restart upmpdcli or reboot the raspberry pi.

To restart upmpdcli you can type.

sudo service upmpdcli restart and press return.

One thing I have noticed is that Kazoo can be a little unstable if you are messing around stopping and starting things, plus if you leave it running when you are off wireless it has this habit of changing its default network it scans to be your telephone providers ip address which is annoying. Basically always exit Kazoo and check the wireless network before blaming Moode/UPMPDCLI.

The code is below, if you are doing this on a windows box you MUST make sure that you file editor can save in Linux format not Windows CRLF format.
The Python XML libraries have some vulnerabilities so there is a cursory attempt to make sure the xml isn't to big, this is a poor test and the vulnrabilities more sophisticated so don't use this code for anything else.

Basically Radio Paradise publish an XML file with the current track data in it, we get it with python requests take the resulting xml and search for the cove art key.

http://radioparadise.com/xml/now.xml

The current version of upmpdcli in Moode uses Python 2.


Code:
#!/usr/bin/python

# Extract the artwork url for the currently playing track Radio Paradise.
# Will repeat the warning from the Python website about the lack of checking on the xml modules.

from __future__ import print_function

import requests
import xml.etree.ElementTree as etree

rpdata = "http://radioparadise.com/xml/now.xml"

try:
   StreamInfo = requests.get(rpdata, timeout=2)
except requests.exceptions.ConnectTimeout:
   exit(1)
else:
   if int(StreamInfo.headers['Content-Length']) > 1024:
       exit(2)

rp = StreamInfo.text

rptree = etree.fromstring(rp)

print(rptree.find('song/coverart').text)

# Uncomment the below for troubleshooting to display the XML
# print(rp)
Reply
#9
Just tried this but for some reason it is not working.
When I run "./rp3.py" I get the expected output but even with "# print(rp)" uncommented I see nothing on the player screen.

Any ideas? Please take your time as this is not that important, more that I thought you should know that it wasn't working on my Pi 3 with official screen.
Reply
#10
(07-09-2018, 06:32 AM)Mike A Wrote: Just tried this but for some reason it is not working.
When I run "./rp3.py" I get the expected output but even with "# print(rp)" uncommented I see nothing on the player screen.

Any ideas? Please take your time as this is not that important, more that I thought you should know that it wasn't working on my Pi 3 with official screen.

The #print (rp) is for command line testing only and should be commented out in actual use, all that upmpdcli is expecting is a url.

What do you mean by player screen? This will only work with Lumin and Kazoo and you must select the Radio station from the Kazoo or Lumin Radio page, this is ONLY for unpnp control points.


If this is what we are talking about then check the syslog file in /var/log for errors, would suggest that upmpdcli is having issues calling the script.

Have you definitely modified the Radio Config file and restarted the service?
Try changing the line

[radio Radio Paradise]

to 

[radio Radio Paradise AAC]

... and restarting , you now see this in the Control Point Radio Section.
Reply


Forum Jump: