Movie file renaming

"I can't watch Brokeback Mountain for the same reason i can't watch horror movies. I would scream 'HE'S RIGHT BEHIND YOU!!!' in the middle of the theater."    — who.
On this page:

Sorting your movie collection

I recently discovered the very powerful script lm.py which can identify a movie from its file and also get a subtitle file for it. So get and install it first. Based on it I wrote this simple script to run it on a 'single' video file as the normal lm.py runs on the entire tree structure and often chokes on problematic files.

So the following script (tentatively named GetSub.sh) does two things when applied to a video file: if offers to rename your file to a name with IMDB characteristics (film name, plot keywords, director's name), and it downloads an english subtitle. Language easily changeable in the 1st line of the script. You end up with filenames such as: Amazon Aliens of the Future (1966,8.9,701Mb) [Action, Sci-Fi, Romance] from Scott Gandhi.avi

Place this script (and possibly lm.py) in your ~/bin/ directory, and don't forget to "chmod +x". I have no idea if this works under cygwin. My script probably does, but I have no idea if lm.py does.

Note that this script often fails on first try: it returns the correct name, but does not change it. I have no idea why, but a simply workaround it to run it a second time.

You can run this script on an entire directory with the following command: find -maxdepth 1 -type f -iregex '.*\.\(mp4\|divx\|avi\|mkv\|mpg\|mpeg\|wmv\|mov\|flv\|rmvb\|asf\|3gp\|vob\)' ! -regex '.*([12][0-9][0-9][0-9],[0-9]\.[0-9],[0-9].*' -execdir GetSub.sh "{}" \;