DropPod: Simple Podcast Uploading

So, this is the first WordPress plugin I've written for Interest Compound. With it, we should completely obviate the need for FTP– much simpler for you guys to use, one less service for me to run. So far, RVM, HFF, and Ask an Atheist all have the plugin installed and configured.

It's the first version. No doubt there are bugs, so some things might fail. I've left checking code for debugging, but there isn't a whole lot to go wrong.

Getting It

If you're on Interest Compoud, chances are you've already got it. If you haven't, you can download a ready-to-go plugin here, or checkout the slow goings of development on GitHub

How to Use It

First, you have to find it in the menu. It's a main entry on the left-hand menu, currently represented by a cog. That wil likely change as we add more plugins. Just click on it, it has no sub menus.

There is a “DropPod Config” under settings. Do not change this unless you know what you're doing. If you're installing it yourself, it is pretty self-explanatory.

This is the main window. I'd like to think it is self explanatory. There's a big white box that says to drop your files there. Open up your file manager1) and find the MP3 or whatever file you want to upload to your episode archive. Drag it to the box, and drop it off, just like you were moving or copying a file.

You'll see an icon that looks like this while it's uploading, with a loading bar.

When it's completed, you'll see a nice little checkmark, and the file list below the upload box will automatically update with the new file. The checkmark will float away after a few seconds, but the icon for the uploaded file will remain until you leave the page or reload.

You can drag multiple files if you like.

At present, the webserver allows uploading of files up to about 250MB. Given that an average hour of podcast usually clocks in under 50MB, that should not be a serious problem.

The File List

Most of the plugin is a wrapper for code I found online, but I've added a very simple file viewer and manager below the upload box. Files are listed newest first, there is no pagination, and there is no sorting. This isn't meant to be a complete file manager (at least yet) so I've kept that as simple as possible.

Each file listing has the name of the file, the unix owner and group2), the size of the file, when it was uploaded, and two action icons.

The link icon opens up the file in another tab. This is useful for copying the URL and pasting it into whatever podcast plugin you happen to be using. If you're using powerpress3) just copy and paste this link into the “Media URL” box in the Podcast Episode section and continue as if you uploaded the podcast via FTP.

Deleting a File

I included a delete file functionality in case file uploads are incomplete or if there are some other problems. Click on the trashcan, and you'll get a dialog that looks something like this:

Click on ok, and the file list below will update. Presently, there is no other indication that a file has been deleted once “OK” is pressed. You can delete *any* file in the directory4), not just ones uploaded by DropPod, so be careful.

Technical Crap

Most of the plugin is a simple wrapper around Dropzone.js, an off-the-shelf HTML5 upload manager. Wordpress does have all of this built into the “Media” system for uploading images and other stuff for blog posts, but it fits it into a directory structure that I don't think works very well for podcasts.

I really, really prefer having all of my podcasts in a separate directory.

  • Mixing podcast files in with other media used by the blog can be confusing from a file management perspective
  • WP-XML backups are smaller and take much less time to generate
  • Podcast backups are easily done via rsync.
  • Interfacing podcast files with non-wordpress systems is much easier
  • Podcast file can even be hosted on another URL, for example askanatheist has all it's podcasts on media.askanatheist.tv.
  • This is much less important, but I don't want to integrate *too* tightly with Wordpress, in case I want to move away from it some day5)

For example, I'm using mod_xsendfile to capture Piwik statistics on podcast downloads for AaA and RvM. I'd eventually like to do that for HFF, but I want a slightly smarter system for that. DropPod is the first step.

Bugs, TODOs, Wishlists

  1. I'd like some simple integration with PowerPress, since that's what most of us are using. Probably just a simple dropdown that automatically fills out the form. Nothing too smart.
  2. WordPress updating support, so I don't have to manage things site by site, and I can leave the updating to you guys.
  3. There's one or two hiccups with CSS I'd like to fix, as you can see in the images.
  4. It's not heavily tested.
  5. I have no idea if this works with smartphones and tablets. I'm assuming not.

Changes

Version 2

  1. Uploads have now been restricted to alphanumerics, dots, underscores, and dashes. If you have invalid characters in your upload, dp will automatically clean them out for you. Spaces will be converted to a dash. This doesn't really change anything for anyone since we've all been sane with our filenames, but I knew if I released the code I'd probably want to add some sanity checking there.
  2. The CSS is fixed, so the footer doesn't intrude on our table anymore.
  3. I've added automatic upgrades that go much like the standard upgrades in WordPress itself. This is the last time I'll be installing upgrades myself on your websites, from now on I'll be expecting you to install it yourself as you update WordPress in the standard way.
  4. You are keeping WordPress and plugins up to date, right?
1)
“Finder” on Mac, I think it's still “Explorer” on Windows, “Files” on GNOME
2)
this is only useful if the file is unreadable by the webserver. All files uploaded via DropPod are by default readable by the webserver, so there should be no problem
3)
which is most of us
4)
assuming the webserver has ownership
5)
there are murmurs that Wordpress might someday-when-we're-all-old-and-dying move to some experimental Node.js system. I will not be following Wordpress if they choose to do that. Also, sometimes I find wordpress really too unwieldy from a programmatical perspective. Also, it dogs.