Page 1 of 4 123 ... LastLast
Results 1 to 10 of 36

Thread: Script converting APE + CUE to splitted FLACs

  1. #1
    Join Date
    Mar 2009
    Beans
    10

    Script converting APE + CUE to splitted FLACs

    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.
    Last edited by txust; November 30th, 2009 at 06:50 PM. Reason: Added URL to FLAC + CUE script.

  2. #2
    Join Date
    Apr 2008
    Location
    Cologne
    Beans
    49
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Script converting APE + CUE to splitted FLACs

    Hi txust, this is exactly what I was looking for. So far I always use the aidanjm http://aidanjm.wordpress.com/ tools manually.
    I run Hardy on a Dell PC and do convert quite some ape files which need renaming after splitting. What does your script expect as input parameters?

    I definitely would be interested in an English version.

  3. #3
    Join Date
    Mar 2009
    Beans
    10

    Re: Script converting APE + CUE to splitted FLACs

    Hi!
    It renames the songs like this: "number title", with no dash or anything in between, but you can change it if you use other parameters instead of "%n %t". You can refer to the lltag manual. Hope it works for you. I will translate it.

  4. #4
    Join Date
    Apr 2008
    Location
    Cologne
    Beans
    49
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Script converting APE + CUE to splitted FLACs

    Running the script without parameters resulted in downloading lots of modules the first time. However, the ape file in the directory is not being converted or split.
    I receive a message:

    ATENCIÓN: ESTE SCRIPT INSTALARÁ AUTOMÁTICAMENTE ALGUNOS DE LOS PAQUETES NECESARIOS PARA EJECUTARSE SI NO ESTÁN
    YA INSTALADOS

    But other than that nothing happens.

  5. #5
    Join Date
    Mar 2009
    Beans
    10

    Re: Script converting APE + CUE to splitted FLACs

    Ok, now I understand, sorry. This script is intended to convert ape files which have a cue file associated. For example, you have an ape file 1.ape and its cue file is 1.cue.
    if you run:
    Code:
    apecue2flac 1.cue
    the script will split 1.ape into several flac files, tag and rename them using the information the cue file provides. So, it won't work with already splitted flac files. Try it with the original ape and cue file.
    Let me know any other issue, and it's obvious I must translate it.

  6. #6
    Join Date
    Apr 2008
    Location
    Cologne
    Beans
    49
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Script converting APE + CUE to splitted FLACs

    Thanks a lot. Script works perfect on my system. After my vacation I am going to try the cueflac2flac script.

  7. #7
    Join Date
    Jun 2008
    Beans
    10

    Re: Script converting APE + CUE to splitted FLACs

    Thank you txust.

    I have .ape & .cues in hundreds of folders.

    Can your script be changed to recursively convert and split files in a directory?

    Can your script be changed to delete the original .ape files?

    Can your script be changed to ignore .flac &.cues?
    Last edited by TimCastle; April 6th, 2009 at 12:36 PM.

  8. #8
    Join Date
    Mar 2009
    Beans
    10

    Re: Script converting APE + CUE to splitted FLACs

    Hello, TimCastle.
    I'm not sure you can use this script recursively, and I don't think it's a good idea, because I have found that many cue files have to be edited before using apecue2flac, so using it recursively wouldn't work properly.
    You can modify the script to delete the original ape files just by adding this line before it finishes:
    Code:
    rm *.ape
    is that simple, but I wouldn't do that because if the cue file is not correct, the script would delete the ape anyway, leaving you with a cue file and no sound file. I suggest you to delete the ape files manually after conversion.
    The script already ignores FLAC files, only works with files with ape extension. I have written another script to split, tag and rename FLAC + cue files, it's here:

    http://ubuntuforums.org/showthread.p...4840&highlight

    (its name is flaccue2flac)

  9. #9
    Join Date
    Jun 2008
    Beans
    10

    Re: Script converting APE + CUE to splitted FLACs

    txust! Thank you very much for the detailed reply!

    As of now there is no way to convert a batche of .ape & .cues to individual .flac tracks while preserving the tag information.

    I will split all my .ape & .cues into .apes using

    http://aidanjm.wordpress.com/2007/02...v-by-cue-file/

    And then run this script

    http://legroom.net/software/convtoflac

    This appears to be the best choice for anyone in my situation.

  10. #10
    Join Date
    Mar 2009
    Beans
    10

    Re: Script converting APE + CUE to splitted FLACs

    Hi!
    My script does it, it converts ape + cue in splitted flac while preserves the tags. Its limitation is that it can't do it recursively, but those you have just posted neither do it, so it's better for you to use apecue2flac, give it a try.

Page 1 of 4 123 ... LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •