Okay, this is how I do it... shouldn't need any additional scripts, it passes on as many options as you'd like. So "foobar2000 -add file1 file2 directory3 -hide" acts just like "foobar2000.exe /add file1 file2 directory3 /hide" would.
#!/bin/bash
# launches fb2k w/ options
# set path to foobar executable
FB2K="C:\Program Files\foobar2000\foobar2000.exe"
# set Internal Field Separator : character should not appear in filepaths uris or options
IFS='|'
# gives the absolute z: path usable by wine
winepath () {
case "$1" in
/*) # absolute path
file="$1"
;;
~*) # unexpanded home-relative (?)
file="$HOME${1:1}"
# HOME + ~/path, stripping ~
;;
*) # relative path
file="$(pwd)/$1"
;;
esac
file=`echo "z:$file" | sed -e '
s%/[^/]\+/\.\./%/%g # replaces /somedir/../ by /
s%\./%%g # removes ./
s%/%\\\\%g # replace / by \
'`
}
# list of arguments separated by IFS instead of space to prevent string splitting
args=""
# go through all parameters given to script and transform them for wine use if needed
until [ -z "$1" ] ; do
case "$1" in
-h|-help)
echo "Usage : `basename $0` [options] [file1 [file2 [...]]]"
echo "Available switches: -add, -play, -pause, -playpause, -prev, -next, -rand, -stop, -exit, -show, -hide, -config -command:<menu command>, -playlist_command:<context menu command>, -playing_command:<context menu command>, -help."
exit
;;
# add custom options here. Example :
# -rescan)
# args="$args$IFS/command:\"Rescan Media Library\""
# ;;
-*) # options, replacing first character
args="$args$IFS/${1:1}"
;;
# /[^/]+) args="$args$IFS$1" # alternative version, windows syntax
*) # anything else ? could be file path. Or an url... or some other kind of ufo
if [ -e "$1" ] ; then # if it's a file or a directory, translate it for wine
winepath "$1"
args="$args$IFS$file"
else # otherwise keep it as is
args="$args$IFS$1"
fi
;;
esac
shift
done
# replace positional parameters with arguments (starts out with a separator)
set ${args:1}
/usr/bin/wine "$FB2K" "$@" &
exit
Inspired by plukin's script.
You can add as many custom options as you want, see comment inside second "case" block.
Edit : minor readability change.