How to stream radio from the command line

audiocommand linestreaming

There is an iMac in our lab at university, running Mac OS X 10.7 Lion.

It is never used, so we have taken to using it to play music, as we can SSH to it, and it does not require any permissions to play music (using afplay).

Is there any way to stream radio, or any other music stream from the command line?

Best Answer

While not (strictly speaking) playing from the command line, you could use a set of AppleScripts (or AppleScript calls) wrapped in shell scripts to control a GUI player or website. In the likely case that the player or site doesn't directly support AppleScriptability, you can use AppleScript GUI scripting to control the mouse and keyboard.

If you're looking at a "normal" streaming radio station (i.e, one that has a downloadable file that specifies the stream), you can put that in iTunes and use its (relatively excellent) AppleScript dictionary to remotely control it.

With either option, if you want to get fancy, you can use remote scripting to send Apple Events from an arbitrary source machine to control your radio-iMac.