Integrate Sirius

From MythTV Official Wiki
Jump to: navigation, search

This article is going to give you all of the info you need in order to pipe your online Sirius Satellite Radio account directly through your MythTV system. The first draft of this article is based around a Fedora Core 6 setup but it should be EASILY adapted to any distro. Please, READ THE ENTIRE ARTICLE CAREFULLY all the way to the end before you start anything.

Important.png Note: this is NOT a plug-in and is basically a hack but when completed it looks just like a plug-in.

Important.png Note: article has been significantly updated to replace Sipie with Pyxis. Pyxis is more robust including recording capabilities.

Article from 10,000 feet

What this article is...

This article IS about:

  • Setting up MythTV to play streams from Sirius Radio Online
  • How-To use programs that other people wrote (and are not affiliated with MythTV)
  • How-To integrate everything with the default MythTV menu theme

What this article is not...

This article IS NOT:

  • How-To get free access to the streams (although a Sirius online guest account will work fine)
  • How-To perfectly integrate with your particular MythTV GUI (we only cover the default menu theme)
  • A Sirius Radio Plug-in for MythTV

What you need to have


  • You only need to have an account setup at




Introducing PYXIS

A Command Line Player for SIRIUS and XM Satellite Radio
Pyxis is a wrapper that provides access to SIRIUS’ internet radio streams through the command line. 
Pyxis is written entirely in python.
Pyxis is a large rewrite of the original project Sipie written and maintained by Eli Criffield at and none of Pyxis would have been possible without Sipie’s 
authentication code. Big thank you to Eli Criffield.

The reason for Pyxis’s existence is because in recent years development on Sipie has slowed 
and as such when SIRIUS changes something the time required to bring it back to a working 
version can sometimes be a long time. 
So a couple of us decided to rip out all the largely unused portions of Sipie, refactor a lot of 
it and bring it into a more stable and adaptable package. Thus Pyxis was born when we realized 
we could no longer pretend it was still Sipie.

Let's get started!

Installing pyxis Requirements

TwoOneSix wrote a script for sipie (sipie_myth) that is for usage in MythTV. This script has been modified (below) to work with pyxis. Remember that ONLY when you get pyxis working OUTSIDE of MythTV, will it work INSIDE of MythTV. Also, make sure when you do your initial pyxis setup that you do it under your mythtv account (or whatever account runs the front end).

Installing pyxis

This is from [1]

sudo add-apt-repository ppa:pyxis/pyxis
sudo apt-get update
sudo apt-get install pyxis

Note: Should you already have python-setuptools, you may have to remove first with:

sudo apt-get remove python-setuptools

Installing Beautiful Soup

Current version of BeautifulSoup will now generate a stack trace. Appears to be reported as a bug in BeautifulSoup [2] doesn't put quotes around one style tag and BeautifulSoup crashes.

3.0.7 still works for Sipie so use the following.:

# cd ~
# wget
# tar xvf BeautifulSoup-3.0.7.tar.gz
# cd BeautifulSoup-3.0.7
# sudo easy_intall .

Configuring pyxis

You need to ensure that the configuration is done under the same user account that MythTV runs under, in my case it's the mythtv user, simple enough. Select the options for your configuration:

$ cd ~
$ pyxis

Welcome to Pyxis Setup

Your username and an encrypted password will be stored in /home/[username]/.config/pyxis/pyxisrc
You can rerun setup anytime by running: pyxis --setup

Enter username: yourUserName
Enter password: yourPassword

Please answer the following questions, pressing enter will accept the default values shown in bold text.

Enter Login Type (guest or subscriber)
Login type: subscriber

Are you using Sirius Cananda (True or False) False

Select bitrate (High or Low): High
  • Stop the stream with Ctrl+C.

Let's hack it together

OK, now we are going to write a simple shell script that we will use to make MythTV happy while talking to sipie.

Create pyxis_myth

We need to create a single executable file so find a nice place you can execute it from. Personally, I use /usr/bin. You can replace vi with gedit or kedit if you prefer a GUI text editor.

# vi /usr/bin/pyxis_myth

Now, paste in the following code:

# Script By: Josh <TwoOneSix AT thatclothingco DOT com>
# revised to work with pyxis by Eric <eric DOT dreher AT gmail DOT com>
# Used to control pyxis (Sirius radio player) from MythTV menu


# find and kill all the child processes 
killtree() {
    local _pid=$1
    local _sig=${2-TERM}
    for _child in $(ps -o pid --no-headers --ppid ${_pid}); do
        killtree ${_child} ${_sig}
    kill -${_sig} ${_pid}

# stop it all
        killtree `cat $pid_file`
        rm -f $pid_file
        return 0

#begin to play a stream
        echo "I'm about to play: $stream"
        exec /usr/bin/pyxis "$stream" &
        echo $! > $pid_file
        return 0

# If we see the kill command, kill the old processes/streams
if [ "$1" = "kill" ]; then

# If we see the play command, kill any existing streams then play the stream
elif [ "$1" = "play" ] && [ "$2" != "" ]; then
        if [ ! -e $pid_file ] ; then
                play_mythPyxis $2
                # Just to be sure it's gone...
                if [ ! -e $pid_file ] ; then
                        play_mythPyxis $2
                        echo 1>&2 '******FATAL ERROR STARTING STREAM PLAY******'
                        exit 1
        exit 0
         echo 1>&2 'Usage: ' $0 '{kill | play} stream (stream only required on play)'
         exit 127

Now you will want to make the file executable:

# chmod a+x /usr/bin/pyxis_myth

Test scripts

Now, as your mythtv user, pull up a command window and run the command we just "made" with the stream to test.

  • Usage: /usr/bin/pyxis_myth {kill | play} stream (stream only required on play)
$ pyxis_myth play octane

Do you hear the stream without having to enter a single thing in the command window? Do you see the song names in the command window and in the pop-up notifier (if you left tryPopus=True)? That's good, now use this to kill the stream:

$ pyxis_myth kill

Did you have to enter information? That's bad. Make sure you configured pyxis as your mythtv user and try again.

Setting up the MythTV GUI

At this point, you should be able to listen to (and kill) streams from the command line with no user intervention... that's 1/2 the battle. Now, we are going to hack a couple of buttons onto the default menu theme.

Important.png Note: If you are currently running .20+ chances are that you're using the default menu theme. No, not the actual MythTV theme, just the menu theme. To check out which one you're using do this in Myth: Utilities / Setup (or Setup) -> Setup -> Appearance -> and at the bottom of the first options page you will see the menu themes selection box, we will be hacking into "Default" so make sure it's set to that one. If you use classic or DVR you can change some of the commands below so that your work is being done on that particular theme (just add /themes/classic or /themes/DVR respectively to the "cd" commands below).

Backup the default theme

# cd /usr/share/mythtv
# tar cfvz default_backup.tar.gz *.xml

I use the -v option because it's an easy way to verify (VIA verbose) what files were put into the tar ball.

Hack the default theme

I'm only going to show you the 2 required changes to get this hack to work.

Important.png Note: If you're running a MythDora release these files might be located in a different directory.

Now, add the following to mainmenu.xml file.

# cd /usr/share/mythtv
# vi mainmenu.xml
      <text>Play Sirius Radio</text>
      <action>MENU siriusmenu.xml</action>

Then, create the siriusmenu.xml file (be sure to add all of the streams you want access to). Run pyxis from the command line and enter "list" to get a current channel listing. A few current channels are included as an example. Add as many as you want, but the more you add the further the "Stop" command is to navigate to.

# vi siriusmenu.xml
<mythmenu name="SIRIUS">

      <text>80s On 8</text>
      <action>EXEC /usr/bin/pyxis_myth play "80s On 8"</action>

      <action>EXEC /usr/bin/pyxis_myth play Octane</action>

      <text>The Bridge</text>
      <action>EXEC /usr/bin/pyxis_myth play "The Bridge"</action>

      <text>Outlaw Country</text>
      <action>EXEC /usr/bin/pyxis_myth play "Outlaw Country"</action>

      <text>Stop Listening</text>
      <action>EXEC /usr/bin/pyxis_myth kill</action>


Tag definitions

OK, now the tag definitions for the above xml file

  • "button" tells the theme to paint a button on the screen
  • "type" tells the theme what image to use for the button
  • "text" tells MythTV what button text to put on the screen
  • "action" tells MythTV what to do when you select the button

Why it works

You have to wrap pyxis_myth around the stream because when MythTV runs the EXEC it waits for a response before it releases the button. pyxis_myth simply kicks off the stream and tells MythTV that it's finished executing. You are going to have to modify the XML menu files if you want to add another language tag or if you want to add additional channels.

Additional Setup and Usage Notes

  1. Be patient after you choose a stream as sometimes it will take 30 - 45 seconds to start playing
  2. The stream will play until you choose the "Stop Listening" button on the GUI (or pyxis_myth kill is executed)
  3. When you're listening to a stream, it locks up the audio output device for MythTV which can be good and it can be bad, see below.
  • If you want to watch a Football game on TV and listen to the commentators from Sirius instead of the TV commentators
  • If you wanted to play 2 audio streams at once to make your own mix tapes. ;-)

Screen shots

The new default main menu: Main Menu

The Sirius stream selection menu: Sirius Menu