I've been looking into using iTunes to manage some avi TV shows as well as music clips and ran into the same problem, and solution. Since I think using QT-Pro to make a wrapper for the file a bit of a hack I looked into other ways to get this to work.
The reason iTunes does not play avi files can be plainly seen in iTunes.app/Info.plist under "CFBundleDocumentTypes". iTunes can also recognise video files by the optional meta-data associated with the file in place of the extension. As there is no entry for .avi and most .avi files do not have the extra meta-data iTunes does not support them.
There are three ways to get .avi files to load into the iTunes library, these are packaging it in a supported format (QT-Pro workaround), adding extra entries to the CFBundleDocumentTypes (may cause problems when updating iTunes) or adding the movie-type meta-data to the file. Adding the movie-type meta-data to the file is the quickest, easiest and safest of all of these options (IMHO).
The file-type meta-data can be changed by using Terminal or Applescript/Automator by doing either of the following (note that iTunes does not check the creator type):
Terminal (requires Apple Dev Tools)
Code:
$ SetFile -t "MooV" /path/to/movie.avi
Applescript:
Code:
tell application "Finder"
set file type of file this_file to "MooV"
end tell
That's it. You should now be able to drag and drop the movie into iTunes.
The next step would be to create a Folder Action or a Droplet that adds the movie-type meta and adds the file to iTunes, see below:
Code:
(*add movie to iTunes
The script will add OSList file-type information to a list of files. This identifies them
as movie files, the files are then imported into iTunes.
TO DO:
Verification of file list passed as video files
Growl integration (if installed)
Move repeat loop into separate object script to clean-up code.
*)
--Folder Action [Attach to a folder in Finder]
on adding folder items to this_folder after receiving file_list
repeat with each_file in file_list
try
tell application "Finder" to set file type of file each_file to "MooV"
end try
end repeat
tell application "iTunes" to add file_list
end adding folder items to
--Droplet [Compile and drop items onto application]
on open file_list
repeat with each_file in file_list
try
tell application "Finder" to set file type of file each_file to "MooV"
end try
end repeat
tell application "iTunes" to add file_list
end open
Note: you can also use applescript to set the video type (ie movie, music video or TV Show).
I've reposted this at
http://forums.ilounge.com/showthread.php?t=214705 where it may eventually find it's way to Doug's Applescript page which is one of the first places I looked for something like this (instead of writing it).