From fcb09851953161c3c777a1a228e2390791c07f17 Mon Sep 17 00:00:00 2001 From: Tom Samstag Date: Sat, 11 Feb 2017 11:30:27 -0800 Subject: [PATCH 1/1] fix release year code The fix for #30 implemented in 1f1d33c64206841195a196595ed48f78952c07e6 relies on the release-event-list node from MB containing a count attribute. However in my testing, that isn't the case, and so the release year is never populated. This change checks that the release_event_list isn't undef before trying to get the events (the cause of the exception in #30) but then doesn't rely on the count() of the release_event_list. --- abcde-musicbrainz-tool | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/abcde-musicbrainz-tool b/abcde-musicbrainz-tool index 5ad0eaa..9103491 100755 --- a/abcde-musicbrainz-tool +++ b/abcde-musicbrainz-tool @@ -92,14 +92,15 @@ if ($command =~ m/^id/) { foreach my $release (@releases) { my $a_artist = $release->artist()->name(); my $va = 0; - my $rel_year = ""; + my $rel_year = ""; if ($a_artist =~ /Various Artists/) { $va = 1; } - if ($release->release_event_list()->count() > 0) { - my @events = @{$release->release_event_list()->events()}; - $rel_year = substr($events[0]->date(),0,4); - } + my $release_event_list = $release->release_event_list(); + if ($release_event_list) { + my @events = @{$release->release_event_list()->events()}; + $rel_year = substr($events[0]->date(),0,4); + } $releasenum++; open (OUT, "> $workdir/cddbread.$releasenum"); -- 2.10.2