#!/bin/bash

# Shell script written by stephan beal

# If launched without args it launched the curses interface, otherwise it 
# passes the args as-is to boodler. Maybe it will be useful to you and 
# yours. Simply change the BOODLER_HOME variable at the top of the script 
# and it "should" work.

export BOODLER_HOME=/home/stephan/src/boodler
export BOODLER_EFFECTS_PATH=${BOODLER_HOME}/boodler/effects
export BOODLER_SOUND_PATH=${BOODLER_HOME}/boodler-snd

if [[ "x" = "x$1" ]]; then
    echo "No arguments - assuming you want the leash interface."
    {
	python ${BOODLER_HOME}/boodler/boodler.py --listen listen.Leash &
    } || {
	echo "Error backgrounding boodler."
	exit 1
    }
    bpid=$!
    sleep 1 # make sure background process has time to start up
    python ${BOODLER_HOME}/boodler/leash.py
    kill -HUP $bpid
    exit
fi


exec python ${BOODLER_HOME}/boodler/boodler.py "$@"
