Note

Basm is discontinued.

I recently discovered this online radio, stereomood1, it seems to have indie music mostly. Most of them are not bad. After I checked up their API documentation1, I decided to write a Bash client.

This client has three Bash scripts:

  • OAuth.shBash OAuth library
  • StereomoodOAuth.sh — stereomood Bash OAuth library
  • Basm.sh — The main script

The first two are libraries, they are not complete but enough for Basm.sh to play music. It requires mplayer for main script, OpenSSL and Perl for libraries.

You have to run with two required parameters as follows:


$ ./Basm.sh -q happy -t mood

or you can specify library path in PATH environment if you put them altogether:


$ PATH=$PATH:/path/to/two_oauth_libs /path/to/Basm.sh -q happy -t mood

If you run Basm.sh with these two libraries in the same directory, but Basm.sh still couldn’t find the libraries, try:


$ PATH=$PATH:$PWD /path/to/Basm.sh -q happy -t mood

Basm.sh only has two parameters and they both are required.

  • -t: Type of the radio, it could be “mood”, “activity”, or “site”.
  • -q: Querying text, e.g. “happy” for mood, “relax” for activity.

You probably need to check up on stereomood, so you can know what querying text you can use.

You must have to have an account on stereomood, that’s the requirement for using APIs. In your first run of the script, you have to authorize the script, just follow the link and enter the PIN code.

The songs will be played randomly, there is no like button or ban button for you yet2. It’s a little different than on stereomood.

There are few keys you can use:

  • P - Pause
  • A - Add to library
  • N - Next song
  • Q - Quit

Here is a screenshot:

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhM-stq2Ld367yXgkoTCAhciVR-LXA-pBoaXlndNoqd1QIbp0V-_e0vuIZqpnwHfhPQfQXNnboRBhGI-TDSwLbz7lhUzdiNq2HibpsmxiuILZPqnqqmLvLohGHWoFdwuEkFdOWZTl9Ftg0/s800/Basm.png

The last line from screenshot actually is the output of mplayer.

[1](1, 2) http://www.stereomood.com/ and http://www.stereomood.com/api/documentation/ are gone.
[2]A developer from stereomood told me the corresponding APIs would be released in September or October.