Author Topic: SiriusXM  (Read 6370 times)

kyfalcon

  • Guru
  • ****
  • Posts: 390
    • View Profile
SiriusXM
« on: February 15, 2011, 07:01:59 pm »
Sirius/XM now has the ability to listen via the web. The new page uses a flash plugin for playing a particular stream. There is a username/password box and then it allows you to choose a station much like a jukebox. After 90 minutes of listening it will ask you if you are still listening. Is there a way to incorporate this into Linuxmce similar to HULU? Also, the place I listen most I don't have a keyboard mouse. Is it possible to use the remote with flash? Is it possible to pre-populate the username/ password?

Thanks Kevin

l3mce

  • NEEDS to work for LinuxMCE
  • ***
  • Posts: 1081
    • View Profile
Re: SiriusXM
« Reply #1 on: February 15, 2011, 07:52:08 pm »
Sounds like a fun project... but I think these guys are busy crushing bugs rather than feature enhancements. It sounds pretty easy, so I will look into it, because my powers are weak. I know that flash is... glitchy at best in firefox.
I never quit... I just ping out.

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5497
  • DOES work for LinuxMCE.
    • View Profile
Re: SiriusXM
« Reply #2 on: February 16, 2011, 07:28:55 am »
A cursory examination reveals that the streaming protocol for Sirius XM is exposed via SOAP.

Look at Sipie for an example of how it was solved in Python, and make an equivalent C++ device.

However, to do this right, I would suggest making a Sirius Plugin, and a Sirius Streamer, that can provide a URL that can be passed via MH Play Media. This would allow it to work on all LinuxMCE devices, including Squeezeboxes. Look at existing code for a reference.

Grab usernames and passwords from Users, so that each user can have their individual subscription preferences.

Point being, this is more than possible, and can actually be done right.

-Thom

kyfalcon

  • Guru
  • ****
  • Posts: 390
    • View Profile
Re: SiriusXM
« Reply #3 on: February 16, 2011, 07:35:37 pm »
Thom,

It has been a while since I have coded in C++. But would be more than willing to give this a go when I get some spare time. I will try to look at the wiki and gather as much info/knowledge as possible, but I am sure I am going to have many questions.

Kevin

kyfalcon

  • Guru
  • ****
  • Posts: 390
    • View Profile
Re: SiriusXM
« Reply #4 on: February 16, 2011, 08:47:35 pm »
Thom,

When you say it is exposed through SOAP, does this mean the Flash plugin uses a web service to communicate with the Sirius server? Meaning I could potentially create my own client as long as I know the web services to call? Is this what you mean by the streamer?

Kevin

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5497
  • DOES work for LinuxMCE.
    • View Profile
Re: SiriusXM
« Reply #5 on: February 16, 2011, 10:22:17 pm »
Yes.

Again, study Sipie.

-Thom

l3mce

  • NEEDS to work for LinuxMCE
  • ***
  • Posts: 1081
    • View Profile
Re: SiriusXM
« Reply #6 on: February 16, 2011, 10:47:18 pm »
Look also at pyxis
I never quit... I just ping out.

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5497
  • DOES work for LinuxMCE.
    • View Profile
Re: SiriusXM
« Reply #7 on: February 17, 2011, 12:02:57 am »
also learn the MH Play Media command in the Media PlugIn. This is what you will need to use to actually take the stream and send it to a player.

If it is as I suspect, you'll get back an MP3 stream after sending what you want to get information wise by SOAP, this can be passed to the MH Play Media command to send the appropriate commands to the target player, rather than having a player embedded into the Sirus XM device.

-Thom

kyfalcon

  • Guru
  • ****
  • Posts: 390
    • View Profile
Re: SiriusXM
« Reply #8 on: February 17, 2011, 01:18:02 am »
Thx.

What tool did you use to capture the Flash http traffic to determine they were using a SOAP based web service?
I will try to take a look at that stuff in the coming days.
« Last Edit: February 17, 2011, 01:20:21 am by kyfalcon »

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5497
  • DOES work for LinuxMCE.
    • View Profile
Re: SiriusXM
« Reply #9 on: February 17, 2011, 03:08:07 am »
i just took a look at the Sipie code All of 5 seconds.

-Thom

kyfalcon

  • Guru
  • ****
  • Posts: 390
    • View Profile
Re: SiriusXM
« Reply #10 on: February 17, 2011, 04:04:08 pm »
Took a look at Pyxis since Sipie has basically been deprecated. My game plan is to mess with this in Java since that is what I am most familiar with at the present. Once I get something working there and understand the communication, I will port it to C++ which shouldn't be to big a deal. Once that is done I will work on understanding MH player and streamer.

huh

  • Guru
  • ****
  • Posts: 235
    • View Profile
Re: SiriusXM
« Reply #11 on: March 07, 2011, 12:29:53 am »
Have you had a chance to look into this?

I started a wiki page- but am clearly seeing that I don't even know where to begin.
http://wiki.linuxmce.com/index.php/SiriusRadio

It looks like the StreamHandler.py file just runs a command titled self.command that feeds the stream and timestamp to mplayer.  I was trying to follow the Shoutcast Radio Plugin to see how that called xine or mplayer and mimic the process, but I don't understand the function calls...


tschak909

  • LinuxMCE God
  • ****
  • Posts: 5497
  • DOES work for LinuxMCE.
    • View Profile
Re: SiriusXM
« Reply #12 on: March 07, 2011, 12:40:41 am »
Basically,

Shoutcast Plugin merely provides a data grid to the media plugin.

Since Shoutcast is merely sending playlist files, and since Xine can read those playlist files, the Shoutcast PlugIn merely forms a URL to the playlist on the Shoutcast server.

This will not work for Sirius XM.

You will need to investigate how the stream is loaded and decoded. Based on this, you may be able to make a sort of proxy that you can pass to MH Play Media (passing a URL in the Filename device data parameter.)

Basically, MH Play Media, will send a CMD Play Media command to the Plugin that handles the media type for an entertainment area, normally this is the Xine PlugIn...the Xine Plugin then finds any Xine Players in the target entertaninment area, and sends a CMD_Play_Media to them.

To see the effect, go to the web admin, go select the media plugin in the device tree, and select "Send Command" and select "MH Play Media" ... you'll see the parameters you can pass to the command.

-Thom

huh

  • Guru
  • ****
  • Posts: 235
    • View Profile
Re: SiriusXM
« Reply #13 on: March 07, 2011, 05:03:25 am »
Thanks Thom-

Based on MH Play Media, it looks like the only field I would populate is #13 Filename- the others- PK_Device and EntertainArea would be set by wherever we wanted the media played.  Songs would not be repeated or queued- the idea would be to just stream, so #117 and #253 are not needed.

As for populating #13 Filename- the authors of Pyxis made it very simple (this is from StreamHandler.py):

Code: [Select]
       print "Starting mplayer..."
        if self.options.record:
            stream = stream.replace(' ','') + '_'
            now = datetime.datetime.now()
            filename = stream + now.strftime("%Y-%m-%d_%H-%M-%S") + '.wav'
            mpc = "%s '%s'" % (self.command + filename, url)
        else:
            mpc = "%s '%s'" % (self.command, url)
        log('mpc = %s' % mpc)
        self.pipeopen(mpc)

And from the Config.py file, the above just feeds the stream to mplayer:

Code: [Select]
       self.config.set('mediaplayer', 'command', '/usr/bin/mplayer')

It seems like a simple script that run "pyxis" and waited for the user to select a channel to import to the prompt at the terminal- then that channel was fed into #13 Filename above, you would have the start to a working Sirius integration.

So, where do I go from here?  How do I get LMCE to grab this stream?  

Edit 1:  If you type in "print mpc" immediately after defining mpc under "else" in the above code, it prints out the actual address of the stream.

Edit 2:  You can pass the pyxis python script the stream when you start the program.  For example, you can type in
Code: [Select]
pyxis "espn radio" and the espn stream will automatically start when pyxis loads.
« Last Edit: March 07, 2011, 05:47:35 am by huh »

kyfalcon

  • Guru
  • ****
  • Posts: 390
    • View Profile
Re: SiriusXM
« Reply #14 on: March 07, 2011, 06:47:04 pm »
Sirius and XM have changed their web site in the past month. Not sure the streams in Pyxis or Sypie will work anymore. XMTuner works against the new Sirius/XM servers. I have used FiddlerCap to capture the outgoing http communications. Another program that I think works is XMmicroplayer. I haven't had a chance to mess with this lately. I am able to pull the current information as far as stations and currently playing. Can even find small icons, am working on finding larger ones. Once I get time I also want to try and get the stream working. I am doing all of this through java currently since it is what I am currently programming in.