Skip to content

Instantly share code, notes, and snippets.

@lisovy
Created August 8, 2014 12:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lisovy/b9ad0f4b5bc2e052b4c9 to your computer and use it in GitHub Desktop.
Save lisovy/b9ad0f4b5bc2e052b4c9 to your computer and use it in GitHub Desktop.
#!/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