I have just finished this new script based on the other I posted before. This one will split, rename and tag all those FLAC + cue files we usually found encoded with EAC. Use the same procedure I suggested in
http://ubuntuforums.org/showthread.php?t=1084665&
It's also in spanish, but it's very easy to understand. I can translate it on request.
It's been tested in Hardy and Intrepid.
Here it is:
Code:
#!/bin/bash
clear
# Presentación
echo
echo
echo "FLACCUE2FLAC"
echo
echo
echo
echo "Script para convertir archivos FLAC 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 que están instalados los paquetes necesarios y los instala si no es así
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
for i in $*; do
case $i in
*.[cU][uU][eE])
echo "Verificando si el archivo $i tiene extensión cue...";;
*)
echo "Advertencia: El archivo $i no tiene extensión .cue. Abortando."
continue
esac
# Procesa los archivos
FILENAME="$(basename $i)"
FILENAME="${FILENAME%.[cC][uU][eE]}"
echo "Separando archivos..."
cuebreakpoints $FILENAME.cue
shnsplit -o flac -f $FILENAME.cue $FILENAME.flac
echo "Añadiendo información de etiqueta..."
cuetag $FILENAME.cue split-track*.flac
# Renombra los archivos siguiendo la estructura "número de pista título", que es la que uso, pero se puede
# modificar fácilmente usando los comodines habituales. Consultar el manual de lltag para más información.
echo "Renombrando archivos..."
lltag --yes --no-tagging --rename '%n %t' `ls split-track*.flac`
echo
echo
echo "Proceso terminado."
done
This is the english version, as requested by nafihsus
Code:
#!/bin/bash
clear
# Introduction
echo
echo
echo "FLACCUE2FLAC"
echo
echo
echo
echo "This script will convert, split and tag FLAC files with an associated cue sheet"
echo
echo
echo "WARNING: THIS SCRIPT WILL AUTOMATICALLY INSTALL SOME NECESSARY PACKAGES IF NOT ALREADY INSTALLED"
echo
echo
echo
echo
# This will check if all packages needed are present in the system, and will install them if not.
FLAC=`which flac`
if [ -z $FLAC ]; then
echo "ERROR (Don't worry) ;-)"
echo "FLAC is not in your system, automatically installing..."
sudo aptitude update && sudo aptitude install flac -y
clear
echo "OK NOW, PROCEEDING..."
echo
fi
CUE=`which cuebreakpoints`
if [ -z $CUE ]; then
echo "ERROR (Wish every error were like this one...) ;-)"
echo
echo "cuetools not present, automatically installing..."
sudo aptitude update && sudo aptitude install cuetools -y
clear
echo "OK NOW, PROCEEDING..."
echo
fi
SHN=`which shntool`
if [ -z $SHN ]; then
echo "ERROR (Not the end of the world, anyway) ;-)"
echo
echo "shntool is not around here, let's get it..."
sudo aptitude update && sudo aptitude install shntool -y
clear
echo "OK, PROCEEDING..."
echo
fi
LL=`which lltag`
if [ -z $LL ]; then
echo "OH, MY GOD! ;-)"
echo
echo "lltag is not in your computer, installing..."
sudo aptitude update && sudo aptitude install lltag -y
clear
echo "AT LAST, PROCEEDING..."
echo
fi
# Now it will check if we have chosen a cue file
for i in $*; do
case $i in
*.[cU][uU][eE])
echo "Checking if file $i is a .cue file...";;
*)
echo "Warning: File $i is not a .cue file. Aborting."
continue
esac
# Processing files
FILENAME="$(basename $i)"
FILENAME="${FILENAME%.[cC][uU][eE]}"
echo "Splitting files..."
cuebreakpoints $FILENAME.cue
shnsplit -o flac -f $FILENAME.cue $FILENAME.flac
echo "Adding tags..."
cuetag $FILENAME.cue split-track*.flac
# This will rename files using the strucure "track-number title", the one I like, but it can be easyly changed 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 "Process ended."
done
Bookmarks