Continuing on the subject of using one cue file per track to create a
separate album from the tracks included in a box set, one significant
obstacle is the number of cue files that have to be created, especially
if it's all done by hand.
Being lazy, I have written a Bash script that assists in generating the
cue files needed. The template is below. This template needs to be
edited for each album. It needs a list of the audio files to be included
in the album. one filename per line, in the correct order for the album.
The filename of that list needs to be assigned to the variable Filelist
in line 6. The variable Outfile in line 8 will be the base name of the
cue files generated. In my example above, that would probably be
"Album01_". Each cue filename will have the track number and the .cue
file extension appended to that base.
Line 20 will attempt to extract the track title from the filename of
each audio file it processes. It assumes that filenames are in the
format TRACKNUMBER - TITLE.EXTENSION, because that is the format I use,
as in the example above. If your filenames are in a different format, it
will be necessary to edit the command. It is also necessary to specify
the extension where you see -F'.XXX' near the end of that line. That
should be -F'.flac' or -F'.MP3' or whatever.
The rest should be obvious. Lines 22 through 26 should be filled in with
appropriate data for the album. Lines 28 through 32 contain information
about individual tracks, most of which is derived from the filename, but
you have the option of specifying a different track artist here.
As I said, this script works for me. I have no idea if there's any
chance of getting it to work on a Mac or in Cygwin. Even on other Linux
machines, it may require some fiddling. The echo command seems to be
especially prone to behaving differently on different systems. I've used
the -e option with echo, so I can escape the quotes that need to be
echoed to the cue files. However, I dropped that option on the two lines
specifying the PERFORMER tag, because using it prevented echoing the \\
separator between multiple artists (it has to be echoed as "\\"), and
the escaped quotes still work. But I suspect others will have different
experiences, If anybody cares to try it, that is! If you do, good luck!
Code:
--------------------
#!/bin/bash
#template for script to create cue files for individual tracks comprising an
album
#Xs must be filled in!
#list of files to be processed, one filename per line (no blank lines) in
desired sequence
Filelist="XXX"
#base name of output cue files (will have number appended)
Outfile="XXX_"
Tracknum="0"
# The following line begins a loop that reads one line from the file list
and processes that line to generate a single-track cue file
while IFS= read -r Trackname
do
# increment track number and add leading zero if needed, then append it and
extension to base name of cue file
let "Tracknum++"
Trackout="$(printf "%02d" $Tracknum)"
Cuefilename="$Outfile$Trackout.cue"
# The next executable line assumes that the filenames of music tracks
consist of track number, a " - " separator (space, hyphen, space), the title of
the track, and then the file type extension.
# Adjust the awk commands as needed, if the filename is in a different
format.
# .XXX must match the file type (extension) of the files to be processed, eg.
.wav or .FLAC (case sensitive)
Title="$(echo -n $Trackname | awk -F' - ' '{print $2}' | awk -F'.XXX' '{print
$1}')"
# The next five lines will embed the genre, year, comment, artist and title
fields for the ALBUM in the cue file
echo -e "REM GENRE \"XXXX\"" > $Cuefilename
echo -e "REM DATE \"XXXX\"" >> $Cuefilename
echo -e "REM COMMENT \"XXX XXX\"" >> $Cuefilename
echo "PERFORMER \"XXX XXX\"" >> $Cuefilename
echo -e "TITLE \"XXXX XXXX\"" >> $Cuefilename
# The next line will link to the audio file for the track and the following
lines will provide track number, title, performer and starting point
echo -e "FILE \"$Trackname\" WAVE" >> $Cuefilename
echo -e "TRACK $Trackout AUDIO" >> $Cuefilename
echo -e " TITLE \"$Title\"" >> $Cuefilename
echo " PERFORMER \"XXX XXX\"" >> $Cuefilename
echo -e " INDEX 01 00:00:00" >> $Cuefilename
done < "$Filelist"
--------------------
LMS (recent) running on Debian X86_64; 5 Squeezelite players (3 in
PiCorePlayer), 3 players connected via Airplay Bridge
1 Squeezebox Radio (upgraded UE Smart Radio) now mostly retired
------------------------------------------------------------------------
RobbH's Profile: http://forums.slimdevices.com/member.php?userid=67008
View this thread: http://forums.slimdevices.com/showthread.php?t=108121
_______________________________________________
ripping mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/ripping