[Abcde-users] [PATCH] Add informations to the CDDB choice

Louis Rannou louis.rannou at gresille.org
Fri Feb 17 13:39:31 GMT 2023


To help for choice when several releases match the CDDB query, we add the
release country and its disambiguation.

Closes issue #161:
https://abcde.einval.com/bugzilla/show_bug.cgi?id=161

Signed-off-by: Louis Rannou <louis.rannou at gresille.org>
---
 abcde                  | 4 +++-
 abcde-musicbrainz-tool | 4 ++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/abcde b/abcde
index b53593a..3df6362 100755
--- a/abcde
+++ b/abcde
@@ -5183,8 +5183,10 @@ if [ "$DOCDDB" = "y" ]; then
 				for X in $(f_seq_row 1 $NUM_CDDB_MATCHES)
 				do
 					ATITLE=$(grep -a -e '^DTITLE=' "${ABCDETEMPDIR}/cddbread.$X" | cut -c8- | tr -d \\r\\n)
+					ACOUNTRY=$(grep -a -e '^DCOUNTRY=' "${ABCDETEMPDIR}/cddbread.$X" | cut -c10- | tr -d \\r\\n)
+					ADISAMBIGUATION=$(grep -a -e '^DDISAMBIGUATION=' "${ABCDETEMPDIR}/cddbread.$X" | cut -c17- | tr -d \\r\\n)
 					SOURCE=$(cat "${ABCDETEMPDIR}/datasource.$X")
-					echo "#$X ($SOURCE): ---- ${ATITLE} ----" >> "${ABCDETEMPDIR}/cddbchoices"
+					echo "#$X ($SOURCE): ---- ${ATITLE} ---- ${ACOUNTRY} ---- ${ADISAMBIGUATION}" >> "${ABCDETEMPDIR}/cddbchoices"
                     for TRACK in $(f_seq_row 1 $TRACKS)
 					do
                         echo "$TRACK:" "$(grep -a ^TTITLE$(($TRACK - 1))= "${ABCDETEMPDIR}/cddbread.$X" | cut -f2- -d= | tr -d \\r\\n)" >> "${ABCDETEMPDIR}/cddbchoices"
diff --git a/abcde-musicbrainz-tool b/abcde-musicbrainz-tool
index 51e49c2..71205e7 100755
--- a/abcde-musicbrainz-tool
+++ b/abcde-musicbrainz-tool
@@ -102,6 +102,8 @@ if ($command =~ m/^id/) {
 	my @releases = @{ $response->{'releases'} };
 	foreach my $release (@releases) {
 	    my $a_artist = "";
+	    my $a_disambiguation = $release->{'disambiguation'};
+	    my $a_country = $release->{'country'};
 	    my $number_artists = @{ $release->{'artist-credit'}};
 	    if ($number_artists > 0) {
 		for (my $i = 0; $i < $number_artists; $i++) {
@@ -168,6 +170,8 @@ if ($command =~ m/^id/) {
 	    print OUT "#CATEGORY=none\n";
 	    print OUT "DISCID=" . $discid . "\n";
 	    print OUT "DTITLE=" . $a_artist. " / " . $release->{'title'} . "\n";
+	    print OUT "DDISAMBIGUATION=" . $a_disambiguation. "\n";
+	    print OUT "DCOUNTRY=" . $a_country. "\n";
 	    print OUT "DYEAR=" . $rel_year . "\n";
 	    print OUT "DGENRE=\n";        
 
-- 
2.39.1




More information about the Abcde-users mailing list