From: Nico Boisselier Date: Tue, 14 Jun 2016 08:48:42 +0000 (+0100) Subject: radio_play X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=e5d639ea14c1c6b26b427fdfc570b00328cd504c;p=nb.git radio_play --- diff --git a/etc/profile.d/functions b/etc/profile.d/functions index b0e16f4f..35311c02 100644 --- a/etc/profile.d/functions +++ b/etc/profile.d/functions @@ -229,6 +229,12 @@ getexp() { } radio_play() { + local prog=`which player` + if [ -z "$prog" ]; then + case $OSTYPE in + darwin*) prog="open" ;; + esac + fi perl -e ' @_=grep{$_} split("\n"," FranceInter | http://audio.scdn.arkena.com/11008/franceinter-midfi128.mp3 @@ -250,7 +256,7 @@ if (@ARGV) { $play=shift @ARGV; } else { } $play eq "" && exit; @_ = $_[$play-1] =~ /^(.*?)\s*\|\s*(.*?)$/ or exit; print "[ $play - ".$_[0]." ]\n\n"; -exec "mplayer",$_[1]; +exec "'$prog'",$_[1]; ' "$@" }