CD Backup

Home » CD Backup » eac-post.bat

eac-post.bat


@ECHO OFF
CLS

SET version=3.0.0

TITLE=EAC-POST.BAT, Version %version%

REM ===================
REM  Parameter mapping
REM ===================
REM  %o  %s  %d  "%a"  "%g"  %hHIGH%h  %lLOW%l DISCNO
REM  %1  %2  %3   %4    %5   %6        %6      %7

ECHO.>> %eacEncLog%
ECHO EAC-POST.BAT, Version %version%>> %eacEncLog%
ECHO Written by Neil Popham, 2004 (neilpopham@bigfoot.com)>> %eacEncLog%
ECHO =====================================================>> %eacEncLog%

REM ========================================
REM  Ensure final APE file has been created
REM ========================================
:ApeFileCheck
IF NOT EXIST "%~dp3%~n1%~x3" GOTO WaitForApeFile
ECHO.
ECHO %3 successfully renamed to "%~n1%~x3"
ECHO.>> %eacEncLog%
ECHO %3 successfully renamed to "%~n1%~x3">> %eacEncLog%

REM =======================================================
REM  Detirmine cuesheet filename
REM  EAC 0.95b4 uses "<name>.cue"
REM  while previous versions used "<name>.<extension>.cue"
REM =======================================================
IF EXIST "%~dp3%~n1%~x3.cue" SET cuesheet=%~dp3%~n1%~x3.cue
IF EXIST "%~dp3%~n1.cue" SET cuesheet=%~dp3%~n1.cue

REM ========================================
REM  Add cuesheet to APE file using TAG.EXE
REM ========================================
SET tagCommand=%pathToTag% --ape2 --artist %4 --album %5 -f "CUESHEET=%cuesheet%" "%~dp3%~n1%~x3"
ECHO.
ECHO CALLING TAG USING THE FOLLOWING COMMAND:
ECHO %tagCommand%
ECHO ________________________________________________________________________
ECHO.
ECHO.>> %eacEncLog%
ECHO CALLING TAG USING THE FOLLOWING COMMAND:>> %eacEncLog%
ECHO %tagCommand%>> %eacEncLog%
ECHO ________________________________________________________________________>> %eacEncLog%
ECHO.>> %eacEncLog%
%tagCommand%

REM =================================
REM  Create Par2 files with PAR2.EXE
REM =================================
SET parCommand=%pathToPar2% c -s204800 -r10 -- "%~dp3%~n1%~x3"
ECHO.
ECHO CALLING PAR2 USING THE FOLLOWING COMMAND:
ECHO %parCommand%
ECHO ________________________________________________________________________
ECHO.
ECHO.>> %eacEncLog%
ECHO CALLING PAR2 USING THE FOLLOWING COMMAND:>> %eacEncLog%
ECHO %parCommand%>> %eacEncLog%
ECHO ________________________________________________________________________>> %eacEncLog%
ECHO.>> %eacEncLog%
%parCommand%

REM =================
REM  Verify APE file
REM =================
SET macCommand=%pathToMac% "%~dp3%~n1%~x3" -V
ECHO.
ECHO CALLING MAC USING THE FOLLOWING COMMAND:
ECHO %macCommand%
ECHO ________________________________________________________________________
ECHO.
ECHO.>> %eacEncLog%
ECHO CALLING MAC USING THE FOLLOWING COMMAND:>> %eacEncLog%
ECHO %macCommand%>> %eacEncLog%
ECHO ________________________________________________________________________>> %eacEncLog%
ECHO.>> %eacEncLog%
%macCommand%

REM ===========================================================================
REM  Wait for user to close EAC's completion dialogue, as we want the log file
REM ===========================================================================
REM Skip this pause if the log file already exists
IF EXIST "%~dp3%logFilename%" GOTO :LogFileCheck
REM Beep, to signify that the process has completed
ECHO 
ECHO Please close EAC's completion dialogue, then press any key to complete
REM Wait
PAUSE >NUL

REM ======================================
REM  Ensure EAC log file has been created
REM ======================================
:LogFileCheck
IF NOT EXIST "%~dp3%logFilename%" GOTO WaitForLogFile
ECHO.
ECHO EAC log file, "%~dp3%logFilename%", exists
ECHO.>> %eacEncLog%
ECHO EAC log file, "%~dp3%logFilename%", exists>> %eacEncLog%

REM ====================================
REM  Write CSV of all albums processed
REM ====================================
IF NOT EXIST "%csvLogFolder%" MKDIR "%csvLogFolder%"
IF NOT EXIST "%csvLogFolder%\cdbackup.csv" ECHO Disc,Artist,Album,Date,Time> "%csvLogFolder%\cdbackup.csv"
ECHO %7,%4,%5,%DATE%,%TIME%>> "%csvLogFolder%\cdbackup.csv"
ECHO.
ECHO Details appended to CSV log "%csvLogFolder%\cdbackup.csv"
ECHO.>> %eacEncLog%
ECHO Details appended to CSV log "%csvLogFolder%\cdbackup.csv">> %eacEncLog%

REM ======================================================
REM  Move all remaining, ape-related, files to APE folder
REM ======================================================
ECHO.>> %eacEncLog%
ECHO Moving all ape-related files to "%apeFolder%\%artistFolder%\%albumFolder%">> %eacEncLog%
IF NOT EXIST "%apeFolder%\%artistFolder%\%albumFolder%" MKDIR "%apeFolder%\%artistFolder%\%albumFolder%"
MOVE "%~dp3*.*" "%apeFolder%\%artistFolder%\%albumFolder%" >NUL
ECHO.
ECHO All ape-related files moved to "%apeFolder%\%artistFolder%\%albumFolder%"

REM =====
REM  END
REM =====
GOTO:EOF

REM =========================================================
REM  WaitForApeFile : waits for temporary file to be renamed
REM =========================================================
:WaitForApeFile
REM: Pause for two seconds before returning
ECHO.
ECHO Waiting for %3 to be renamed to "%~n1%~x3"...
ECHO Waiting for %3 to be renamed to "%~n1%~x3"...>> %eacEncLog%
PING 1.1.1.1 -n 1 -w 2000 >NUL
GOTO ApeFileCheck

REM =======================================================
REM  WaitForLogFile : waits for EAC log file to be created
REM =======================================================
:WaitForLogFile
REM: Pause for two seconds before returning
ECHO.
ECHO Waiting for EAC log file, "%~dp3%logFilename%", to be created...
ECHO Waiting for EAC log file, "%~dp3%logFilename%", to be created...>> %eacEncLog%
PING 1.1.1.1 -n 1 -w 2000 >NUL
GOTO LogFileCheck

Back to the guide | View eac-enc.bat


Home | CueMake | Tag | Wapet | CD Backup | Email Me


This document has been printed from http://www.neilpopham.pwp.blueyonder.co.uk/