Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
#!/bin/bash
if [ $# -ne 2 ]; then
echo -e "Usage: $0 FLAC_FILE CUE_FILE\n"
exit 1;
fi
FLAC_FILE=$1
CUE_FILE=$2
echo -e "### Splitting audiofile ###\n"
cuebreakpoints "$CUE_FILE" | shnsplit -o flac "$FLAC_FILE"
echo -e "### Saving tags into files ###\n"
cuetag "$CUE_FILE" split-track*.flac
echo -e "### Renaming audio files regarding its tags ###\n"
for X in split-track*.flac; do
NEWNAME1=$(mp3info2 -p "%n" $X)
NEWNAME1=$(printf %02d $NEWNAME1); # leading zero
NEWNAME2=$(mp3info2 -p "%t" $X)
mv $X "${NEWNAME1} -- ${NEWNAME2}".flac
done
echo -e "### Done! ###\n"
exit 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment