Code Monkey home page Code Monkey logo

siriusxm's Introduction

SiriusXM

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.

Requirements

Python libraries:

  • eyeD3
  • requests
  • tenacity

If you wish to record streams, you'll need to have ffmpeg installed with LAME support compiled in.

Installation

Install the Python dependencies

pip install -r requirements.txt

Configuration

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

Example configuration

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.

Usage

Simple HLS server

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.

Start the server in ripping mode

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.

List all XM channels

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.