What's the easiest way to add internet radio station?

Discussion about my Wifi Radio project at http://mightyohm.com/wifiradio/ or my WL-520gU talk at NOTACON.
User avatar
mightyohm
Site Admin
Posts: 1064
Joined: Fri Apr 03, 2009 10:29 pm
Location: Seattle, WA
Contact:

Re: What's the easiest way to add internet radio station?

Post by mightyohm »

ilinux, you are awesome. Thank you for contributing this, I will have to test it out on my radio. :geek:
ilinux
Posts: 55
Joined: Mon Jul 06, 2009 2:36 am

Re: What's the easiest way to add internet radio station?

Post by ilinux »

Hi,

I made also an m3u version

My script is located here: http://www.sandrofabbro.com/wrtradio/scripts/mpc_m3u

To install:
wget http://www.sandrofabbro.com/wrtradio/scripts/mpc_pls -O /usr/bin/mpc_m3u
chmod +x /usr/bin/mpc_m3u

To use:
mpc_m3u http://www.tv-radio.com/station/france_ ... 3-128k.m3u

It will add the first url to mpd.

Run it before mpc play
dddesign
Posts: 10
Joined: Wed Apr 06, 2011 3:33 pm

Re: What's the easiest way to add internet radio station?

Post by dddesign »

I'm looking for these two scripts (pls, m3u), too. but the link to the scripts isn't working anymore. where can I find it? or does someone else have these scripts to share? thanks
User avatar
gerben
Posts: 164
Joined: Sat Oct 16, 2010 8:41 am
Location: Netherlands

Re: What's the easiest way to add internet radio station?

Post by gerben »

this seems to work too:

Code: Select all

url=`wget --quiet http://listen.di.fm/public3/vocaltrance.pls -O - | grep -o -m1 'http://.*'`
mpc add $url
combining it into a nice script is up to you.
dddesign
Posts: 10
Joined: Wed Apr 06, 2011 3:33 pm

Re: What's the easiest way to add internet radio station?

Post by dddesign »

I found some script code by ilinux here in the forum and made my own script out of it.
with this you can add all url and if it is a m3u or a pls it will parse it and add the content.

you can get the script by:
wget http://www.dddesign.ch/Js_retroplayer/mpc_add

or copy/paste this code:

Code: Select all

#!/bin/sh

if [ "$1" != "" ] ; then

suffix=${1##*.}

if [ "$suffix" = "mp3" ] ; then
	echo "it's a 'mp3' file"
	mpc add $1
else                        
	#Fake useragent
	alias wget='wget -U "Mozilla/5.0 (X11; U; Linux i686; it; rv:1.9.1.7) Gecko/20100106 Ubuntu/9.10 (karmic) Firefox/3.5.7"'

	#Download parse and add to mpd
	#result=$(wget -q $1 -O-)
	#echo "$result"

	if [ "$suffix" = "pls" ] ; then
		echo "it's a 'pls' file"
		wget -q $1 -O- | grep "File1=" | sed -e 's/^File[1]*=//' | tr -d "\r" | mpc add
	elif [ "$suffix" = "m3u" ] ; then
		echo "it's a 'm3u' file"
		wget -q $1 -O- | cat | xargs -r mpc add
	else
		echo "file suffix not know, try it anyway"
		mpc add $1
	fi
fi

else
	echo "USAGE: mpc_add http://www.example.com/file.mp3"
	echo "USAGE: can add url to .mp3 .m3u .pls"
fi

Post Reply