[Alsaplayer-devel]python interface plugin

Andy Lo A Foe andy@alsaplayer.org
Sat, 13 Apr 2002 13:44:59 +0200


On Sat, Apr 13, 2002 at 07:12:30AM +0700, Evgeny Chukreev wrote:

> It looks like alsaplayer doesn't see more than two options in such
> context (#!)!
> becouse if I type 'alsaplayer -v -v' in command line AP shows me version

Ok, I know what is happening now. The #! construct passes everything
after the command as the first argument, the second argument will be the
name of the script. So #!/usr/local/bin/alsaplayer -i text will get
parsed as:

argv[0] = "/usr/local/bin/alsaplayer"
argv[1] = "-i text"
argv[2] = "/tmp/lala"

(/tmp/lala is the file containing the #!)

Of course alsaplayer chokes on this. One possible solution might be to
pass the interface in the name. There is support for the following in
alsaplayer currently:

/usr/local/bin/alsaplayer = main alsaplayer binary

# ln -s /usr/local/bin/alsaplayer /usr/local/bin/alsaplayer-python

This will create a symlink /usr/local/bin/alsaplayer-python which points
to the main binary. AlsaPlayer will detect this format and take the
string after the - as the interface plugin to load so it will be like
running "alsaplayer -i python". Replace python with any name of a valid
interface plugin.

Another solution is to detect when we are called from a script and to
the right parsing, this is hard.

Andy