Lazy Sunday: How I Listen to SiriusXM in the Terminal

Happy Lazy Sunday, everyone.

I've mentioned before that I often listen to SiriusXM channels like Octane and Liquid Metal while I'm coding, and today I wanted to share a bit about how I actually do it. It involves one of my favorite things: heavily modifying an existing open-source project to suit my needs.

siriusxm_refresh_s-subway.jpg

The project is a Python library called sxm-client, originally from AngellusMortis on GitHub. I've forked it and made a ton of changes, and my version is available here:


The Code: Modernizing the Client

My main goal was to modernize the library and make it work the way I wanted. This involved a number of significant changes.

screenshot-20250831-103724.png

  • Build System: I migrated the project from Flit to uv_build and updated the pyproject.toml file. This gives it a more modern and robust build process.
  • Dependencies: All the dependencies have been updated to their latest versions, and the project is now fully compatible with uv, which you all know I love.
  • Command-Line Interface: The original CLI was a single function. I refactored it using Typer to have distinct, self-documenting commands like sxm server, sxm list-channels, and sxm now-playing octane. Getting the now-playing command to work correctly required quite a bit of effort to parse the live channel data.
  • Data Models: The library's internal data models were rewritten to use Pydantic V2, which makes the code cleaner and more reliable when handling data from the SiriusXM API.
  • Cleanup: I removed a lot of old, unused files like the devcontainer configuration to simplify the project structure.

My 3-Step Setup

With the code updated, here's how I use it to listen to music in my terminal.

Step 1: Run the Server as a Service

I run the sxm server command as a systemd unit. This ensures it's always running in the background, listening for connections, and making SiriusXM think I'm just a normal web browser/player. 🤣

[Unit]
Description=Sirius XM system daemon
After=syslog.target network.target

[Service]
Type=simple
ExecStart=/home/thecrazygm/.local/bin/sxm server
RestartSec=3
Restart=always

Environment=SXM_USERNAME='your-username'
Environment=SXM_PASSWORD='your-password'

[Install]
WantedBy=default.target

Step 2: Create a Playlist for MPD

Next, I set up a simple M3U playlist for my Music Player Daemon (MPD) to read from the local sxm server.

#EXTM3U
#EXTGRP:SiriusXM

#EXTINF:0,SiriusXM Octane
http://localhost:9999/octane.m3u8

#EXTINF:0,SiriusXM Liquid Metal
http://localhost:9999/hardattack.m3u8

Step 3: Play Music with ncmpcpp

Finally, I can play the streams using any MPD client. I personally use ncmpcpp, a fantastic terminal-based client. I can just type mpc play 1 for Octane, or mpc play 2 for Liquid Metal.

screenshot-20250831-103741.png


But Why?

I know what you're thinking. "Why go through all this trouble when you could just use Spotify or YouTube Music like a normal human?"

There are two reasons. First, I actually like some of the DJs, like Caity Babs and Jose "Metal Ambassador" Mangin. They add a human touch that I miss in algorithm-driven playlists.

Second, and more importantly: because I wanted to see if I could.

As always,
Michael Garcia a.k.a. TheCrazyGM

0.13592267 BEE
2 comments

That is notably badass that you refactored a previous open-source application to meet your needs now, my friend, I love that sort of thing! Given that the terminal is your de-facto preferred environment, it makes perfect sense to me, and I also know how much you appreciate surmounting challenges like this, so kudos! 😁🙏💚✨🤙

0.00024747 BEE

Congratulations @thecrazygm! You received a personal badge!

https://images.hive.blog/70x70/https://hivebuzz.me/badges/pud.png?202509010920You powered-up at least 10 HIVE on Hive Power Up Day!
Wait until the end of Power Up Day to find out the size of your Power-Bee.
May the Hive Power be with you!

You can view your badges on your board and compare yourself to others in the Ranking

Check out our last posts:

0.00024456 BEE