1

If I run this in terminal it works fine

/Applications/VLC.app/Contents/MacOS/VLC -I rc http://open.live.bbc.co.uk/mediaselector/5/select/mediaset/http-icy-mp3-a/vpid/bbc_radio_fourfm/format/pls.pls --sout '#standard{mux=raw,access=file{overwrite},dst=/Users/person/Documents/scripts/r4.mp3,display=novideo}' --run-time=1800 --stop-time=1800

But if I run it in Automator (using Run Shell Script) I get this result and it doesn't work:

 "VLC media player 2.2.1 Terry Pratchett (Weatherwax)",
 "Command Line Interface initialized. Type `help' for help.
",
 "> Shutting down.
"

I have messed around with PATH and .bash_profile to no avail. What am I doing wrong?

3
  • 1
    Please add the complete content of your automator action
    – klanomath
    Nov 14, 2015 at 14:42
  • It's just Run Shell Script /bin/bash Then the code above
    – n1g_
    Nov 14, 2015 at 17:07
  • Would it be easier to have it run a bash script? Or launch a term and do it from Terminal. It can still be non-interactive.
    – cde
    Nov 16, 2015 at 6:44

2 Answers 2

2

It's most likely due to the VLC RC client wanting an Xterm interactive shell instead of a non-interactive shell, or some weirdness with the VLC OS X app still attempting to launch (It's bouncing in my dock while it runs).

In any case, a simple work around is to have automator launch a script to run in terminal.

The script would be simply:

#/bin/bash
/Applications/VLC.app/Contents/MacOS/VLC -I rc http://open.live.bbc.co.uk/mediaselector/5/select/mediaset/http-icy-mp3-a/vpid/bbc_radio_fourfm/format/pls.pls --sout '#standard{mux=raw,access=file{overwrite},dst=/Users/person/Documents/scripts/r4.mp3,display=novideo}' --run-time=1800 --stop-time=1800

It should have execute permissions (chmod +x)

Then from Automator, you launch it like you normally would. In this case, I had Automator "Run Shell Script" of

open -a Terminal /path/to/script.sh

Note you may want to add the --play-and-exit option, otherwise VLC will stay open even after the 1800 seconds. By default, it will stop at the end of the playlist and wait. --play-and-exit will tell it to quit when the playlist ends (in this case a single file).

Alternatively, you can directly launch the script with a double click, skipping Automator completely, if you change the suffix to .command. That may be more direct, depending on your actual goal.

0

I just want to record the radio at scheduled times. This seems to do this trick for me, just as you suggested:

open -a Terminal /Users/me/Documents/scripts/r4.sh

It does fire up its own Terminal window, which I was hoping to avoid, but I can live with that.

Thank you.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .