Hi everyone. I only registered to post this script, for I couldn't find anything that does this.
I'm spanish, so this script is in spanish too, but it's easy to understand, I think.
It basically converts an APE + CUE file in several FLAC files and renames and tags them using the information provided by the cue sheet. It also installs any package needed, except mac-port, but tells you how to do it.
Just copy this in an empty file, rename it to something like apecue2flac, save it and make it executable by doing this:
Code:
chmod +x apecue2flac
Then you can copy it into /usr/bin, so it can be accesible anytime, anywhere:
Code:
sudo cp apecue2flac /usr/bin
Any comment welcome. (I apologize for my broken english).
It's been tested in Hardy and Intrepid.
This is it:
Code:
#!/bin/bash
clear
# Presentación
echo "APECUE2FLAC"
echo
echo
echo
echo "Script para convertir archivos ape con hoja cue asociada en archivos flac sueltos"
echo
echo
echo "ATENCIÓN: ESTE SCRIPT INSTALARÁ AUTOMÁTICAMENTE ALGUNOS DE LOS PAQUETES NECESARIOS PARA EJECUTARSE SI NO ESTÁN YA INSTALADOS."
echo
echo
echo
echo
# Comprueba si se tienen todas las herramientas necesarias y las instala si es necesario
MAC=`which mac`
if [ -z $MAC ]; then
echo "ERROR :-("
echo "No tienes instalado Monkey's Audio Codec."
echo "Busca en Google, que hay mucha información (Es fácil de instalar, pero no está en los repositorios). Te sugiero
que añadas los repositorios de Eudoxos (http://ppa.launchpad.net/eudoxos/ubuntu tuversióndeubuntu main), o que
descargues el deb de aquí: http://members.iinet.net.au/~aidanjm/mac-3.99-u4_b3-1_i386.deb"
exit -1
fi
FLAC=`which flac`
if [ -z $FLAC ]; then
echo "ERROR SUBSANABLE ;-)"
echo "No tienes instalado flac, instalando automáticamente..."
sudo aptitude update && sudo aptitude install flac -y
clear
echo "ERROR CORREGIDO, CONTINUANDO..."
echo
fi
CUE=`which cuebreakpoints`
if [ -z $CUE ]; then
echo "ERROR SUBSANABLE ;-)"
echo
echo "No tienes instalado cuetools, instalando automáticamente..."
sudo aptitude update && sudo aptitude install cuetools -y
clear
echo "ERROR CORREGIDO, CONTINUANDO..."
echo
fi
SHN=`which shntool`
if [ -z $SHN ]; then
echo "ERROR SUBSANABLE ;-)"
echo
echo "No tienes instalado shntool, instalando automáticamente..."
sudo aptitude update && sudo aptitude install shntool -y
clear
echo "ERROR CORREGIDO, CONTINUANDO..."
echo
fi
LL=`which lltag`
if [ -z $LL ]; then
echo "ERROR SUBSANABLE ;-)"
echo
echo "No tienes instalado lltag, instalando automáticamente..."
sudo aptitude update && sudo aptitude install lltag -y
clear
echo "ERROR CORREGIDO, CONTINUANDO..."
echo
fi
# Verifica que hemos elegido un archivo cue y sale si no es así
for i in "$*"; do
case $i in
*.[cU][uU][eE])
echo "Verificando que el archivo $i tiene extensión cue...";;
*)
echo "Advertencia: El archivo $i no tiene extensión .cue. Abortando."
continue
esac
FILENAME="$(basename "$i")"
FILENAME="${FILENAME%.[cC][uU][eE]}"
# Procesa los archivos
echo "Separando archivos..."
cuebreakpoints "$FILENAME".cue
shnsplit -o flac -f "$FILENAME".cue "$FILENAME".ape
echo "Añadiendo información de etiqueta..."
cuetag "$FILENAME".cue split-track*.flac
echo
# Ahora renombra los archivos según el esquema "número de canción título", pero se puede cambiar como queramos,
# usando los comodines habituales. Consultar el manual de lltag para más información.
echo "Renombrando los archivos..."
lltag --yes --no-tagging --rename '%n %t' `ls split-track*.flac`
echo
echo
echo "Proceso terminado."
done
Now, this is the english version, as requested by nafihsus.
My english is not so good, but I think it can be understood, please, feel free to correct it and let me know the changes you might thing desirable: Thank you.
Code:
#!/bin/bash
clear
# Introduction
echo "APECUE2FLAC"
echo
echo
echo
echo "This bash script will convert and split ape files with associated cue files"
echo
echo
echo "WARNING: THIS SCRIPT WILL INSTALL NECESSARY PACKAGES IF NOT ALREADY INSTALLED"
echo
echo
echo
echo
# This will check your system for dependencies, and install packages if needed
MAC=`which mac`
if [ -z $MAC ]; then
echo "ERROR :-("
echo "Monkey's Audio Codec is not in your system"
echo "Do a Google search (it's easy to install, but it's not in the repositories). I suggest you to add the Eudoxos repositories (http://ppa.launchpad.net/eudoxos/ubuntu yourubuntuversion main), or you may prefer to download this deb: http://members.iinet.net.au/~aidanjm/mac-3.99-u4_b3-1_i386.deb"
exit -1
fi
FLAC=`which flac`
if [ -z $FLAC ]; then
echo "ERROR (Don't worry) ;-)"
echo "flac not found, automatically installing"
sudo aptitude update && sudo aptitude install flac -y
clear
echo "EVERYTHING OK, PROCEEDING..."
echo
fi
CUE=`which cuebreakpoints`
if [ -z $CUE ]; then
echo "ERROR (Don't worry) ;-)"
echo
echo "cuetools not found, automatically installing..."
sudo aptitude update && sudo aptitude install cuetools -y
clear
echo "EVERYTHING OK, PROCEEDING..."
echo
fi
SHN=`which shntool`
if [ -z $SHN ]; then
echo "ERROR (Don't worry) ;-)"
echo
echo "shntool not found, automatically installing..."
sudo aptitude update && sudo aptitude install shntool -y
clear
echo "EVERYTHING OK, PROCEEDING..."
echo
fi
LL=`which lltag`
if [ -z $LL ]; then
echo "ERROR (Don't worry) ;-)"
echo
echo "lltag not found, automatically installing..."
sudo aptitude update && sudo aptitude install lltag -y
clear
echo "EVERYTHING OK, PROCEEDING..."
echo
fi
# The following will verify if we have chosen a cue file, and exits if not
for i in "$*"; do
case $i in
*.[cU][uU][eE])
echo "Verifying file $i has a cue extension...";;
*)
echo "Warning: file $i is not a cue file. Aborting."
continue
esac
FILENAME="$(basename $i)"
FILENAME="${FILENAME%.[cC][uU][eE]}"
# Processes files
echo "Splitting files..."
cuebreakpoints "$FILENAME".cue
shnsplit -o flac -f "$FILENAME".cue "$FILENAME".ape
echo "Adding tags..."
cuetag "$FILENAME".cue split-track*.flac
echo
# Now it renames files this way: "song-number title", but this can be changed as liked,
# using common parameters. Please read lltag manual for more information.
echo "Renaming files..."
lltag --yes --no-tagging --rename '%n %t' `ls split-track*.flac`
echo
echo
echo "End."
done
P. S.: I have posted a similar script that does the same with FLAC + CUE files
here.
Bookmarks