1

Topic: Choose a player from the installed ones

Hello hyperusers, I'm creating a script to play free radios.

I'm having the following problem with part of the code. Here is the variable PLAYER2, which should ferificar which of the players are installed, between cvlc, mpv or mplayer and play the Link streaming with the chosen player.

Follow the code:

PLAYER2 () {
    for p in cvlc mpv mplayer; do
      if type "${p}" &>/dev/null; then
         PLAYER2=$(type -p "${p}")
         break
      fi
    done
}

subsequently execute the next command when selected by the user.

$PLAYER2 http://dir.xiph.org/listen/5907535/listen.m3u

2

Re: Choose a player from the installed ones

pekman wrote:

Hello hyperusers, I'm creating a script to play free radios.

I'm having the following problem with part of the code. Here is the variable PLAYER2, which should ferificar which of the players are installed, between cvlc, mpv or mplayer and play the Link streaming with the chosen player.

Follow the code:

PLAYER2 () {
    for p in cvlc mpv mplayer; do
      if type "${p}" &>/dev/null; then
         PLAYER2=$(type -p "${p}")
         break
      fi
    done
}

subsequently execute the next command when selected by the user.

$PLAYER2 http://dir.xiph.org/listen/5907535/listen.m3u

MPV = awesome smile

HyperbolaBSD: The Future of Secure Libre Lightweight Operating Systems!