Programming is a wonderful mix of art and science; source code is both a poem and a math problem. It should be as simple and elegant as it is functional and fast. This blog is about that (along with whatever else I feel like writing about).

Monday, January 15, 2007

Getting iTunes to Recognize Your TV Shows

I have quite a few movies on my computer, as I've mentioned in previous articles. I've encoded most of them in H.264, which I find gives the best quality. Since I never felt like looking up my Quicktime 7 key (which I legally purchased when it came out, hoping it would allow me to encode DVDs more easily), I always played all my videos using VLC (because Quicktime doesn't let you do full screen). The process was annoying: I had to find the movie in the Finder, then drag it down to the VLC icon in the dock, then go to full screen. And VLC doesn't have an onscreen controller during full screen playback (at least not on Mac, I don't know about the status of other operating systems).

Needless to say, I started to find this pretty cumbersome. When iTunes first got the ability to play video, I jumped at the chance to have a program manage my video playing needs. I was grossly disappointed by how slow it was, and after a few hours of trying to set it up, went back to my Finder-VLC approach. Well, it's been a few iTunes updates since then, so I decided to give it another go.

The first thing you need to make sure you do is to set iTunes so it doesn't automatically move your files into the iTunes directory. This won't work at all when your main drive is full and most of your movies are on an external hard drive. Plus, it takes a really long time to transfer those files.

Adding the movies is very simple. Switch to the Movies tab on iTunes, then select all your movies, and drag them on over to iTunes. It'll chug for a little while, then give you a list of all your movies. You can set it to automatically play them full screen, which I like, and they give you a nice onscreen controller during full screen playback, which I like more.

But in addition to my movies, I also have quite a few television shows on this thing. And while iTunes does support TV shows, they seem to prefer that you buy them from the iTS rather than play your own. But I don't feel like repurchasing all these shows from Apple, so I need to get iTunes to recognize that they are, in fact, TV shows instead of Movies.

For an individual episode, this isn't too bad. You go to Get Info, then Video (a tab on top). Here you can set it to TV Show, and also enter the name of the show and the season number. Cool.

But that's really cumbersome if you have a lot of TV shows. You know, like a season. Or ten. Or, in my case, many many more. There MUST be a better way!

Doug's Applescripts give us Set Video Kind of Selected, which allows you to do this very thing to an arbitrary number of files. Awesome. Just download it, toss the Applescript file into /Users//Library/iTunes/Scripts, restart iTunes, and you're ready to get started.

Select your files:

When you drag them to iTunes, remember to select them all again and choose the script from the Applescript menu:

This will bring up a little dialog box where you can change the Video Kind to TV Show, the Show Name to, for example, "The Simpsons" and the Season Number to, say, 6.

It chugs for a few seconds, and then it says it's done. Popping over to the TV Shows tab in iTunes shows us that it did in fact work nicely, turning 5 or so minutes of tedious data entry into just a handful of seconds of just telling your computer what you want.

And the TV Show interface is kind of slick. Maybe it's possible for it to be a bit nicer or more usable, but come on ... it's easily a dozen times better than Finder+VLC. And iTunes certainly isn't as slow as it used to be.

And now I'm off to watch a bit of television. In iTunes. Tally ho!

Sunday, January 14, 2007

Is the NFL Fixed?

I feel like I'm the only person in America who hates the New England Patriots. That's like hating apple pie and Neil Armstrong! How could anyone hate the Patriots? They're an American flag with a football, and they're so good as to be unbeatable. But does anyone remember a time before their dynasty started, and exactly when it happened?

In the year 2000, the Patriots were 5-11. (2000 Standings.) They weren't a good team. At the beginning of the 2001 season, nobody expected them to do anything, and for good reason. They started off 0-2, as expected. Then the unthinkable happened. The World Trade Center towers got knocked down, and everyone needed to pull together and be patriotic. And ... the Patriots started winning. A lot. Tom Brady, a nobody, a quarterback from the Big Ten (which is not very well known for producing great quarterbacks these days), who didn't play at all in 2000 (not technically true; he played in 2 games, and was 1-3 for 6 yards and 0 touchdowns), suddenly became the best quarterback in the league. People are now trying to go so far as to say he's the best quarterback of all time. (This is complete crap, by the way. Johnny Unitas, Joe Montana, Dan Marino, Brett Favre ... at least you can say Brady's name in the same sentence, but he's not as good as any of them.)

In 2001, the Patriots won the Super Bowl, after an amazing turnaround from the previous season. They started playing well after a big tragedy. And the "dynasty" has been going strong ever since. After the 2001 season, I had begun to suspect that something fishy may be going on in the NFL. How did the Patriots get so good all of a sudden? Why did a team called the "Patriots" suddenly become the best team -- by a long shot -- right when everyone in the country was supposed to start being really patriotic? It seemed like too much of a coincidence, but I had to sit and wait until something happened again before I could point any fingers.

Then, a year and a half ago, Hurricane Katrina devastated New Orleans. Despite all the pain, death, and damage, what was the main focus by the people charged with rebuilding the city? The Superdome. They'd been planning to demolish the Superdome anyway, since it's so old and crappy. The Saints wanted to build a new stadium, and since they might not have gotten one in New Orleans, they were considering leaving for a city with a better fanbase. It didn't matter where. New Orleans fans had always been bad to their team.

Why did everyone care so much about rebuilding the Superdome and keeping the Saints in New Orleans? Surely the money could have been better spent elsewhere in the city ... unless the Saints had a good season for the first time in their history and actually got fans into the stadium, made some money, and united the population of New Orleans.

Last season, the Superdome wasn't ready. The Saints didn't play any home games all season. They were miserable, going 3-13. This team had no future, no quarterback, no coach, no talent. Then they drafted Reggie Bush -- despite all the hype, there was no way he could be ready for the NFL already. And they picked up Drew Brees from the San Diego Chargers. It was the first time in NFL history that a team acquired a quarterback who had a passer rating of 90 or better for the previous two seasons. I was surprised by this until I realized that if you have a quarterback doing that well, you're not going to give him up. Well, the Chargers did (and it wasn't a bad move by any means, thanks to Phil Rivers), and the Saints really lucked out.

This year they made the playoffs, got a first round bye, and even won a game, sending them to the NFC Championship game against the Chicago Bears. It was the second playoff game the Saints had ever won. It will be their first trip to the NFC Championship. And it is the most remarkable one-season-to-the-next turnaround in NFL history. No other team had a worse record in the year preceding a trip to the Championship game.

We'll see how the Saints do in the rest of the playoffs. Will they manage to defeat the Chicago Bears, at Soldier Field? It's possible; the Bears haven't looked good in the second half of the season, despite their early dominance. And depending on the outcome of tonight's game between the Patriots and the Chargers, as well as next week's AFC matchup between the winner of that game and the Colts, it's just possible that the Saints will be matched up in the Super Bowl against -- get this -- the New England Patriots. The two teams who actually benefited from tragedy will be facing each other. Will the torch be passed from New England to New Orleans? From the Patriots to the Saints? From Belicheck to Payton? Only time will tell.

Another possibility is that the Chargers will beat the Patriots, and then the Colts (which is likely, considering LT's awesomeness and Indy's lack of a defense), and go on to face the Saints in the Superbowl. And we'll get to see if San Diego made a mistake by getting rid of Brees, or if they made the right move in going with Rivers. (By the way, in case anyone was paying attention, Drew Brees is another Big Ten quarterback.)

Frankly, I'm rooting for the Chargers over the Patriots. No surprise, I despise the Patriots. But that's a passing thing. Five years from now, my hatred will have subsided. But for the sake of the sport, I hope that on Superbowl Sunday we don't see a scoreboard with the Saints and Patriots both on it. That would just be too much. For all us football fans out there, who have spent so many years of our lives following our teams and our favorite players ... is it really so meaningless week in and week out that the only thing that you need to do to have a Superbowl caliber team is to suffer some horrible tragedy?

Saturday, January 13, 2007


A while back I bought the Miglia TVMini HD, which allows you to view HDTV streams on your computer. It's essentially an HDTV tuner. There are many other such products, many of which have more impressive features than the TVMini; but this one gets to brag about its size (for what that's worth).

I have a cheap 37" HDTV (doesn't have an ATSC tuner, supports 1080i/720p only), but I don't have cable TV. I use the television as a computer monitor for my G5 tower. It works pretty well in that function -- all I use it for is watching movies and television shows that I have saved to the computer. But now it's time for playoff football, so I need to be able to watch television. So I had to get the TVMini working again.

My G5 doesn't have wireless (I bought an AirPort card, but there must be something wrong with either the card or the computer, as it won't work ... I bought them both refurbished, so it doesn't bother me much), so I hadn't had it connected to the internet. But apparently the EyeTV software that comes with the TVMini requires an internet connection. I bought a 25' ethernet cable and ran it from my Mac Mini to the G5 and turned on internet connection sharing. Instantly, the G5 was online, and the EyeTV software came alive.

It scanned the airwaves for what channels were available, then downloaded the program information and displayed it. The interface is pretty, but not quite *that* intuitive. You have to right click the channel name on the left of the screen to get the options you want, and there are 2 options that always stand out in my mind. "Go To Now" and "Tune To" ... it turns out that "Go To Now" does not mean "go to this channel now," but rather "change the program display such that what's currently on television is displayed." I don't know what would be a better name, but I found that confusing. "Tune To" did what I wanted: go to the channel and view it. It seems to me that if you double click the channel name, it should tune to it.

I must say, ATSC over-the-air broadcasts look really, really good. Of course, not all stations are broadcasting in HD, so I'm getting some SD content too (broadcast over HD frequencies), but those programs that actually are HD are stunning. I'm watching the Eagles-Saints game right now, and the picture quality is fantastic.

But, there's a problem with the move to digital television, and that seems to be the very nature of "digital" itself. Unlike your father's TV sets, if the signal isn't quite good enough, you never get static and the picture quality is never compromised. It just stops and waits for the signal strength to get back up to a sufficient level again.

According to a cursory study of the signal strength graph, the TVMini cuts out if the signal strength drops below 50%. Unfortunately, the antenna they give you really bites, and I have yet to see a signal higher than 66%. Worse, every 5-10 seconds it drops down to 30-40% for a few seconds, meaning that the television viewing experience is pretty jarring.

The EyeTV software includes some really cool features, like scheduling/recording shows, pause/resume live television, encode for iPod, etc. (I tried encoding down to H.264 several months ago, and it's _slooow_ ... much slower than the x264 codec used by Handbrake.) But I can't use any of these features because the feed I'm getting through this antenna is too miserable.

I don't want to sign up for cable (because I hate Comcast), so I may have to buy a higher quality ATSC antenna. And I'll have to get a good one that does both VHF and UHF, because I'm in Chicago and CBS, for some reason, is the only UHF station and is also broadcasting at extremely low power. There are technical reasons for this, but I don't understand the political reasons for them being put into place.

It's too bad, too. The TVMini HD is a pretty cool little product, hampered by its generic remote control which relies on the functionality of mostly unlabelled buttons and a bargain basement antenna that destroys the quality of your signal. I can't recommend this product by itself unless you have cable (but you can't use it with a cable box, you need to plug it directly into the cable and hope you're getting an unencrypted digital Clear QAM signal) or are planning to buy a high quality ATSC antenna along with it.

But I did get to watch football on my HDTV today, even if the CBS nonsense prevented me from watching the early game (it was AFC so it was on CBS) and the bad antenna made the late game (NFC, so it's on Fox) nearly unwatchable. It's still football, and it's still the playoffs. And it was a really good game, to top it all off!

Until next time, take it easy.