rhythmboxWebRemoteControl

  • Launchpad Entry: Rhythmbox Web Remote Control

  • Created: 02 October 2008

  • Contributors: Adrian

  • Packages affected: Possibly Rhythmbox - this can be implemented as a plugin.

Summary

Rhythmbox is a great MP3 library and playback tool, but lacks a remote Web interface, which would allow for easy remote control from a wide range of wireless devices which have built in Web browsers.

Release Note

The new Rhythbox Web interface allows you to control Rhythmbox remotely using a wide range of mobile wired and wireless devices, from Linux, Windows and Apple laptops / netbooks through to embedded devices which have a Web browser such as the Nintendo WII / Nintendo DS, Nokia N Series Mobile Phones, Windows Smart Phones and PDAs.

Rationale

At present, in order to control Rhythmbox playback, the user must operate the PC using a Mouse / Keyboard which is normally connected to the screen. This is not good for the user since they may have to move over to their PC, or switch on the monitor / television to control music playback.

There are several players on the market which have similar functionality:

  • Using an iPhone / iPod Touch, it is possible to select music and control the music playback on iTunes running on your computer. This allows you to have high bitrate (sound quality) MP3 playback from your PC rather than playing back MP3s from an MP3 player over bluetooth A2DP for example in addition to your PC generally having greater storage capacity than your mobile MP3 player. In this case, your Web enabled mobile phone would be the iPhone / iPod Touch and Rhythmbox replaces iTunes.
  • The Squeezebox Duet has a remote control and a central playback unit. In the case of Rhythmbox, your Web enabled mobile phone is used as the remote control and the playback device is your Linux desktop / laptop / media centre PC.

Use Cases

  • John is at home and wants to listen to some music on his laptop, he starts Rhythmbox and starts up a playlist. A track comes on which he wants to skip, so he uses his mobile phone's built in Web browser to skip the track.
  • Sarah is sat in the office with her colleagues. In the centre of the room is an office jukebox running Ubuntu and Rhythmbox. A phone call comes in, Sarah uses the Web interface to pause the jukebox while she takes the call.
  • Fred is hosting a party. People have started dancing in the living room, which is dark. He wants to check that the music which is about to be played is suitable for dancing without getting in the way to check the playlist on the laptop playing the music. He uses his mobile phone to alter the playlist to ensure that the music is right for the mood of the party.

Assumptions

It is assumed that security regarding playback control will be handled at a layer above the "Rhythmbox Web Remote Control" plugin, i.e. ability to reach the endpoint is enough to control the playback. Version 2 can address secure access.

Design

Although the MPD (Music Player Daemon) already does the same sort of thing, it's requirement to connect over TCP/IP means that it's only really suitable for creating a specific program per mobile phone (e.g. one version for the N95, one version for the Windows Mobile). Most modern phones are designed with the ability to access Web sites, so it should be easier to support. The MPD is also difficult to configure, in comparison to the simplicity of running a Gnome application, which is very easy to do and also familiar to Windows users.

In order for the system to work on a wide range of mobile phone browsers (many of which do not support XMLHttpRequest, the foundation for Ajax based sites), the ideal situation would be a choice of skins for a different variety of devices, customisable by the user or by developers. To support this, skinning would be part of the system. This, I think, is best done by allowing the user to create an XSL stylesheet to control the HTML output, which can then be selected by modifying the querystring sent to the application, e.g., the URL "http://localhost:8080/Search?skin=Default&title=Burning%20Of%20The%20Midnight%20Lamp&genre=&artist=&album=&maxResults=100" would take the XML output from the Search method and process it using the Default.xsl XML stylesheet (skin). If a skin is not requested, then the method should return the raw XML.

Implementation

A good start on a system has been created by Michael Gratton at http://web.vee.net/projects/rhythmweb/ - showing that it is possible to complete this project satisfactorily. The Rhythmbox API may be lacking the ability to do some of the required functions at present, but their web page says that they are willing to add Python bindings on request.

Because we need the system to not require the use of Javascript (in order to support a range of Web browsers on embedded devices) each method must return all data required to display a full page of information. This includes:

  • The method called
  • The parameters passed to the method
  • The current skin name
  • Information about the song which is current playing
  • The current play queue
  • Other method specific information

e.g.

Calling http://localhost:8080/?action=search&skin=Default&title=Burning%20Of%20The%20Midnight%20Lamp&genre=&artist=&album=&maxResults=100, would result in the following XML output (passed through the Default.xsl XML stylesheet).

<?xml version="1.0"?>
<rhythmweb>
  <search>
    <title>Burning Of The Midnight Lamp<title>
    <genre/>
    <artist/>
    <album/>
    <maximumResults>100</maximumResults>
  </search>
  <skin>Default</skin>
  <currentSong>
    <entry type="song">
      <title>Rainy Day, Dream Away</title>
      <genre>Classic Rock</genre>
      <artist>The Jimi Hendrix Experience</artist>
      <album>Electric Ladyland</album>
      <track-number>10</track-number>
      <duration>222</duration>
      <file-size>8893944</file-size>
      <location>file:///home/adrian/Mp3/The%20Jimi%20Hendrix%20Experience/Electric%20Ladyland/10-Rainy%20Day%2C%20Dream%20Away.mp3</location>
      <mountpoint>file:///</mountpoint>
      <mtime>1167566752</mtime>
      <first-seen>1216554803</first-seen>
      <last-seen>1222846330</last-seen>
      <bitrate>320</bitrate>
      <date>718432</date>
      <mimetype>application/x-id3</mimetype>
      <mb-trackid></mb-trackid>
      <mb-artistid></mb-artistid>
      <mb-albumid></mb-albumid>
      <mb-albumartistid></mb-albumartistid>
      <mb-artistsortname></mb-artistsortname>
    </entry>
  </currentSong>
  <rhythmdb-playlists>
    <playlist name="Play Queue (3)" type="queue">
      <location>file:///home/adrian/Mp3/Art%20Blakey/A%20Night%20In%20Tunisia%20(1957)/04%20-%20Couldn't%20It%20Be%20You.mp3</location>
      <location>file:///home/adrian/Mp3/Art%20Blakey/A%20Night%20In%20Tunisia%20(1957)/05%20-%20Evans.mp3</location>
      <location>file:///home/adrian/Mp3/Art%20Blakey/A%20Night%20In%20Tunisia%20(1957)/06%20-%20A%20Night%20In%20Tunisia%20(Alternate%20Take).mp3</location>
    </playlist>
  </rhythmdb-playlists>
  <rhythmdb version="1.4">
    <entry type="song">
      <title>Burning Of The Midnight Lamp</title>
      <genre>Classic Rock</genre>
      <artist>The Jimi Hendrix Experience</artist>
      <album>Electric Ladyland</album>
      <track-number>9</track-number>
      <duration>219</duration>
      <file-size>8778060</file-size>
      <location>file:///home/adrian/Mp3/The%20Jimi%20Hendrix%20Experience/Electric%20Ladyland/09-Burning%20Of%20The%20Midnight%20Lamp.mp3</location>
      <mountpoint>file:///</mountpoint>
      <mtime>1167566446</mtime>
      <first-seen>1216554803</first-seen>
      <last-seen>1222846330</last-seen>
      <bitrate>320</bitrate>
      <date>718432</date>
      <mimetype>application/x-id3</mimetype>
      <mb-trackid></mb-trackid>
      <mb-artistid></mb-artistid>
      <mb-albumid></mb-albumid>
      <mb-albumartistid></mb-albumartistid>
      <mb-artistsortname></mb-artistsortname>
    </entry>
  </rhythmdb>  
</rhythmweb>

This can then be transformed into the following HTML:

<html>
<head>
<title>Rhythmweb</title>
<style type="text/css" rel="stylesheet">
</style>
</head>

<body>

<div>
  Current Track: <span class="CSong">Rainy Day, Dream Away</span> by <span class="CArtist">The Jimi Hendrix Experience</span> from album <a href="http://www.google.com?q=Lyrics+Rainy+Day,+Dream+Away+The+Jimi+Hendrix+Experience">Electric Ladyland</a>.
</div>

<div class="CFloatRight">
  <img src="?displayAlbumArt&location=file:///home/adrian/Mp3/The%20Jimi%20Hendrix%20Experience/Electric%20Ladyland/10-Rainy%20Day%2C%20Dream%20Away.mp3&maxXSize=120&maxYSize=150"/>
</div>

<p>You searched for:</p>

<form method="GET">
  <input type="hidden" name="skin" value="Default"/>
  <input type="hidden" name="action" value="search"/>
  <table>
  <tr>
    <td>
        Title:
    </td>
    <td>
      <input type="text" name="title" value="Burning Of The Midnight Lamp"/>
    </td>
  </tr>

  <tr>
    <td>
      Genre:
    </td>
    <td>
      <input type="text" name="genre" value="N/A"/>
    </td>
  </tr>
  
  <tr>
    <td colspan="2">
      <input type="submit" value="Search Again"/>
    </td>
  </table>
</form>
...

Methods

Required methods include:

  • Play

Continues playback of the current song. If no song is paused, or the play queue is empty, do nothing.

  • Pause

Pauses playback of the current song. If no song is playing, do nothing.

  • Stop

Stops playback of the current song. If playback resumes, it is from the start of the track.

  • Skip

Skips playback of the current song and progresses to the next song in the play queue, resuming playback. If the playqueue is empty, do nothing.

  • Back

Restarts playback of the current song from the start.

  • Search
  • * Song Title (analgous to /rhythmdb/entry/title in rhythmdb.xml)
  • * Genre (/rhythmdb/entry/genre)
  • * Artist (/rhythmdb/entry/artist)
  • * Album (/rhythmdb/entry/album)
  • * Maximum Resutls

This function will return the current playing song, the current play queue and the an array of /rhythmdb/entry/ elements which are the search results, ordered by relevance.

DisplayAlbumArt

  • Location (/rhythmdb/entry/location) Max X Size Max Y Size

Will return an image in JPG or similar format which is close to the location value entered. The JPG should be found by searching the current directory for folder.jpg and other common names used by media libraries to store album art. If no image is found, a default image will be returned, e.g. a gray cross. The image should be resized if it is larger than the Max X size or Max Y size. The image should be resized so that it meets the smallest of the two requirements, e.g. for an image with a size of 150x150 px, if the Max X Size is 75 and the Max Y size is 50, the image returned will be 50x50px (the image is not stretched or distorted, the width to height ratio should remain the same). The content type should be text/jpg. For example, given a location of "file:///home/adrian/Mp3/Art%20Blakey/A%20Night%20In%20Tunisia%20(1957)/04%20-%20Couldn't%20It%20Be%20You.mp3", a possible JPEG to be returned could be "file:///home/adrian/Mp3/Art%20Blakey/folder.jpg".

Will add the location specified to the current playlist.

UI Changes

User Interfaces are handled by the creation of XML stylesheets which transform the output from the Web pages into HTML or WML documents which can be rendered by the target device.

As such, there can be a wide range of interfaces created, from Ajax enabled interfaces through to very simple plain text interfaces.

Code Changes

There are no specific code changes, since the project is almost green field, however the Rhythmbox API will probably need to be updated since the developers state that Python bindings don't exist for all of the Rhythmbox API functionality.

Migration

There is no specific requirement for migration, since there is no existing system.

Test/Demo Plan

It's important that we are able to test new features, and demonstrate them to users. Use this section to describe a short plan that anybody can follow that demonstrates the feature is working. This can then be used during testing, and to show off after release.

This need not be added or completed until the specification is nearing beta.

Outstanding Issues

  • There is no built in security model for this software, this is best addressed in version 2, if at all (I would imagine that the system would mostly be controlled inside a user's firewall).

BoF agenda and discussion

Use this section to take notes during the BoF; if you keep it in the approved spec, use it for summarising what was discussed and note any options that were rejected.


CategorySpec

rhythmboxWebRemoteControl (last edited 2008-12-25 21:19:43 by phearnot)