#!/bin/sh # file renamer for use with XMMS # # This script categorises the XMMS mp3 output plugin # recordings onto the disk so XMMS isn't likely to overwrite old # recordings with new ones. Run after listening to some nice Internet # radio you want to keep. # edit the following line for "Save stream to disk" line in XMMS for NAME in ~/music/*.mp3 do DIR=`dirname "$NAME"` BASE=`basename "$NAME"` if [ -s "$NAME" ] then if echo $BASE | grep ^[[:digit:]] > /dev/null then # don't process filenames that begin with a number true else NEWNAME="$DIR/`date --reference="$NAME" +%Y-%m-%d-%H-%M-%S`.mp3" echo `basename "$NAME"` # store file's name in id3v2 tag id3v2 --song "`basename "$NAME"`" "$NAME" > /dev/null # rename file as current date mv "$NAME" "$NEWNAME" fi else rm $NAME fi done