Skip to content

Commit

Permalink
#879 Fix library view filtering, list all release types
Browse files Browse the repository at this point in the history
  • Loading branch information
mherger committed Oct 9, 2023
1 parent 6ccf616 commit c681652
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
16 changes: 14 additions & 2 deletions Slim/Menu/BrowseLibrary/Releases.pm
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ sub _releases {
} grep {
# library_id:-1 is supposed to clear/override the global library_id
$_ && $_ !~ /(?:library_id\s*:\s*-1|remote_library)/
}@searchTags;
} @searchTags;

my @artistIds = grep /artist_id:/, @searchTags;
my $artistId;
Expand Down Expand Up @@ -75,9 +75,19 @@ sub _releases {
my $searchTags = [
"artist_id:$artistId",
"role_id:" . PRIMARY_ARTIST_ROLES,
"library_id:" . $library_id,
];

foreach my $releaseType (@{Slim::Schema::Album->primaryReleaseTypes}) {
my %primaryReleaseTypes = map { { uc($_) => 1 } } @{Slim::Schema::Album->primaryReleaseTypes};
$primaryReleaseTypes{COMPILATION} = 1; # not in the above list but we still want to ignore it here

my @sortedReleaseTypes = @{Slim::Schema::Album->primaryReleaseTypes}, sort {
$a cmp $b
} grep {
!$primaryReleaseTypes{$_}
} keys %releaseTypes;

foreach my $releaseType (@sortedReleaseTypes) {
my $name;
my $nameToken = uc($releaseType);
foreach ($nameToken . 'S', $nameToken, 'RELEASE_TYPE_' . $nameToken . 'S', 'RELEASE_TYPE_' . $nameToken) {
Expand All @@ -99,6 +109,7 @@ sub _releases {

$searchTags = [
"artist_id:$artistId",
"library_id:" . $library_id,
];

foreach my $role (sort keys %contributions) {
Expand Down Expand Up @@ -132,6 +143,7 @@ sub _releases {
}

$result->{offset} = $args->{index};
$result->{sorted} = 1;

# show album list if there's no sub-category
if ($result->{total} > 1 || $args->{quantity} == 1) {
Expand Down
4 changes: 2 additions & 2 deletions strings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9252,8 +9252,8 @@ SETUP_RELEASE_TYPES_INCLUDE
EN Release types to include in Albums list

SETUP_RELEASE_TYPES_DESC
DE Sie können angeben, welche Veröffentlichungstypen (siehe <a href="https://beta.musicbrainz.org/doc/Release_Group/Type">MusicBrainz</a>) in der Albenliste mit aufgeführt werden sollen.
EN You can specify what release types you want to include in the albums list (see <a href="https://beta.musicbrainz.org/doc/Release_Group/Type">MusicBrainz</a>).
DE Sie können angeben, welche Veröffentlichungstypen (siehe <a href="https://beta.musicbrainz.org/doc/Release_Group/Type">MusicBrainz</a>) in der Albenliste mit aufgeführt werden sollen. Falls für eine Veröffentlichung kein Typ definiert wurde, so wird "Album" angenommen. Diese können nicht ausgeschlossen werden.
EN You can specify what release types you want to include in the albums list (see <a href="https://beta.musicbrainz.org/doc/Release_Group/Type">MusicBrainz</a>). If a release doesn't have a type defined, "Album" is assumed. Albums can't be excluded from that list.

SETUP_IGNORE_RELEASE_TYPES_0
DE Unterstützung für Veröffentlichungstypen von Alben aktivieren
Expand Down

0 comments on commit c681652

Please sign in to comment.