Monday, March 01, 2010

Convenient Batch Re-Titling of TV Series

Have you ever downloaded or archived a TV series? Chances are, unless you meticulously hand-labeled the episodes yourself, you ended up with a grab-bag of assorted wretchedly deformed file names. Things like:

history.channel.aXXo51_[DVR]the_making_of_shoes[HI_QUALITY].AVI
the_three_stooges.1x5.the_voice_of_spring.DVDRip.sTeAlTh.XVID.avi

The OCD neat-freak in me rebels at the very sight of these. They're difficult if not impossible to search for in a file system, and are so cluttered with meta-information that they take a moment to even recognize what they are. The lack of white-space in the names is torturous to the eye. Contrast that with the following:

History Channel - The Making of Shoes.avi
The Three Stooges - S01EP05 - The Voice of Spring.avi

Much cleaner, isn't it? The only concession to short-hand is the Season/Episode identifier, mainly because it would absurdly long without compacting that information. Of course, given that a typical season can run 26 episodes in length, re-entering the information by hand can be anywhere from tedious to masochistic.

Fortunately, there's a better way. Many bulk re-naming tools with wide feature sets exist, but my personal favorite is ReNamer, available in both portable and installable formats. ReNamer's killer feature that sets it above most others is the near real-time application of all the naming rules in the list together, so you can see the final product as you build up rule sets. You can also turn on/off rules in the set with check-boxes, making it easy to find out which rules are causing problems and iteratively fix renaming rule sets. I've created a 22-rule set that can be used to re-name TV series, fixing most of the common naming problems. You can download the file here. Just drop the file into the 'Presets' folder inside the ReNamer program folder, and you're good to go! It will appear under the Presets > Load menu.

You can add files simply by dragging and dropping them into the lower pane. (Note: for some odd reason, this doesn't work on Vista/Windows 7 if you're running the program as an administrator. Go figure. You can still add files from the menu.) The Ctrl+A key combination ('select all') makes it easy to snap up all the files in a folder for dragging. You can see on the left the current name, and on the right the new name. If you're satisfied, you can go ahead and hit 'Rename' in the upper-right corner to actually rename the files, or you can mess with the rules as needed to set the names up like you want them.

Now, I'll go into a bit of detail about what the rules themselves do, since there's no way to add commentary, and some of them are fairly long and/or complex.

  • Rules 1 & 2 remove periods (except in the extension) unless they're surrounded by numbers on both sides. (So decimal numbers will be left as-is.)
  • Rule 3 removes common format/source meta information acronyms that are more or less irrelevant if you have the proper codecs.
  • Rule 4 replaces underscores in the middle of a word with spaces.
  • Rule 5 replaces any "-blah" sequences at the end, which can be useful if there are a lot of contributor screen-names tacked onto the end of the file name. It's disabled by default, as it can remove unintended title information. (For instance: D-Day.avi)
  • Rule 6 is a placeholder for you to add removal commands for other common strings that don't belong, such as a contributor screen-name or a format tag. Note that when editing it, you can use the "+" button to add more than one string search. Look at rule 3 for an example of how to use it. It is also disabled by default.
  • Rule 7 cleans up any mish-mash of spaces, dashes, underscores and periods left hanging around at the end of the file name from the clean-up so far.
  • Rules 8-10 reduce multiple occurrences of spaces, dashes, and periods anywhere in the name to a single one.
  • Rule 11 forces everything to lower-case to make it easier to deal with grammar corrections.
  • Rule 12 fixes missed apostrophes on common contractions.
  • Rule 13 puts everything back into proper first-letter capitalization for titles.
  • Rule 14 de-capitalizes in-between words that shouldn't be capitalized in a title.
  • Rule 15 undoes rule 14 whenever an in-between word is the first word in a group.
  • Rules 16 & 17 capitalize roman numerals (in the middle of the title or at the end)
  • Rules 18 & 19 convert most episode naming conventions to the S#EP# format
  • Rules 20 & 21 convert S#EP# to S##EP## with fixed numbers of digits (inserting leading zeros if needed) to make the names sort properly in a list view.
  • Rule 22 changes most variations of "part 1 - subtitle" to "(Part 1) - subtitle". (With or without subtitles)
  • Rule 23 interprets a trailing number as a part, and renames it to "(Part #)". Because this can misinterpret title information (such as "Apollo 13"), it is left disabled by default.
These are not by any means fool-proof. It's worth mentioning a small list of things that won't be fixed, and have to be checked manually:
  • Missing or incorrect title information
  • Possessive apostrophes ("Sallys day out")
  • Acronyms ("Us Guns of World War II")
  • Mixed trailing numbers ("Amazing Videos 2" & "Apollo 11" in the same batch, one will have to be manually corrected)

However, these rules should help save you a lot of work. There may be a few bugs still lingering in them, it's definitely a work in progress, but anyone with an OCD neat-freak streak in them will probably want to customize the rules anyway to suit themselves.

Labels: ,

Friday, July 24, 2009

Quantum Electronics

Recently, scientists at Yale have created the world's first quantum integrated circuit. For those of you who are uninitiated in quantum mechanics, let me first preface this by saying that quantum mechanics do not, fundamentally, make intuitive sense. I don't understand them, and that's okay, because nobody does. But don't take my word for it:

I think I can safely say that nobody understands quantum mechanics.
-Richard Feynman
Okay, that said, this marks a major milestone in quantum computing. What is quantum computing? Basically, it uses the very singular properties and behaviors of subatomic particles to calculate things in ways that seem utterly nonsensical, yet have fantastic power. Quantum computer bits may assume a bizarre state called a 'q-bit', in which they are both zero and one. Using this, a quantum computer may determine all possible outcomes of an algorithm in a single step!

The chip mentioned in the article is a two-bit chip. The two bits of this chip would allow it to investigate algorithms it could compute within the time of holding a q-bit (on the order of microseconds for this model) of a size less than four (22). For instance, say you had a list of four items. Provided a look-up could be done in less than the maximum time the q-bits can be made to persist on the chip, this could look up all four values simultaneously and return the one you wanted, as opposed to a regular chip, which would have to look at the first one, decide if it was the entry you asked for, then look at the second, and so on. That might not sound terribly impressive, but when you scale it up to chips of, say, 16 bits, then it could compute algorithms with 216 possibilities: 65,536 list lookups (in our example) in a single step. That's a tremendous speed boost.

It also spells out some other, less enjoyable implications in the field of security. Most of the current strong cryptographic systems hinge upon (in one form or another) the factoring problem. It runs something along the lines of: Given a number, determine if the number is prime. You've probably even been required to do this (or something like it) in grade school, and for small numbers, it's easy, as everything is fast for small n. However, the only known algorithm for this is to simply try dividing it by numbers. (You can eliminate some as you go, but not enough to really change the category of the problem.) Thus, arbitrarily large numbers can be chosen such that even a computer working at it's fastest speed has trouble completing the problem in any reasonable timeframe.

If you've noticed that this looks similar in pattern to looking up things in a list, you're catching on. A quantum chip could potentially test all numbers within it's maximum capabilities at once. Before, it was relatively easy to keep ahead of computers: a few extra bits in the factoring problem would add orders of magnitude greater difficulty and time to for brute-force solution techniques. With quantum chips, however, security would be in an arms race against chip manufacturers to increase the size of the key space faster than the capacity of chips could be increased. Alternatively, they could opt to try to make the algorithm longer, so that it couldn't be calculated within the lifetime of the q-bits needed to make the magical all-at-once computation happen. Either way, this could get interesting...

Labels:

Tuesday, June 30, 2009

On Standards and the Web

In case you haven't heard yet, Firefox 3.5 went live today. Among it's more noted features is support for the HTML <video> tag, which basically tells the browser that it should insert all the functionality of a flash embedded video player at that location. I installed it today, of course, and truth be told I really didn't see all that much difference, except for the <video> tag.

I'm a follower of the blog Lifehacker, which posts a lot of tips and tweaks for everyday life, especially computers. However, a few weeks ago I started noticing content being posted with the <video> tag. If you don't have a browser that supports HTML 5, it doesn't work very well. Did I mention that Firefox 3.5 is the first browser to support this? That's right, mainstream content was already being served in a standard that was only implemented in unreleased browsers.

Think about that for a minute. Also consider that HTML 5 isn't even finished yet. Then think about how far Twitter and Youtube have come in just a few years. Do you see the problem yet? Given how quickly businesses build up on the web, and how quickly they are adopted as the de-facto standards, releasing anything half-finished onto the web is dangerous. Suppose the next Youtube were to build up around the <video> tag, accumulate half the internet's video content, and then the <video> tag standard was changed at the last minute in a way that was difficult for this new video site (by now a cornerstone of social media) to implement? Suppose they simply chose not to change? Browser developers would then be stuck either implementing two incompatible versions of the same standard, or explaining to non-technical users why they can't see the videos of dancing bunnies anymore. In fact, that's very similar in nature to the situation that arose with non-standard tags and Internet Explorer, and we all remember how well that mess went.

Sometimes, unfinished things need to be kept seperate from the mainstream, even if it means you don't get the shiniest bits of tech immediately. I think we might do well to cultivate a little more patience for the sake of sanity a few years later. I also know that I'm not the only one who's noticed...

Labels: ,

Wednesday, June 17, 2009

The Price of a Sticker


What is the value of a sticker? To many, not much I'm sure. When I caved in to academic pressures and bought my laptop last year, it came adorned with all manner of little logos and stickers to the point it looked like the NASCAR model. One in particular which irked me was a little logo you may have seen before, the rather ubiquitous Windows compatibility logo. It was for Vista rather than the pictured Windows 7 logo, but you get the idea.

To me, this seemed a waste. Sure, it probably only cost a penny or so, but it was frustrating to me to have to take it off and added no value. I mean, it's not as if HP shipped alternative operating systems on the model, and stickers like this are about as meaningful as the red-and-white starbursts that proclaim 'new and improved' on the same laundry soap you've been buying for twenty years. Talk is cheap, and since the advent of affordable printing processes, print is even cheaper. So, what good is it?

Lately, I've started following a blog I ran across (It's dangerous to call it 'stumbling' these days. Will we have any verbs left unclaimed by the end of Web 2.0? But that's another rant topic for another day.) called Engineering Windows 7. It's not exactly a secret that I became something of a begrudging fan of Microsoft a few years ago, but I too had considered this to be mostly so much fluff. Then, I read this post from the EW7 blog. I knew that they had been putting some serious effort into testing Windows 7 and making real performance improvements, but I'd never realized how much they were doing to test the integrated system including hardware configurations. This probably marks the first time that I actually start to feel that we'll get every penny's worth out of the price of Windows. The sticker I scorned before actually means something this time around. And that's a change I welcome.

Labels: ,