Automating my hungry Plex queue

6/24/2013

Sometimes I love a good limitation. Even a stupid one. It gives me a reason to write a small piece of code to accomplish it and make my life easier – either through connecting multiple disparate services or automating a daily job.

I’ll start off by saying that I LOVE Plex. It’s a media server similar to XBMC that I use to stream content to my TVs via a Roku box. With all its awesome-sauce, I found two limitations that I either want to fix or automate.

  1. Bulk-adding content to a queue. There are a couple ways to manually add individual items, either by the Chrome plugin, bookmark script, or sending to an email, but even that has limitations. The main limitation is that you can’t add a Youtube playlist, or other list of videos. It’s just not supported.
  2. Subscribing to a service. While this isn’t a bug of any sort, it’s more of a nice-to-have. I don’t want to have to manually add check for videos each day and manually add them to my queue, especially given all the users that I subscribe to.

So, with those problems, I came up with a couple solutions. I’ll post actual code (as soon as I get it up onto a repository), but here are two Plex-related projects I’m working on. Also, don’t make fun of the names.

PlexParser

Currently, it only supports Youtube, but it’s designed to be pluggable, so more video sources are coming (Vimeo is next on my list). This project overcomes the limitation of bulk-adding content to a queue.

While it’s still in its infancy, if you add the URL of a user’s video page, a playlist, or a course-list, the application will recognize the URL, generate an appropriate API request, retrieve that data, and return a flat list of video links for that particular page. The user can then copy and paste this list into the body of an email and send it to their Plex email address.

MailHandler

While this doesn’t have to be used solely for Plex, I’ve built it with the intent of solving the problem of subscribing to a user’s upload feed. The application is essentially a mini SMTP server that runs as a Windows service (ideally to be installed on a server, but doesn’t have to), that listens for emails messages, which are then parsed out to scour for any video links (again, only Youtube at the moment, but is also designed to be pluggable). It then emails this list to a Plex email for queue insertion.

Now, part of this depends on the video source as well as rules you may set up in Outlook or other email client. In my case, Youtube can be configured to send me an email whenever a source uploads a new video. I then forward a copy of that email (using the rule “% has uploaded a video”) to the box running the application. It’s a bit hands-on for someone like myself who runs their own email server, but it works for my purposes.

In the end, this program can be setup to handle much more than adding videos to a queue, since at its core, it merely executes a C# service whenever an email comes in. It just happens that the only service used by it is one that parses the email body and sends a new email to my Plex address.

Further Development

I have other projects in the midst as well, such as an automated podcast downloader that aggregates various developer podcast feeds and puts them into a shared location. It’s not using Plex at the moment, but I’m evaluating the option.

I hope to have source code for these projects up shortly and will link to them.

Other Posts