Page 2 of 2

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

Posted: Mon Feb 08, 2010 9:48 pm
by mightyohm
ilinux, you are awesome. Thank you for contributing this, I will have to test it out on my radio. :geek:

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

Posted: Tue Feb 09, 2010 12:20 am
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

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

Posted: Thu Jul 28, 2011 10:50 pm
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

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

Posted: Fri Jul 29, 2011 10:19 am
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.

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

Posted: Tue Aug 02, 2011 2:18 am
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