[Abcde-users] Problem with 'abcde -d disc.flac' Fixed

Charles Steinkuehler charles at steinkuehler.net
Sun Dec 2 19:31:42 GMT 2018


On 12/1/2018 5:05 PM, Charles Steinkuehler wrote:
> On 12/1/2018 1:17 PM, Charles Steinkuehler wrote:
>> I'll try to get full-disk ripping
>> working with the latest abcde this weekend, but I've got some holiday
>> parties to go to as well.  Let me know if you beat me to getting
>> something working!  :)
> 
> OK, there are lots of minor problems, it looks mostly like it's
> related to the addition of musicbrainz support.  Currently, the flac
> file isn't being created with an embedded cue file that includes the
> proper pregap offsets, and when trying to rip a flac file the disc id
> is not getting generated properly.
> 
> I've fixed the disc id issue when using a (properly generated) flac
> file as a source "disk", but it's currently a bit hackish.  I will
> clean up the code and look at trying to get a proper cue file embedded
> into the flac file in the first place tomorrow.

OK, there's less broken than I thought.  Mostly, it's an issue with
usage and documentation, but I've attached two patches that help fix
things up.

The first patch fixes the same issue reported (and patched) by
Matthias König back in April, 2018, but I moved the logic to the flac
section of do_discid() which seems like a better place.

The second patch isn't strictly necessary, but is required unless
you're passing the --wholedisk switch to abcde.mkcue, which isn't
exactly documented anywhere.  With the patch, all you have to do is
specify to use abcde.mkcue and the ONETRACK variable is used to mangle
the generated cue file if needed.

After applying the patches, just make the follow change to your
abcde.conf file:

MKCUE=abcde.mkcue

...and you should be able to rip to/from flac files even with discs
that include a pregap.  Tested with "The Police / Synchronicity"
(pregap = 32) and "Songs in the Key of X" (with two hidden songs in
the pregap).

There's some more code cleanup that could be done, which I'll try to
do soon, but I wanted to get back to a working whole-disc solution as
soon as possible.

MAINTAINERS:
What is the preferred method of patch submission?

-- 
Charles Steinkuehler
charles at steinkuehler.net
-------------- next part --------------
From f772d517f559b9fb8bb0af6019c544ed47d82f19 Mon Sep 17 00:00:00 2001
From: Charles Steinkuehler <charles at steinkuehler.net>
Date: Sun, 2 Dec 2018 08:07:23 -0600
Subject: [PATCH 1/2] Fixup LEADOUT when ripping from flac files

The lead-out value embedded in flac cue files includes any pregap.
Most CDs have no pregap and work fine, but for discs with a non zero
pregap value, the pregap must be subtracted from the leadout value
read from the flac file to generate the proper disc ID values.

Signed-off-by: Charles Steinkuehler <charles at steinkuehler.net>
---
 abcde | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/abcde b/abcde
index ae7bb79..78ffc17 100755
--- a/abcde
+++ b/abcde
@@ -2085,8 +2085,16 @@ do_discid ()
 								OFFSETS="$OFFSETS $(( 10#${OFFSETTIME:0:2} * 4500 + 10#${OFFSETTIME:3:2} * 75 + 10#${OFFSETTIME:6:2} ))"
 							done
 
+							# Remove leading space
+							OFFSETS="${OFFSETS# }"
+
 							LEADOUT=$(( $(echo "$CUESHEET" | grep lead-out | get_last) * 75 / 44100 ))
 							LEADIN=$(( $(echo "$CUESHEET" | grep lead-in | get_last) * 75 / 44100 ))
+							PREGAP=${OFFSETS%% *}
+
+							# Fixup leadout if pregap is non-zero
+							LEADOUT=$(( $LEADOUT - $PREGAP ))
+
 							makeids
 						;;
 						*)
-- 
2.11.0

-------------- next part --------------
From 2ea2904fdcbd3f651e4115719f99f82f69ce620b Mon Sep 17 00:00:00 2001
From: Charles Steinkuehler <charles at steinkuehler.net>
Date: Sun, 2 Dec 2018 10:06:10 -0600
Subject: [PATCH 2/2] Modify abcde.mkcue to use ONETRACK variable

abcde.mkcue required the --wholedisk switch to properly create a cue
file for embedding in a flac file that allows proper discid values when
using the flac file as a source.  This was to support onetrack ripping
of a subset of the CD (eg: tracks 3-7 ripped to a single flac file).

This change simplifies ripping whole discs to a single flac file with
proper support for any non-zero PREGAP values.

Signed-off-by: Charles Steinkuehler <charles at steinkuehler.net>
---
 abcde | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/abcde b/abcde
index 78ffc17..32b1e8b 100755
--- a/abcde
+++ b/abcde
@@ -1970,20 +1970,19 @@ abcde.cue2discid () {
 }
 
 # abcde.mkcue
-# abcde.mkcue [--wholedisk]
 # This creates a cuefile directly from the extended discid information
-# The --wholedisk option controls whether we're ripping data from the
+# The ONETRACK variable controls whether we're ripping data from the
 # start of track one or from the start of the disk (usually, but not
 # always the same thing!)
 #
 # Track one leadin/pregap (if any) handeling:
-# --wholedisk specified:
+# ONETRACK = y
 #   TRACK 01 AUDIO
 #     INDEX 00 00:00:00
 #     INDEX 01 <pregap value>
 #   Remaining track index values unchanged from disc TOC
 #
-# --wholedisk not specified
+# ONETRACK != y
 #   TRACK 01 AUDIO
 #     PREGAP <pregap value>
 #     INDEX 01 00:00:00
@@ -2001,7 +2000,7 @@ abcde.mkcue () {
 	local i OFFSET LBA
 	local CUEWAVFILE
 
-	if [ "$1" = "--wholedisk" ] ; then
+	if [ "$ONETRACK" = "y" ]; then
 		MODE=INDEX
 	else
 		MODE=PREGAP
-- 
2.11.0



More information about the Abcde-users mailing list