]> git.nbdom.net Git - nb.git/commitdiff
radio_play
authorNico Boisselier <nico@dhcp-192-168-4-150.semantico.net>
Tue, 14 Jun 2016 08:48:42 +0000 (09:48 +0100)
committerNico Boisselier <nico@dhcp-192-168-4-150.semantico.net>
Tue, 14 Jun 2016 08:48:42 +0000 (09:48 +0100)
etc/profile.d/functions

index b0e16f4f072bd7d32b5704e19e5e6f63cef87dab..35311c02cc1b47a2ffd2451648c46938b184d0c8 100644 (file)
@@ -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];
 ' "$@"
 }