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.
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:
My main goal was to modernize the library and make it work the way I wanted. This involved a number of significant changes.
pyproject.toml
file. This gives it a more modern and robust build process.uv
, which you all know I love.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.With the code updated, here's how I use it to listen to music in my terminal.
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
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
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.
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
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! 😁🙏💚✨🤙
Congratulations @thecrazygm! You received a personal badge!
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: