Adding webradios by writing files .pls .m3u into a directory

General discussion about RuneAudio. Do not post any support or feature requests here.

Re: Adding webradios by writing files .pls .m3u into a direc

Postby xan » 16 Oct 2015, 22:35

A bit late but maybe someone is still interested... Here is not a python script but a small bash-script that scans the Webradio directory and adds the the radio stations to redis.

Code: Select all
#! /bin/bash

for FILE in /mnt/MPD/Webradio/*.pls;
do
   NAME=$(echo $FILE | grep -Po "(?<=/)[^/]+(?=\.)");
   echo "station: $NAME";
   URL=$(grep -Po "(?<=File1=).*$" "$FILE");
   echo "url: $URL";
   redis-cli hset "webradios" "${NAME}" "${URL}";
done;
mpc update webradio;

You can copy that into a file called "updateWebradios" in the /bin directory (/bin/updateWebradios) chmod it to 755 and then you can call it by just typing "updateWebradios" into the command line.

Or you can just copy that as one line into the command line and hit enter
Code: Select all
for FILE in /mnt/MPD/Webradio/*.pls; do NAME=$(echo $FILE | grep -Po "(?<=/)[^/]+(?=\.)"); echo "station: $NAME"; URL=$(grep -Po "(?<=File1=).*$" "$FILE"); echo "url: $URL"; redis-cli hset "webradios" "${NAME}" "${URL}"; done; mpc update webradio;


After you have run the script you still have to go to "RESOURCES" and click "update MPD library" to get the stations visible. I am working on that...
xan
 
Posts: 1
Joined: 10 Nov 2014, 23:12

Re: Adding webradios by writing files .pls .m3u into a direc

Postby surfninja » 19 Oct 2015, 20:06

this is great xan. I was going to write a perl version for the forum but didn't know the redis set syntax. Now I do.

thanks for posting.
surfninja
 
Posts: 64
Joined: 13 Mar 2015, 22:06
Location: Twin Cities

Re: Adding webradios by writing files .pls .m3u into a direc

Postby Sprigo » 02 Nov 2015, 22:28

Well done xan! This saves me so much time as I was having to add them manually each time. :D
Sprigo
 
Posts: 14
Joined: 22 Sep 2015, 15:33

Re: Adding webradios by writing files .pls .m3u into a direc

Postby c-moll » 25 Mar 2016, 11:00

I've added my webradio folder according to the above instructions. But now the stations are listed in a random order. How can I sort the list?

Chris
Raspberry Pi 3B - HifiBerry Amp+ - Raspberry Pi 7" Touchscreen
User avatar
c-moll
 
Posts: 10
Joined: 01 Oct 2014, 13:30
Location: Germany

support RuneAudio Donate with PayPal

Previous

Return to General discussion

Who is online

Users browsing this forum: No registered users and 0 guests