#!/bin/sh ############################# ## Executes a command file and writes a blank one in its place. ## Usage: xmms-songchange [CURRENT-SONG] ## ## Run this with xmms in Properties, Effect/General Plugins, song_change ## Set keybindings to run commands like: ## echo 'xmms --stop' >>$HOME/.xmms/command ## (this will stop xmms after the current song finishes) ## ## xmms-songchange 0.1, Copyright (c) 2003 by Adam Katz , GPL ############################# # help screen [ "$@" = "--help" ] && \ grep '^## ' `which $0 2>/dev/null || echo $0` |sed 's/^...//' && exit 0 cmdfile="$HOME/.xmms/command" cp -p "$cmdfile" "${cmdfile}-prev" # run script [ -x "$cmdfile" ] && "$cmdfile" || echo 'problem running script' >&2 # erase script and place the following information there instead: echo "# now playing: $@ # `date` #################################################################### # This is an auto-generated file and will be overwritten after use. # The following will be run once the above song ends: " >"$cmdfile" # make executable if not already (only if we own the file) [ -x "$cmdfile" ] || [ -O "$cmdfile" ] && chmod u+x "$cmdfile"