Not much to report over the last few days. I was mainly busy ripping old CDs so I could store them in the closet. cdparanoia -B and ddrescue (instructions) are...
Not much to report over the last few days. I was mainly busy ripping old CDs so I could store them in the closet.
cdparanoia -B
and ddrescue (instructions ) are essential for damaged audio tracks and CD-Rs. However, for old DOS/Win3.1-era CD-ROM games which use Redbook audio, they don’t really produce something that DOSBox or CDEmu+Wine can mount and play.
As such, I whipped up a quick little script for generating BIN/CUE pairs based on advice for ripping Playstation games under Linux. Here it is in case anyone wants it (you’ll also want my swab.py script that works but is long overdue for a rewrite):
#!/bin/bash
# NOTE: If the generated file contains audio tracks, they will have the wrong
# endianness for the .CUE file and something like BinChunker or my
# swab.py must be used to rewrite the .BIN file before it can be
# used. (This isn't automatic because swapping the byte order
# will break the .TOC file the .CUE was generated from)
#
# Required packages:
# - cdrdao (for the actual ripping and toc2cue)
# - eject (for closing and opening the tray)
# - genisoimage (for getting the volume name via isoinfo)
# - kde-runtime-data (for the default completion notification sound)
# - sox (for audio completion notification)
DRIVE_PATH="/dev/sr1"
DONE_SOUND="/usr/share/sounds/KDE-Im-Nudge.ogg"
# Ensure the disc is loaded
# TODO: Figure out how to wait for the TOC to be read
eject -t "$DRIVE_PATH"
# Get the volume name either from the disc or from the command-line
if [ -n "$1" ]; then
volname="$1"
else
volname=$(isoinfo -d -i "$DRIVE_PATH" | grep 'Volume id:' | awk '{ print $3 }')
fi
volname="${volname// /_}"
# Ensure there's a containing folder and change into it
mkdir -p "$volname"
pushd "$volname" > /dev/null
# Make sure we can get exclusive access to the disc
umount "$DRIVE_PATH"
# Rip it or die
cdrdao read-cd --read-raw --datafile "$volname".bin --device "$DRIVE_PATH" --driver generic-mmc-raw "$volname".toc || exit 2
# Notify success and eject
play -q "$DONE_SOUND"
sleep 1
eject "$DRIVE_PATH"
# Generate a .CUE file and make it clear if there are audio tracks to byte-swap
# TODO: Find a way to generate an ISO if the full strength of BIN is excessive
toc2cue "$volname".toc "$volname".cue > /dev/null
# TODO: Detect if there are audio tracks automatically and, if so, byte-swap
cat "$volname".cue
# Offer a streamlined way to note down the CD key if present
read -p "Does the CD have a CD-Key? " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
$VISUAL "cd_key.txt"
fi
## Properly quote the cue file contents. (an alernative to subbing in underscores)
#sed -i 's@^FILE \([^"].*[^"]\) BINARY@FILE "\1" BINARY@' .cue
popd > /dev/null
#7z a "$volname".7z "$volname" && rm -rf "$volname"
Simple CD-Ripping Wrapper by Stephan Sokolow is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License .