All pastes #518696 Raw Edit

mplayer

public shellscript v1 · immutable
#518696 ·published 2007-05-29 11:54 UTC
rendered paste body
#! /bin/bash##################################################### Music Player Song Change Script#	Handles many players at once#	mpchange {install|back|start|pause|stop|fwd} (mplayer)# Arun Chaganty <arunchaganty@gmail.com>##################################################### keybindings:BACK="<Super> z"START="<Super> x"PAUSE="<Super> c"STOP="<Super> v"FWD="<Super> b"#actual scriptif [[$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	doneelse-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";fifunction 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}