Skip to content

Commit

Permalink
#879 Don't use the release grouping if the album list is filtered by …
Browse files Browse the repository at this point in the history
…a role, eg. after drilling down from a "Conductor" menu.

Fix icon display in the Default web UI.
Show tracks in "Composer" section if they're part of a compilation.
  • Loading branch information
mherger committed Oct 11, 2023
1 parent 763b5d1 commit ac9507f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
15 changes: 14 additions & 1 deletion Slim/Menu/BrowseLibrary.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1389,7 +1389,20 @@ sub _albumsOrReleases {
my ($client, $callback, $args, $pt) = @_;
my @searchTags = $pt->{'searchTags'} ? @{$pt->{'searchTags'}} : ();

if ($prefs->get('groupArtistAlbumsByReleaseType') && grep /^artist_id:/, @searchTags) {
# We only display the grouped albums if:
# 1. the feature is enabled
if ($prefs->get('groupArtistAlbumsByReleaseType')
# 2. a specific artist is requested
&& (grep /^artist_id:/, @searchTags)
# 3. any one of the following is true:
# 3a. we don't apply a role filter (eg. drilling down from a "Composers" menu)
&& ($prefs->get('noRoleFilter')
# 3b. no specific role is requested
|| !(grep /^role_id:/, @searchTags)
# 3c. we request the album artist
|| (grep /^role_id:.*ALBUMARTIST/, @searchTags)
)
) {
_releases(@_);
}
else {
Expand Down
21 changes: 12 additions & 9 deletions Slim/Menu/BrowseLibrary/Releases.pm
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ sub _releases {
$_ && $_ !~ /(?:library_id\s*:\s*-1|remote_library)/
} @searchTags;

# we want all roles, as we're going to group
push @searchTags, 'role_id:1,2,3,4,5,6';

my @artistIds = grep /artist_id:/, @searchTags;
my $artistId;
if (scalar @artistIds) {
Expand Down Expand Up @@ -56,16 +59,16 @@ sub _releases {
my %contributions;
my %isPrimaryArtist;
foreach (@$albums) {
if ($_->{compilation}) {
$releaseTypes{COMPILATION}++;
# only list outside the compilations if Composer/Conductor
next if $_->{role_ids} !~ /[23]/;
}
# Release Types if main artist
if ($_->{role_ids} =~ /[1,5]/) {
elsif ($_->{role_ids} =~ /[1,5]/) {
$releaseTypes{$_->{release_type}}++;
next;
}
elsif ($_->{compilation}) {
$releaseTypes{COMPILATION}++;
# don't list as track artist on a compilation
next if $_->{role_ids} =~ /[156]/;
}

# Roles on other releases
my @roleIds = split(',', $_->{role_ids} || '');
Expand Down Expand Up @@ -120,7 +123,7 @@ sub _releases {
if (delete $contributions{COMPOSER}) {
push @items, {
name => cstring($client, 'COMPOSITIONS'),
icon => 'html/images/playlists.png',
image => 'html/images/playlists.png',
type => 'playlist',
playlist => \&_tracks,
# for compositions we want to have the compositions only, not the albums
Expand Down Expand Up @@ -158,7 +161,7 @@ sub _releases {
# add "All" item
push @items, {
name => cstring($client, 'ALL_ALBUMS'),
icon => 'html/images/albums.png',
image => 'html/images/albums.png',
type => 'playlist',
playlist => \&_tracks,
url => \&_albums,
Expand All @@ -185,7 +188,7 @@ sub _createItem {

return {
name => $name,
icon => 'html/images/albums.png',
image => 'html/images/albums.png',
type => 'playlist',
playlist => \&_tracks,
url => \&_albums,
Expand Down

0 comments on commit ac9507f

Please sign in to comment.