From fb06ca90db8d0d50e3fcdf44036a46a2e90510a1 Mon Sep 17 00:00:00 2001 From: darrell-k Date: Fri, 10 Jan 2025 18:34:26 +0000 Subject: [PATCH] Fix multi-disc sequence for non-contiguous check --- Slim/Control/Queries.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Slim/Control/Queries.pm b/Slim/Control/Queries.pm index bfd3fcfc80..5c68f5e5fb 100644 --- a/Slim/Control/Queries.pm +++ b/Slim/Control/Queries.pm @@ -640,7 +640,7 @@ sub albumsQuery { my $col = '(SELECT COUNT(1) FROM (SELECT 1 FROM tracks WHERE tracks.album=albums.id GROUP BY work,grouping,performance))'; $c->{$col} = 1; $as->{$col} = 'group_count'; - $col = "(SELECT GROUP_CONCAT(SUBSTR('00000'||tracknum,-5) || COALESCE(work,'') || '##' || COALESCE(performance,'') || '##' || COALESCE(grouping,''),',,') FROM tracks WHERE tracks.album = albums.id)"; + $col = "(SELECT GROUP_CONCAT(COALESCE(SUBSTR('00000'||disc,-5),'00001') || SUBSTR('00000'||tracknum,-5) || COALESCE(work,'') || '##' || COALESCE(performance,'') || '##' || COALESCE(grouping,''),',,') FROM tracks WHERE tracks.album = albums.id)"; $c->{$col} = 1; $as->{$col} = 'group_structure'; } @@ -845,7 +845,7 @@ sub albumsQuery { my $previousGroup; my $groupSeen = {}; foreach ( sort split(',,', $c->{'group_structure'}) ) { - my $thisTrackGroup = substr($_, 5); + my $thisTrackGroup = substr($_, 10); if ( $previousGroup ne $thisTrackGroup ) { if ( $nonContiguous = $groupSeen->{$thisTrackGroup} && $thisTrackGroup ne '####' ) { last;