
Maybe I’ve overlooked something stupid, but Mozilla Firefox 2.x (I haven’t tested in 3.x yet) is quite inflexible about options and command-line arguments for external (“helper”) programs. This manifests itself in a number of ways, but the one I’m dealing with today is this:
Dammit. That sucks, except that Linux (any Unix, really) makes it quite simple to fix this kind of breakage with a specialized little script.
I’d call it a “one liner” but it technically has two lines (though one just tells the system which shell to use to run the command found in the second line):
#!/bin/bash
/usr/bin/audacious --enqueue $*
The “$*” bit just tells the script to dump whatever arguments it receives right on the end of command. So, if we call this thing “audacious_enqueue.sh” (convenient, since that’s what I did call it), and then run it thusly:
$ audacious_enqueue.sh http://www.di.fm/mp3/ambient.pls
That script will, in turn, run the following (just as if I’d typed it myself):
$ /usr/bin/audacious --enqueue /www.di.fm/mp3/ambient.pls
Now, when Firefox asks “what the hell should I do with this .PLS file?” I can just tell it to open it in a program, select “Other…,” then give it the name of my script. It figures out the rest automatically, and all is well in the universe.
Yes, Windows can do this, too; it uses “batch files” instead of “scripts” but they’re essentially the same thing. The bitch about doing it with batch files is the syntax is far more archaic (with lots of quoting for that near-guaranteed “Program Files” bit that will appear in the path to the actual binary you’re calling — spaces confuse shells), and there’s a whole lot less flexibility. I haven’t written a batch file for a few years now, so I don’t know if they’ve ever fixed it, but I do know there’s no equivalent of “$*” available from COMMAND.COM. I’m not sure if that’s actually a big deal in this specific instance (Firefox always just sends a properly-escaped URL, always a single argument) so presumably $1 or the equivalent would work, but it’s still something that’s lacking.
In a more sane world, Audacious would just add an option to control the “default” behavior for “someone just handed me a pile of new files” actions, but we live in a very insane world in which XMMS is no longer very reliable on modern systems.
Comments
Post new comment