Pandora-UPnP sees the light of day

This is becoming a very bad habit.  Have a crazy and only semi useful idea one night and get a terrible itch all the next day until I can sit down and work on it.  In this case I had an itch all day while at the gym and at work and then a passover seder.   Once I finally sat down at night though everything actually came together very very quickly.

I started with vanilla pianobar, an application which can play pandora music and be controlled through an external fifo file descriptor.  I then pulled some code from the pyPianobar/qtPianobar projects and stripped it down to be a barebones python API to pianobar.  After about 2 hours of work, maybe less, I could control pandora playback on my speakers via ipython.

I spent another 90 minutes this evening (after a lovely passover seder) and, using MPD-UPnP’s code as a model, was able to expose about 70% of pandora’s usefullness over UPnP and controllable through Zhaan.  Zhaan can pause/play, stop, next, list and change stations, view current song title/artist/album, view current elapsed time over total time for the current song.  The only things that are missing are some bug fixes in station changing (it works only semi-reliably right now, but it does work sometimes) and the “like it/hate it” features of pandora.  The favorites/”liking” of songs doesn’t map so well to the native UPnP AVTransport API nor to the Zhaan UI so I am inclined to just leave that out.

So lets recap Zhaan’s (and any UPnP Controller’s) capabilities now a days:

  • Browse any General UPnP Media Source (rygel, mediatomb etc.)
  • Play media to any UPnP Media Renderer (rygel, gmediarenderer etc.)
  • Control music from MPD, the Music Playing Daemon (via MPD-UPnP)
    • Browse current MPD playlist
    • Browse all other playlists
    • Browse all songs
    • Send media from another UPnP Media Source to MPD
    • Send media from MPD to another UPnP Media Source
  • Control music from Pandora, the Internet Radio Service (via Pandora-UPnP)
    • Browse and change station
    • Pause/Play/Next
  • Display current song and song progress like a normal media player for any of the above media renderers (mpd, pandora, UPnP Media Renderer)
  • Work on Maemo via hildon/gtk
  • Work on Linux via GTK+

The largest missing feature I can think of is album art, but that’s coming.  That and it to actually work on the N900, but that’s still in PyMaemo’s hands.

And of course all of this work is available on my GitHub.  You’ll notice two new repositories (links on the righthand side) for the pyPandora and Pandora-UPnP repositories.

2 thoughts on “Pandora-UPnP sees the light of day”

  1. Zach-
    I’m trying to stream Pandora to an Olive Opus 4 media server over UPnP. I’m not a programmer, so most of your post is over my head. Could you walk me through installation to see if this will work for me?
    Thanks. Derek

  2. Hi Zach,

    I’ve managed to successfully start server.py which starts pianobar with autoplay.

    But I can’t see Pandora Radio available via different UPnP controllers, although I see that it propagates itself via multicast udp on port 1900 to my LAN (had to change interface name in one of .py files) .

    With different UPnP browser tools I can see Pandora Radio to be available, but probably “device description” is not fully UPnP compliant as none of DLNA/UPnP controllers wont show/allow to select Pandora Radio?

    I’d like to ask if you had success with other UPnP controller than Zhaan?
    I’m using iPhone with DLNA/UPnP as media controller.

    pyPandora and Pandora-UPnP is installed on Ubuntu 10.04.2LTS with python2.6.

    Here are some messages I’m getting on console where server.py is running:

    Position (Service:)
    Position (Action:)
    Traceback (most recent call last):
    File “server.py”, line 89, in handle_position_request
    item.set_title(getattr(CLIENT, “title”, “”))
    AttributeError: ‘main.GUPnPDIDLLiteItem’ object has no attribute ‘set_title’

Leave a Reply

Your email address will not be published. Required fields are marked *