Programming

How to stream your ripped DVDs to TiVo with metadata and commentaries

pyTivo is a tool that allows you to stream video files from your computer to your TiVo. It has served me well for watching home movies, but when I decided to rip my DVD collection and watch movies via TiVo instead of using the physical discs, I found two problems:

  1. No metadata. All I see on TiVo is the title (which is just the filename of the video). I’d like to see the year the movie came out, the MPAA rating, the description, etc. just like I do for movies I recorded off of TV.
  2. No commentary tracks. The best part of owning a physical DVD is access to the commentary track(s); unfortunately, pyTivo isn’t able to stream the video in such a way that alternate audio can be selected via TiVo’s built-in audio selection, so the default leaves you with just the first audio track.

I’ve written two scripts to fix these problems, and they’re available at GitHub.

pytivo_metadata.py

pyTivo uses metadata files to supply information to the TiVo about each video file, like the description or the year the movie came out. pytivo_metadata.py generates metadata files for all videos in a given directory (and subdirectories) so you don’t have to write them yourself.

Here’s an example of a filename from a ripped DVD:

/path/to/movies/The Family Man.m4v

This is the movie “The Family Man,” starring Nicolas Cage. Without any metadata, this is what the movie looks like on TiVo:

IMG_6717

Running pytivo_metadata.py /path/to/movies/ will query The Open Movie Database API for information on all videos in that directory that don’t have metadata files; here’s the metadata that pytivo_metadata.py will save to The Family Man.m4v.txt:

title : The Family Man
vProgramGenre : Comedy
vProgramGenre : Drama
vProgramGenre : Romance
isEpisode : false
year : 2000
movieYear : 2000
description : A fast-lane investment broker, offered the opportunity to see how the other half lives, wakes up to find that his sports car and girlfriend have become a mini-van and wife.
mpaaRating : P3
vActor : Nicolas Cage
vActor : Téa Leoni
vActor : Don Cheadle
vActor : Jeremy Piven
vDirector : Brett Ratner
vWriter : David Diamond
vWriter : David Weissman

pyTivo will automatically use this file to supply the metadata for The Family Man.m4v to TiVo.

IMG_6718

(See the pyTivo wiki for more info on the metadata file format.)

No guarantees are made regarding the correct movie being returned from the API, so maybe do a cursory check of that after running the script. Or don’t. Whatever.

pytivo_commentary.py

If you rip a DVD and include multiple audio tracks in the file, you can stream each of those tracks via pyTivo by using pytivo_commentary.py.

If you’re using Handbrake, go to the Audio tab and add each commentary track as an additional entry:

Screen Shot 2013-01-21 at 8.29.54 PM

Then, add a note to the filename to let pytivo_commentary.py know that there’s a commentary track available:

The Family Man (Commentary).m4v

If the movie has more than one commentary, name it like this:

The Family Man (Commentary x 3).m4v

(Yes, The Family Man, starring Nicolas Cage, does have three commentary tracks; one of them is completely dedicated to the music score. What a country!)

pytivo_commentary.py will then generate multiple copies of the video and metadata file (one for each commentary) and add “Commentary #1″ (or #2 or #3) to each title. The additional video files are only hardlinks to the original, so no additional disk space is needed.

Screen Shot 2013-01-21 at 8.58.59 PM

Then, add this line to the [Server] section of your pyTivo.conf (and restart the pyTivo service):

audio_lang=commentary

This causes pyTivo to choose the first audio track it can find that includes the label commentary. In the metadata file for each commentary track, you’ll see a line like this:

Override_mapAudio 0.2 : commentary

This tells pyTivo to explicitly use the label commentary for the second audio track instead of whatever the label was which means that when you stream this video, pyTivo will send the commentary audio track instead of the original audio. Because the metadata file for the non-commentary version doesn’t have this override, pyTivo will send the first audio track.

Conclusion

There you have it; now you can rip your DVDs to a hard drive, stream them to your TiVo, listen to the commentaries, and never have to worry about scratches, extra remotes, or mandatory previews before your movie.

These scripts were tested with the wmcbrine version of pyTivo (specifically, the version pulled as of this commit).

The scripts and their required module (pytivo_utilities.py) are available on GitHub in the pyTivo Utilities repository.

Standard
Automattic, Blogging, Life, WordPress

Work with me here.

In 2012, we committed and deployed changes to WordPress.com, on average, every 26 minutes. Why so long between deploys? Because we don’t have enough people working here! Help change that by coming to work with us. We’re looking to hire around 60 people this year; if my math is correct, that’s a lot!

Do you like the Internet? Working from home (or coffee shops or co-working spaces or libraries or your friend’s house or a grassy area with Wi-Fi access)? Making a difference for millions of users? Being part of a profitable company? Retina displays? Work with us.

Do any of these places sound like interesting locations for week-long team meetups? Hawaii, New Zealand, Mexico, Spain, New York City, Miami, San Francisco, Iceland, Boston, Las Vegas, San Diego, Italy, Berlin, Amsterdam, Montreal, Portugal, New Orleans, Chicago, Winnipeg, or Montevideo, Uruguay? Work with us. (And that’s just a selection of 2012 meetup locations.)

Are you a backend developer? Work with us. Mobile developer? Work with us. Customer service and support? Work with us. Designer? Work with us. Front-end developer? Work with us. Wordsmith? Work with us. Sysadmin? Work with us.

Do you dislike cubicles? Dress codes? Commuting? Working 9-5? Work with us.

Working at Automattic is the best job I’ve ever had, and I’ve even worked at AOL, so you know that it must be good. Won’t you come work with me and treat yourself to the best job you’ve ever had?

Standard
Apple, Bug Evangelism, iPhone

iPhone 5 shuts off when opening Camera

I’ve experienced a strange iPhone 5 or iOS 6.0.2 bug three times in the last week. Here are the steps to reproduce:

  1. Use phone until battery level is at the most 40%.
  2. In in an environment with a temperature below 50º Fahrenheit, play music through the phone speakers for at least 30 minutes.
  3. Confirm that the battery level is above 15%.
  4. Open Camera app, with or without stopping the music playback.
  5. Phone immediately shuts off as if the battery was dead.
  6. Attempt to turn phone on; screen shows “no battery” symbol.
  7. Plug phone in to a power source. The phone will turn back on after a few seconds, showing at least 15% battery power.

These specific steps are the result of me using my phone as a stereo while I work on projects in my garage in Minnesota in the winter.

I’ve reported the problem to Apple; has anyone else experienced this? I don’t know if the temperature, music playback, or actual battery level are relevant, but it’s definitely due to opening Camera.

Standard
Mozilla, Mozilla Firefox, TubeStop, YouTube

Adopt an Add-on: TubeStop

Notice: TubeStop was discontinued on December 25, 2012 and is no longer supported.

I’m no longer going to be updating TubeStop, a Firefox extension I wrote that disables autoplay on YouTube videos. I don’t have the time or the inclination to keep up with YouTube’s HTML changes.

TubeStop has been around for about five years, and it has 17,000 users. It was the first browser extension that made it possible to disable YouTube’s autoplay feature (if you don’t count the all-purpose Flashblock), and it gained notoriety in 2007 for inadvertently stripping ads from YouTube videos.

If you’d like to adopt this abandoned add-on, let me know, and I’ll transfer ownership of the extension to you on Mozilla Add-ons. If nobody wants to take over development, I’ll shut it down and the void will be filled by one of the other anti-autoplay extensions on AMO.

Standard
Christmas

Our 2012 Christmas Letter

HEY YOU GUYS,

Blah blah blah introduction. Let’s get down to business.

In January, I took a trip to New York City to meet my co-workers for the first time, and Christina used the opportunity to jet to Oregon with Gideon to visit a friend. I’m not sure what Gabriel did while we were gone; you’ll have to read his Christmas letter to find out.

This spring, I threw myself into the political process and was elected as a delegate at the precinct, county, and state level for Ron Paul. The political process promptly threw me back, choosing to support Mitt Romney instead. By the time this letter reaches you, I’ll have either been proven wrong or revealed as a wise soothsayer that the country should have heeded. My money is on the sooth.

In March, we got new windows put on our house. They look nice, but the process was a pane.

Christina held a garage sale in April, and boy were her arms tired! Because it would be hard to hold a garage sale in your arms! Because it would be heavy! LOL!

In May, I took another “work” trip, this time to Vegas. Unfortunately for you, I am contractually obligated by the city of Las Vegas to ensure that what happened within the city limits of Las Vegas stays within the city limits of Las Vegas.

Get it? “Pane?” Because of windows!

Gabriel played his first team sport this year: three sessions of tee ball in June. In a startling display of segue, I also took him to his first professional sporting event later in the summer, to see the Twins with Grandpa and Jacob Finke. I didn’t plan it that way just so this letter would flow, but it definitely worked out. He enjoyed both tee ball and the Twins game equally, which is to say, little.

We did the annual family camping trip at the end of June. The weather was perfect, there were no bugs, and the kids slept for 10 hours each night. (Can you find the three lies in the previous sentence?)

August put me on an airplane again, this time to San Diego for an all-company meetup. (The meetup was in September; August was the name of the Delta airlines flight attendant.)

Gabriel started preschool in September. He also ended preschool in September. We decided his crying and refusal to attend each day were signs that he was too advanced for school. We’ll see if he’s still too advanced next year.

I should probably say something about Gideon.

I did the Paleo challenge for a month this year. If you’re not familiar, the Paleo diet involves eating only food that would have been eaten in caveman days; it’s supposed to make you healthier and hardier. Unfortunately, I didn’t look up the exact definition until it was too late, and I had spent a month eating bread, swiss cheese, potatoes, and milk — they’re pale, yo.

Christina spent a lot of time this year traveling back and forth to the Mayo Clinic with her dad while he was treated for esophageal cancer and subsequently underwent a gastrectomy. (Not Christina, her dad.) The surgery has changed him a little: he used to love steak, but now, he just doesn’t have the stomach for it.

This year, Gideon turned one year old, as children tend to do a year after they are born. (Next year, we are hoping that he will turn two, but we would settle for three.) He is a regular chatterbox; I stopped keeping track of his vocabulary once it hit 350 words. Speaking of which, did you know that it is possible to only know 350 words but never stop talking?

We bought a new car in October. Well, “new.” And “car.” And “October.” Okay, we bought a used SUV in November.

Merry Christmas,

Chris, Christina, Gabriel, and Gideon

Standard
Blogging, Writing

Somebody’s Gonna (Write a Book About The) Lotto

tl;dr: I’m writing a novel about the lottery at lotterynovel.wordpress.com.

I’ve always wanted to write a book; it’s on a list I made about ten years ago of things that I’d like to accomplish in life. I’ve had a couple of topic ideas floating around in my head, but the lottery is one that I think I can really run with. (Sentences ending with prepositions are just one of the literary treats you’ll be party to if you read my book.)

I don’t get many opportunities to write fiction, although some of my co-workers might argue that my comments explaining how my code is supposed to work would count. This is also a chance to see the platform I work on every day in a different light as I use it for sequential story-telling rather than blogging.

By publishing the sections as soon as I write them, I’ll be able to benefit from immediate reader feedback (assuming that there will be any readers). I suppose this is a sort of crowdsourcing turn on the editor feedback model of traditional publishing, and I’m not sure whether it will be a blessing or a curse.

When I finish, I’ll package the whole thing up as an e-book and learn a little something about that process too. Until then, I invite you to read along as I write my way towards a conflict and its eventual resolution. The first portion was posted a couple of days ago, and part two will be up this week.

Standard
Blogging, Clean and Sober, Programming, Themes, WordPress

New WordPress Theme: Clean and Sober

Today, I’m releasing my site’s theme (the design you’re looking at right now) as a free open source theme for WordPress. I’m calling it Clean and Sober, and it’s compatible with WordPress 3.4 and up. Here’s the default homepage:

The default Clean and Sober homepage.

It’s designed mainly with single-author blogs in mind, since I initially wrote it for (this) single author blog, and there are not a lot of graphics (zero, to be exact), since I am, how-you-say, very bad at doing art.

This is the first WordPress theme I’ve released in five years (the last being Greencode in January of 2007), and the first one that I’ve tried to make compatible with all of the Theme Review Guidelines, and let me tell you, it is exhausting. Major props to the themers who can do this more than once every five years.

Some notable notes:

  • Post excerpts are displayed on index pages beneath the post title. If no excerpt is defined, nothing is displayed there.
  • You can define one menu, which is displayed beneath the header. If a menu item has children, they will automatically be shown in a dropdown menu.
  • On pages with an author (posts, pages, etc.), the author’s bio will be displayed beneath the content if the author has written a bio and saved it in their profile’s Bio field.
  • On pages without an author (search results, the homepage, etc.), you can choose a user to be displayed as the default author. This is handy for single-author blogs that are identified solely with one user. This setting can be changed from the theme customizer.
  • The contact links on the right side of the bio are defined at the bottom of your profile page.

It works well for my needs, but I’m interested to see all the new and exciting ways that other people can break it by trying it on their blogs. Give it a shot and let me know how you like it in the comments, or just take a look at this gallery of screenshots:

Standard
Formategory, Plugins, WordPress

Formategory: A WordPress Plugin Four Years in the Making

You may recall (but you probably don’t) that four years ago, I was looking for a WordPress plugin that would let me add a postscript to all of the posts in a given category. I wrote a simple proof-of-concept at that time, called it Formategory (“Format” by “category”), and left it to simmer in my subconscious.

Well, you can stop holding your breath, because even though I forgot about it for three years and eleven months, I’ve finished the first version and uploaded it for you to use! Here’s a screenshot of the template editing screen:

The editing screen for a category template.

A full description and usage instructions are on the Formategory homepage, but if you’re one of those people who would rather trial-and-error your way through it than read the manual first, here’s how you can get started:

  1. Search for “Formategory” in the “Add new plugin” screen on your WordPress dashboard and install it from there.

or

  1. Download the .zip file from Extend.
  2. Choose “Add New” from the “Plugins” menu in your WordPress dashboard
  3. Upload the .zip file.

Activate it, click the new “Category Templates” link in your dashboard’s menu, and create your first template.

Translators: formategory.po is included in the /languages/ directory if you’d like to translate Formategory. Thanks to Andrew Kurtis from WebHostingHub for providing the es-ES translation. To ensure that Formategory is displayed in your language, follow the instructions at WordPress in Your Language.

By the way, this post about Formategory is using Formategory to auto-add the download link for Formategory to the end of this post. Formetagory, am I right?

Standard