By Zed A. Shaw

Edifying.TV Progress, It Can Load Stuff

I've been rolling an idea for a "media browser" in my head for a while, but recently I think I found a small tiny little corner of the idea that I can actually work on. Now I'm tinkering with Edifying.TV which will be a way for students to watch videos from teachers. Basically the same thing, but focused directly on one type of media, and two very narrow users.

The idea came from trying to do videos for an online course I teach, and finding that there is no one video encoding that does this:

  1. Put a link to the raw file in a page.
  2. User clicks that link.
  3. It plays. Period. No stupid nerd freak out about the bizarre matrices of codecs intersecting with encodings intersecting with the Pythagorean derivative of second order legal systems on a Martian sun.
  4. Yes, just play. Like how I can click on a damn .gif and it displays. Or a .txt and it prints out. Or hell, a .mp3 and it plays.
  5. It plays. Get it? Not with Flash. Not with a stupid video HTML5 tag. Just play the damn video file.

Really that's just one requirement, but holy crap is video frustrating. Since I figure there's no way in hell browsers will ever get their act together and make this happen, I might as well take a crack at making a separate program that can do it.

I believe my very specific target audience, and my metric of success, would be if any of the various "guitar instructional videos" were available on instructor's websites and students could view them. I figure if guitarists can figure it out then anyone can.

Progress Thus Far

I did a conference and hacked up a bunch of the functionality on the plane trip that now works, but haven't had much time to work on it more. I managed to get the following working:

  1. A simple data format in JSON that should work for now.
  2. The base Lua code going.
  3. A simple project site up for working on it.
  4. The data store, simple models, and how stuff is downloaded and synchronized properly mostly working.
  5. A simple first spike that actually reads the data format from a site, downloads each containing element, and finally gets videos that I can play.
  6. A half-working redo of the wxLua video player example that barely works.

Here's what a test run looks like of a stupid "show" I threw up as an example:

$ ./bin/edifytv http://zedshaw.com/theshow
Checking for HOME:  /home/zedshaw/.edifytv
First time running, creating:   /home/zedshaw/.edifytv
Creating initial path:  /home/zedshaw/.edifytv
Creating initial path:  /home/zedshaw/.edifytv/media
Creating data store:    /home/zedshaw/.edifytv/data.sqlite
Creating data schema: 
- Site:     Zed'S Edifying.TV Channels
- There are 1 channels at this site:
* Channel:  Learn Python The Hard Way
* There are 1 episodes in this channel:
** Episode:     Ex 13: Learning Nothing ID: 1   content:
** [Video] : /episode1.mov ==> 847b8af9bfe3a7b5921f6a656310cd6c
Haven't seen this, downloading.
Saved to /home/zedshaw/.edifytv/media/847b8af9bfe3a7b5921f6a656310cd6c
This is a new video...
Want to play this video?
n

That's pretty much it, but if I run it again it uses the local cache instead of downloading:

$ ./bin/edifytv http://zedshaw.com/theshow
Checking for HOME:  /home/zedshaw/.edifytv
- Site:     Zed'S Edifying.TV Channels
- There are 1 channels at this site:
* Channel:  Learn Python The Hard Way
* There are 1 episodes in this channel:
** Episode:     Ex 13: Learning Nothing ID: 1   content:
** [Video] : /episode1.mov ==> 847b8af9bfe3a7b5921f6a656310cd6c
Want to play this video?
n

Which means I can point the edifytv program at a random website and it does this:

  1. Looks for /catalogue.edtv at that spot. Don't ask why I used the British spelling.
  2. Gets the Channels out of the Catalog.
  3. Gets the Videos out of the Channels.
  4. Downloads the actual video files, storing them in a local cache.

This is all using a data format that's very simple and a lot like how the rest of the Internet works, but maybe a bit more structured. Let's take the catalogue.edtv file:

{
    "type": "Catalogue",
    "source": {"location": "http://zedshaw.com/", "type": "WebSite"},
    "copyright": {
        "holder": "Zed A. Shaw",
        "date": 1298245247,
        "rights": "ALL",
    },
    "title": "Zed'S Edifying.TV Channels",
    "classification": ["Education"],
    "tags": ["education", "beta", "alpha"],
    "description": "A bunch of random courses on things I know.",
    "created_on": 1298245267,
    "updated_on": 1298245267,
    "links": { },
    "content": [
        {"hash": "802041311ec8ed53532ad138e0d6ea87", "location": "/channel.edtv", "type": "Channel"},
    ]
}

That's it, and notice how there's no actual specific contents, instead in the "content" attribute there's a list of links to other .edtv files that can be different types of things. If you look at the channel.edtv then it's the exact same format, but type=Channel. Same for Video, and so on. The idea is that you can nest these arbitrarily, of varying types, and they link to each other instead of how RSS does it where it tries to cram everything into one massive file.

I also managed to make it so you can put a hash on these links, so the player will just avoid grabbing it if it already has that content. If you don't give one then it just uses the ETag from the web server and does a HEAD request.

Overall, very simple and as long as there's basic rules for how these get displayed the format should keep working for a first version.

Next up is working on the UI that actually plays videos, which is fairly important for a video player. I got some basics going but I have to work on it. In the process of working on the UI there's a Finite State Machine system that's forming up too. I'm planning on simple FSMs keeping the GUI straight and high quality.

I'm also going to do up a version of my favorite "Layout Expression Language" stuff I use on GUI projects. Mostly I find all layout engines to be damn hard to work with because of their bizarre nesting requirements. I'll explain LEL (again) when I get it working, but for now just read this to mean I'll be stripping away as much layout junk as I can with some nice code I like.

Finally, I'm going to go with Ogg Theora mostly because I know I can use it without much trouble, both legally and technologically. The trick will be making it easy for teachers to take the random video formats they get and shove them onto some service to produce the Ogg files. Not sure how to do that yet, but need to figure that out soon and stop using that .mov file I have in the demo.

And that's it so far. There isn't a license yet on the project (which means it is Copyright me right, not open source) but feel free to track my progress by subscribing to the timeline and checking out the commits.