This fork has been modified to copy the AAC audio directly instead of converting to MP3, allowing for no quality loss from what is broadcast. ID3 tags are not available. The below readme is unmodified.
This script creates a server that serves HLSstreams for SiriusXM channels. With an optional configuration file, the recording mode can record shows from specific channels and even populate ID3 tags on the output file for you.
Python libraries:
- eyeD3
- requests
- tenacity
If you wish to record streams, you'll need to have ffmpeg installed with LAME support compiled in.
Install the Python dependencies
pip install -r requirements.txt
You can store your XM credentials as environment variables if you don't want
to use the arg parser. Use SIRIUSXM_USER
and SIRIUSXM_PASS
.
export SIRIUSXM_USER="username"
export SIRIUSXM_PASS="password"
If you wish to record shows, read this section
The following is an example config.json
{
"bitrate": "160k",
"shows": [
"Soul Assassins"
],
"tags": {
"DJ_Muggs_&_Ern_D": {
"artist": "DJ Muggs & Ern Dogg",
"album": "Soul Assassins Radio",
"genre": "Hip-Hop",
"track_count": 1
}
}
}
The bitrate
(required) can be whatever you wish (i.e. 128k, 192k, 256k). Keep in mind
that a higher bitrate equals a higher file size.
Your show
(optional) names are matched using a case insensitive regular expression, so you only need to
match the title of your show partially.
The tags
(optional) section uses the short title
from the XM API as the key for tagging data. You can get this from the API
yourself or just add it after you've added a show (the short title is in the
filename). Each entry in the tags list will be matched on the short
title and your MP3 file will be tagged with whatever you enter for
artist, album and genre.
If you're just addin ga new entry to the tags list, set the track_count to 0. The tagging code will increment this value for each new occurrence of the show.
python sxm.py -u myuser -p mypassword
Then in a player that supports HLS (QuickTime, VLC, ffmpeg, etc) you can access a channel at http://127.0.0.1:8888/channel.m3u8 where "channel" is the channel name, ID, or Sirius channel number.
python sxm.py -u myuser -p mypassword -c channel -r
Use the configuration json (config.json
) to specify bitrate, programs
to record and tagging details. Shows are dumped locally using the short title
of the show which was recorded (i.e. 20180704180000-My_Program.mp3
)
Tagging occurs once the ffmpeg stream has been closed.
python sxm.py -u myuser -p mypassword -l
Example output:
ID | Num | Name
big80s | 8 | 80s on 8
90salternative | 34 | Lithium
altnation | 36 | Alt Nation