Close
0%
0%

Python SomaFM Player

Listen to the unofficial soundtrack of Hackaday in your terminal.

Public Chat
Similar projects worth following
SomaFM is independent, listener-supported, Internet radio. Whether you're looking for some electronic beats to backdrop your latest hack, or chill out with some Celtic tunes, SomaFM has a channel for you.

I created this player because I wanted something simple and lightweight that I could leave running in a terminal, but also because I was looking for an excuse to get more comfortable with Python 3.x. It's since evolved to include thoroughly unnecessary features such as support for streaming to Chromecast devices and desktop notifications.

For the latest version of the SomaFM script, check the GitHub link in the sidebar. This page is intended as a place for me to comment on changes/fixes I'm working on, as well as a chance to potentially get some feedback from the community.


As of right now, the script has only been tested on Linux. I'd be interested in hearing from users of other operating systems who might have some insight about getting the script to work on their systems.

  • Version 1.6 Released

    Tom Nardi05/17/2020 at 20:13 0 comments

    After a few months of puttering around, I'm ready to call version 1.6 stable. I've also added the project to PyPi, so you should be able to install it with the command:

    pip3 install somafm

    A lot of new things have been added in version 1.6, but the biggest one is probably support for other media players (mpg123/mpv) in addition to MPlayer. The script will still use MPlayer by default, but if it's not installed and one of the others is, there's now a fallback. There are some drawbacks though, as mpg123 doesn't support high-quality AAC streams and mpv is slow and overall a bit janky. But at least the option is there.

    You can now turn off track sync when streaming to Chromecast devices, which is good if you want to play media "headless". Desktop notifications won't pop up for Station IDs (oh, and I fixed broken desktop notifications), and there's even some experimental support for custom notification commands which could potentially be used for things like showing track data on an external display (that's what I'm planning on, anyway).

    Give it a shot and let me know what I broke.

  • Christmas is Saved

    Tom Nardi12/10/2019 at 18:09 0 comments

    The holidays are upon us, and that means even SomaFM has been playing the following songs pretty regularly (albeit in forms you probably haven't heard before):

    Baby It's Cold Outside

    Santa Claus Is Comin’ To Town

    It's the Most Wonderful Time of the Year

    It's Beginning to Look a Lot Like Christmas

    Thanks to these holiday classics, I finally noticed a bug that's been there from the very beginning. I was using apostrophes as delimiters when parsing the stream info coming out of MPlayer, which obviously (in hindsight, anyway) means any song title with said punctuation was getting truncated.

    I've changed how the MPlayer output is parsed which fixed the issue, and the new version is already up on GitHub. Just in time for any holiday parties you might have planned.

  • Station ID Highlighting

    Tom Nardi08/12/2019 at 19:35 0 comments

    One of the features I snuck in for v1.5 was the ability to highlight known station IDs, the little clips played to remind you what channel you're listening to. They are often used to add a little color to the listening experience by playing various messages or clips. For example when listening to DEF CON Radio, the songs are intermixed with short sound bites pulled from talks given at previous cons.

    When looking back at an hour worth of streaming DEF CON Radio, the new highlighting feature makes this readily apparent:

    Originally I had planned to simply omit these clips from the track listing, but I think highlighting them ends up being more useful. Or at least, interesting.

    On a related note, not all the channels start their ID with "SomaFM", and I've only populated the list with the ones I've seen while listening. But it's easy to add new IDs to the list to check for, so perhaps that's something the community will eventually be able to assist with through pull requests.

  • Life after v1.5

    Tom Nardi08/10/2019 at 03:02 0 comments

    I made the stable v1.5 release in honor of SomaFM's annual live stream at DEF CON, and I have to say, the program already has progressed a lot farther than I had initially intended. It started as a quick little script to keep me from having to use the web player, and now somehow it's evolved to the point I'm using it to play Groove Salad on my Chromecast.

    Still, there are a couple things I'm thinking of adding:

    • Logging track info to file
    • "Headless" Chromecast mode, that starts Cast and then exits
    • Recording streams (I've seen other players with this feature)

    I initially wanted to support player backends other than mplayer, but honestly unless somebody requests it, I'm not sure there's much point.

View all 4 project logs

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates