Since I went to the (mild) trouble of setting up whole house audio and then refining it, it’s been a mixed blessing to find internet radio stations or music streamers. It’s great to be exposed to new and interesting music; it sucked that I couldn’t easily use my whole-house setup to listen. Whether it is a stream from SOMA.fm, a cool twitch DJ, or another internet radio station (say, from here or here).
Then I ran across this post from 2013; between that, improvements in
mpd itself, and the wonderful utility streamlink I was able to create a bash utility to tie it all together and be pretty flexible. It is also designed to work without conflicting with MPDQ, my auto-queue program.
The utility is called (so imaginatively)
stream_to_mpd. It uses
zenity to provide some choices and options, but it’s designed that it can totally happen in the background as well.
Usage is pretty simple:
stream_to_mpd [OPTIONS] [STREAM_URL]. The options are:
–host PASSWORD@HOST : You can substitute –host "$MPD_HOST" if it is set
–mpd : skip right to MPD output
–playlist : skip right to adding stream URL to a file/playlist
–native : Throw the result to streamlink (probably not needed, but hey)
–bookmarks : use instead of a stream URL; they are hardcoded in at the moment
For example, I really enjoy Biochili’s gothy DJ sets on Mondays and Thursdays (the community there is also amazing). I could simply plug in
stream_to_mpd https://twitch.tv/biochili and follow the GUI prompts for where to send the stream. Or, since I know I want to send it to a specific MPD server, I could instead type
stream_to_mpd --mpd --host MPDPASSWORD@MYMPDSERVER https://twitch.tv/biochili
That will send the stream to the currently playing queue, move it to the top of the queue, and play it (leaving everything else untouched).