Unrecognized Escape Sequence

An increasingly grumpy blog about software engineering

Somafm in the terminal

Recently I’ve been working at home with a loud infant in the next room. As a result, I’ve needed to wear headphones to concentrate. This raises the issue of finding a good source of continuous, ambient, non-commercial and enjoyable music. On this front, I’m a big fan of somafm, which meets exactly those criteria. Soma is ad-free on the basis that it’s funded by donations, so if you enjoy, I hope you’ll find time to donate yourself and keep this awesome service going.

To make listening to soma a little simpler, I’m using github user rockymadden’s useful cli utility; and I’ve added a couple of useful functions to my .zshrc:

function soma-play() {
    /home/ben/Development/somafm-cli/build/bin/somafm listen "$@" &
}

function soma-stop() {
    ps xao pgid,cmd | grep "bash /home/ben/Development/somafm-cli/build/bin/somafm" | grep -v "grep" | head -n 1 | awk '{ print -$1 }' | xargs kill -15
}

Which can then be used to start soma playing in the background (e.g. listening to the groovesalad station), and to stop it:

soma-play groovesalad
soma-stop