Hi Web Radio Fans!
As of this post the latest version of Volumio is 2.246. Most of this thread explains how to add web radio stations for versions < 2 (the first post of this thread was 2014). So, I traced through the code to see what happens after you press the “Web Radio” button and determined how it actually works for the “My Web Radios” selection.
And now I’ll enlighten you
The code is looking for a JSON structured file with the location and name: /data/favourites/my-web-radio
The expected structure is an array of name,uri pairs as in:
[{“name”:"",“uri”,“http://”}, … ]
Here’s all the Soma FM stations in the correct format:
[{"name":"SomaFM: Seven Inch Soul","uri":"http://ice1.somafm.com/7soul-128-aac"},
{"name":"SomaFM: Boot Liquor","uri":"http://ice1.somafm.com/bootliquor-128-aac"},
{"name":"SomaFM: Black Rock FM","uri":"http://ice1.somafm.com/brfm-128-aac"},
{"name":"SomaFM: Deep Space One","uri":"http://ice1.somafm.com/deepspaceone-128-aac"},
{"name":"SomaFM: Digitalis","uri":"http://ice1.somafm.com/digitalis-128-aac"},
{"name":"SomaFM: Drone Zone","uri":"http://ice1.somafm.com/dronezone-128-aac"},
{"name":"SomaFM: Earwaves","uri":"http://ice1.somafm.com/earwaves-128-aac"},
{"name":"SomaFM: Fluid","uri":"http://ice1.somafm.com/fluid-128-aac"},
{"name":"SomaFM: Folk Forward","uri":"http://ice1.somafm.com/folkfwd-128-aac"},
{"name":"SomaFM: Groove Salad","uri":"http://ice1.somafm.com/groovesalad-128-aac"},
{"name":"SomaFM: Illinois Street Lounge","uri":"http://ice1.somafm.com/illstreet-128-aac"},
{"name":"SomaFM: Indie Pop Rocks!","uri":"http://ice1.somafm.com/indiepop-128-aac"},
{"name":"SomaFM: Lush","uri":"http://ice1.somafm.com/lush-128-aac"},
{"name":"SomaFM: Secret Agent","uri":"http://ice1.somafm.com/secretagent-128-aac"},
{"name":"SomaFM: Left Coast 70s","uri":"http://ice1.somafm.com/seventies-128-aac"},
{"name":"SomaFM: The Silent Channel","uri":"http://ice1.somafm.com/silent-128-aac"},
{"name":"SomaFM: Space Station Soma","uri":"http://ice1.somafm.com/spacestation-128-aac"},
{"name":"SomaFM: Suburbs of Goa","uri":"http://ice1.somafm.com/suburbsofgoa-128-aac"},
{"name":"SomaFM: ThistleRadio","uri":"http://ice1.somafm.com/thistle-128-aac"},
{"name":"SomaFM: Underground 80s","uri":"http://ice1.somafm.com/u80s-128-aac"}]
If you have all your web radio stations in PLS files, I’ve written a bash script that will extract the info and put it in the above form. All you need to do is to run the script with argument being the directory where the pls files are located and redirect output to a file (my-web-radio).
(Disclaimer: I’m not a bash scripting guru and it may not work for you)
#!/bin/bash
if [ $# != 1 ]; then
echo "Usage: $0 directory"
exit 1
else
searchDir=$1
fi
urlPattern="File1=(.*)"
namePattern="Title1=(.*)"
comma=""
name=""
uri=""
echo -n "["
for entry in "$searchDir"/*.pls
do
echo $comma
while read line
do
if [[ $line =~ $namePattern ]]; then
name=${BASH_REMATCH[1]}
fi
if [[ $line =~ $urlPattern ]]; then
uri=${BASH_REMATCH[1]}
fi
done < "$entry"
if [[ -n $name && -n $uri ]]; then
echo -n "{\"name\":\"$name\",\"uri\":\"$uri\"}"
fi
comma=","
name=""
uri=""
done
echo -e "\n]"
Enjoy!