Replacement Eyehome software using Ruby on Rails
Monday, June 26, 2006 • posted by Michael Rothwell @ 8:34 PM
I am writing replacement server software for my Eyehome video-on-demand system. The included Java software didn't do a number of things that I wanted it to do. So, I whipped out Ethereal and began sniffing the eyehome<->server communications. It's HTTP/1.1 with a special USER-AGENT string and what we'll call an "Extended subset" of HTML.
Hmmm. HTTP. HTML. Sounds like a job for... Ruby on Rails! I developed on my Macbook Pro, and deployed to the Fedora Core 4 system that is my terabyte fileserver. As it turns out, Apache on FC4 cannot serve "large files" (more than 2GB or so), so I'm running my Eyehome server (cleverly named "MyHome") under lighttpd, which can serve large files. Since the AVI files for long movies done at high quality can exceed Apache's file-size limitations, lighty is the best choice for now. Plus, Rails runs great under lighty.
This is how an earlier version of the MyHome looks on my TV downstairs (you can see that this picture was taken around Mothers Day):
I'll sum up a few of the new features that are visible in this next screenshot (which is of the current, uh, "release"). Note that the text doesn't fill the screen on this Firefox-prodced screen shot, but it does on the actual Eyehome.
- There's a "breadcrumb" UI element in the left pane, where it says "Location". This allows jumping back up the directory tree quickly from the remote.
- There's a "Categories" section on the left hand side as well. This is a listing of all the genres of all the movies in the current folder. Selecting a genre will display only the movies tagged with that genre. So if I want to watch a "Western", I'll get a shorter list with Tombstone and Blazing Saddles in it.
- The current folder is displayed as "Movies for Adults" in this screenshot, but the actual folder name on disk is "Parents" (vs the "Kids") folder. This is accomplished via metadata sotred with each folder (in a YAML file; Ruby likes yaml), as is the next feature: access control.
- The lock in the upper-right indicates that an access code has been entered, as the "Parents" folder is restricted.
- Note that "The Aviator" is appearing with movies whose titles begin with "A". The MyHome software generates a "sortable title" for each item that does things such as move "The" to the end.
- The item names are not just the filenames minus the ".avi" -- although it falls back to that in the absence of available metadata. It's the full title of the movie plus the year it was released (or the date in the case of TV series, plus season and episode).
The items are sorted by season and episode, rather than title or filename. The title also includes an abbreviated display of season and episode.
Choosing an item displays details for the item. As seen in the next screenshot, it displays a boxshot/cover art, the title, a plot synopsis, IMDB rating, genres, MPAA rating and other details.
When viewing the details page with a browser that's not the Eyehome, "edit" and "listing" links appear. Clicking edit allows me to enter the metadata for an item using a browser. The metadata is saved as a YAML file with the same name as the movie file.
To help me obtain the metadata, I have also written a Cocoa (Mac OS X) application that does the following:
- accepts a drag-and-drop of a video file
- looks it up by title in IMDB
- renames the file with the "canonical IMDB name" (title plus year)
- saves a plist containing the IMDB info.
By storing the metadata in text files alongside the real movie files, I can realize a few advantages.
- I can edit the metadata using a text editor if I want to. This isn't a big advantage, but it's a small one. For most things, the editing built into the rails app keeps me from having to.
- I don't depend on any special access to manage the movie files. I can zip into the fileserver via nfs, smb or afp and rearrange, copy or delete stuff as I see fit. I can also ssh into the fileserver and use cli tools.
- The deployment footprint of the rails app is small. It doesn't require a database.