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
- 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.