REACT:Amending Cuesheet File References
When using REACT to rip to individual tracks you can request all cuesheets to be created, by specifying the following in REACT.ini:
CreateAllCuesheets=1
This will create the following files in the working directory:
- "@albumfile@.[s].cue" (Single WAVE file)
- "@albumfile@.[mg].cue" (Multiple WAVE files with gaps (non-compliant))
- "@albumfile@.[m].cue" (Multiple WAVE files with gaps left out)
- "@albumfile@.[mc].cue" (Multiple WAVE files with corrected gaps)
The multi-file cuesheets will reference the tracks using the filename format set in EAC, which should be "$cdartist$ - $album$ - $track$ - $title$" for standard albums, and specifying a ".wav" extension. However, this is unlikely to be the format that your track files are actually in, which means that the cuesheet will need to be amended in order to be useful.
The additional config code below uses the GNU tool SED to parse the cuesheet created by EAC, and create a new cuesheet referencing the correctly-named files. This is achieved in the following way:
- Every time a track is processed a SED command, to replace that track's filename, is written to a temporary text file called "sedlist.txt".
- When the last track is processed this file is passed to SED which executes each command on the cuesheet text, and writes the new text to a new cuesheet file named "$cdartist$ - $album$.cue".
- The file "sedlist.txt" is deleted.
Writing the SED commands for each track
The following line needs to be added to the code which is run for the format you are using for each track:
ECHO s/FILE "@basename@\.wav"/FILE "%TrackName%\.wv"/>>sedlist.txt
Here it is in the WavPack section:
IF NOT @Wavpack@==1 GOTO end_wavpack_tracks IF NOT EXIST %TrackDir_Wavpack% MKDIR %TrackDir_Wavpack% PUSHD %TrackDir_Wavpack% IF @various@==1 SET VA_tag=-w "album artist=@VA@" ECHO ON @tools@\wavpack.exe @Opt_Wavpack@ %VA_tag% -w artist="@artist@" -w album="@album@" -w track="@track@/@numtracks@" -w title="@title@" -w year="@year@" -w genre="@genre@" -w comment="@comment@" -w encodedby="%USERNAME%" -w encodersettings="Wavpack @Ver_Wavpack@ @Opt_Wavpack@" "@source@" "%TrackName%.wv" ECHO s/FILE "@basename@\.wav"/FILE "%TrackName%\.wv"/>>sedlist.txt @ECHO OFF IF %have_cover%==1 IF NOT EXIST folder.jpg COPY "@cover@" folder.jpg TITLE @track@/@numtracks@ - "@album@" POPD :end_wavpack_tracks
Note that the extension ("wv") will need to be changed depending on the format that you are using. Additionally, if you are using MP3, you will need to use the following line instead, which correctly changes the file type to MP3 from WAVE:
ECHO s/FILE "@basename@\.wav" WAVE/FILE "%TrackName%\.mp3" MP3/>>sedlist.txt
Executing SED
The following lines need to be added to the code which is run for the format you are using at the end of the config:
@tools@\SED -f sedlist.txt <"@albumfile@.[mg].cue" >"$cdartist$ - $album$.cue" DEL sedlist.txt
Here they are in the WavPack section:
IF @Wavpack@==1 ( PUSHD %TrackDir_Wavpack% IF %add_rg%==1 @tools@\wvgain.exe -a *.wv REM COPY /Y "@eaclog@" "EAClog.txt" @tools@\SED -f sedlist.txt <"@albumfile@.[mg].cue" >"$cdartist$ - $album$.cue" DEL sedlist.txt POPD )
These two lines are universal, and can be added to any format's section with no need for change. Note though, that the example uses the "multiple WAVE files with gaps (non-compliant)" cuesheet as its source. This is the cuesheet that most users would require; however you can replace "@albumfile@.[mg].cue" with "@albumfile@.[m].cue" or "@albumfile@.[mc].cue" if you wish.
Requirements
You will need to download the Windows version of SED, including its dependencies ("libintl3.dll" and "libiconv2.dll"), and put all three files in your REACT tools directory.
Related Thread
This tip is a result of a string of posts between lipidicman and Synthetic Soul in the REACT 2 thread beginning with this post.