#! /bin/bash #################################################### # Music Player Song Change Script # Handles many players at once # mpchange {install|back|start|pause|stop|fwd} (mplayer) # Arun Chaganty #################################################### # keybindings: BACK=" z" START=" x" PAUSE=" c" STOP=" v" FWD=" b" #actual script if [[$1 == "install"]] then #Set commands EDIT="gconftool-2 -t string -s /apps/metacity/keybinding_commands"; $EDIT/command_1 $MP_PATH/mpchange back; $EDIT/command_2 $MP_PATH/mpchange start; $EDIT/command_3 $MP_PATH/mpchange pause; $EDIT/command_4 $MP_PATH/mpchange stop; $EDIT/command_5 $MP_PATH/mpchange fwd; #set keybinding EDIT="gconftool-2 -t string -s /apps/metacity/global_keybindings"; $EDIT/run_command_1 BACK; $EDIT/run_command_2 START; $EDIT/run_command_3 PAUSE; $EDIT/run_command_4 STOP; $EDIT/run_command_5 FWD; elif [[$1 == "back" || $1 == "start" || $1 == "pause" || $1 == "stop" || $1 == "fwd" ]] then for mp in $MPLAYERS; do if [1] if [`ps -A| grep $mp` -ne ""] then case "$mp" in "banshee") banshee() ;; "audacious") audacious ;; esac break; fi done else-if [[$1 == help]] then echo "mpchange: Music Player Track Changer"; echo "Handles $MPLAYERS"; echo "usage: mpchange {install|back|start|pause|stop|fwd} (mplayer)"; echo ""; echo "install: set up keybindings. Uses commands 1-5."; echo "{back|start|pause|stop|fwd}: Obvious command."; echo "help: This information"; echo ""; else echo "usage: mpchange {install|back|start|pause|stop|fwd} (mplayer)"; echo "For further information: mpchange help"; fi function banshee() { case "$1" in back) banshee --previous ;; start) banshee --start ;; pause) banshee --pause ;; stop) banshee --stop ;; fwd) banshee --next ;; esac } function audacious() { case "$1" in back) audacious --rew ;; start) audacious --start ;; pause) audacious --play-pause ;; stop) audacious --stop ;; fwd) audacious --fwd ;; esac }