Plex блог

August 27, 2010

The Road to Plex/Nine

It’s been a long time in development, and we’re finally putting the finishing touches on the first public release. An incredible amount of effort has been spent developing this new version, and I’d like to take a bit of time introducing you to it. I’ll start by answering a few frequently asked questions:

Are you guys being bought by Apple? If you pay attention to how previous acquisitions have gone, you’ll already know the answer to this one. An Apple acquisition is usually followed by immediate disappearance of the service/product in question, sequestered away no doubt to a secret sub-basement in Cupertino. The fact that we’re still here talking and the website is still running is a sure sign that we have not been acquired by Apple. (The date is entirely coincidental, we went “one week out” and ended up there.)

Will my favorite new feature/bug be added/fixed in this release? Probably not. We’ve been uniquely focused (much to the surprise of some, who think we’ve just been playing Angry Birds) on getting the Alexandria library up and running. The only new feature in this release is the official inclusion of Ryan’s hardware-accelerated video decoding.

Can I run the new version alongside the old version? The answer is “mostly”. When you install Plex/Nine it will set aside your old Application Support directories so as not to step on anything. If you hate it and want to go back to Plex/Eight, you can just rename the directories, whack Plex/Nine, and crawl back into that comfortable old pair of Plex/Eight jeans.

Is this new release completely bug free? Um, no. This is the first release of a massive from-scratch rewrite of the library, and it’s safe to say there will be bugs, and even things that used to work that don’t work yet with the new version. However, we hope some of the cool new stuff coming your way will more than make up for it. This release has been through 17 (really!) builds which have gone out to our elite group of super-testers, but there are certainly lots of bugs. Remember what your mom told you: “Hope for the best, expect the worst, and take what comes with a smile.”

Why the @$%#%$ did you guys have to rewrite all that stuff? I’m really glad you asked. Our vision for the future of Plex is a distributed architecture, as opposed to one giant monolithic program. A simple picture might help here:

Untitled.png

In order to realize this vision, we had to effectively do two things: (1) rip out massive amounts of code in the client and make it into a “thin client” (essentially just player and skin), and (2) design and build the Alexandria library system into the Plex Media Server.

We consider these major changes to be fundamentally important to the future of Plex. We’re building the foundation for some truly incredible things, and building a strong foundation takes a lot of time and work. Continuing the metaphor, the first release really only shows you the foundation and perhaps a few ground-level floors. However, once you see the speed at which we can add amazing new features, you’ll better understand why we had to take so much time to get this right.

Can you walk me through an example of how this new library is so much better than the old one? One thing I really like is the decoupling of the scanning from the metadata. The scanners are responsible for looking for media, usually on disk, and performing “structural identification” (e.g. Lost, season 3 episode 14″). Media analysis is also performed to get the resolution of the file, pull out a thumbnail, etc. The media is added to Alexandria right at the start of scanning. Note that at no point yet has TVDB or any other Internet site been required. So you can scan new episodes into your library even if the site is down, and see them next to other episodes. What’s more, you can write a custom scanner in a few lines of Python code, which you might want to do if you have a custom filesystem layout for your media. Flexible!

Untitled-1.png

Now the agents, in my opinion, is where things get incredibly cool. They elegantly solve the problem of “how do I bring metadata from the Internet and connect it with my media?”. The agent functionality, along with the other parts of the new plug-in Framework coming in Plex/Nine was designed by James, and I have to be honest, he’s kicked some serious ass.

Plex/Eight used the XBMC scrapers to accomplish that task, and if you’ve ever tried to write one (or even modify an existing one), you’ll know that it’s not an easy task. As Jamie Zawinski once said: “Some people, when confronted with a problem, think ‘I know, I’ll use regular expressions.’ Now they have two problems.” (The only thing worse than regular expressions, mind you, is regular expressions encoded in XML.)

Plex/Nine’s metadata agents use the same (well, an enhanced) version of the Plex Plug-in Framework you’ve come to know and love. This means that powerful XPATH, Unicode, and HTTP functions are available in an easy-to-use manner, and you can write an agent in as little as a few dozen lines of code.

One of the other fundamentally neat things about agents is that multiple agents can contribute to a piece of media. I might want to get my ratings from Rotten Tomatoes and my descriptions from IMDB, for example. The other day Scott said “the movie descriptions on Wikipedia are really good!” and an hour later, this is what my own configuration looked like after I dropped his new agent in:

Info Provider Settings.png

The “Local Media Assets” agent is the one responsible for finding posters, banners, fanart and such sitting around next to your media. The Wikipedia one is the next highest priority agent, which means that the metadata combiner will prefer its summaries over others.

I think I fell asleep during that last answer. Yeah, I don’t blame you.

How open and extensible is this awesome new library? Well, you tell me. The database is stored in SQLite format, and there is a really nice REST-ish HTTP/XML interface for all areas of the library (which is what the Plex client uses). Want to build a dashboard widget which displays your recently added movies? Easy! Fun! And given that the Alexandria scanners are completely written in Python and support custom-written ones, this new library is much more easily customizable and user-tweakable than the old one. We’re really excited to see what interesting agents and scanners you come up with!

I think I’m out of questions. Good, because I need to get back to Angry Birds.

Plex — лучшее

С Plex Pass вы получаете эксклюзивный доступ к потрясающим новым возможностям и приложениям.

Подробнее

Plex — лучшее

The Road to Plex/Nine is a premium feature and requires a Plex Pass subscription.

Подробнее