open movie files with mplayer cli and applescript

Dear All,

I would like to open all my movie files with command line mplayer. I have a bash script that has many mplayer parameters.
However as I don’t know how to assign a bash script to run specified types of files in Finder, so I came up with Applescript.

I wrote a script that works fine if you drop a movie file on it, or open with “Open with”. But I can’t assign to all movie files, because when I click on “Change All” after “Get info” on a file, the default Quicktime player will be selected instead of my mplayer laucher applescript application. This drives me crazy.

My script:


on open names
	set arguments to "-fs -framedrop -cache 8192"
	set filename to quoted form of POSIX path of item 1 in names
	set command to "~/bin/mplayer " & arguments & " " & filename
	do shell script command
end open

I tried to edit Info.plist inside the newly created application, and added some extensions (like avi, mp4) to CFBundleTypeExtensions.

What’s wrong? Any ideas? Thanks!