Skip to content

Commit

Permalink
Add Release Type to the album info menu and album page header
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelherger committed Sep 6, 2024
1 parent 24d0cac commit 159766a
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 2 deletions.
4 changes: 4 additions & 0 deletions HTML/EN/songinfo_header.html
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@
[% item = itemobj.albumlength.name; title = "LENGTH"; PROCESS songInfoItem %]
[% END %]

[% IF itemobj.release_type %]
[% item = itemobj.release_type.name | html; title = "RELEASE_TYPE"; PROCESS songInfoItem %]
[% END %]

[% IF itemobj.album.compilation || itemobj.compilation %]
[% item = "YES" | string; title = "COMPILATION"; PROCESS songInfoItem %]
[% END %]
Expand Down
23 changes: 22 additions & 1 deletion Slim/Menu/AlbumInfo.pm
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,13 @@ sub registerDefaultInfoProviders {
func => \&infoDisc,
) );

$class->registerInfoProvider( compilation => (
$class->registerInfoProvider( releaseType => (
after => 'year',
func => \&infoReleaseType,
) );

$class->registerInfoProvider( compilation => (
after => 'releaseType',
func => \&infoCompilation,
) );

Expand Down Expand Up @@ -452,6 +457,22 @@ sub infoDuration {
return $item;
}

sub infoReleaseType {
my ( $client, $url, $album ) = @_;

my $item;

if ( $album->release_type ) {
$item = {
type => 'text',
label => 'RELEASE_TYPE',
name => $album->releaseType,
};
}

return $item;
}

sub infoCompilation {
my ( $client, $url, $album ) = @_;

Expand Down
5 changes: 5 additions & 0 deletions Slim/Schema/Album.pm
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,11 @@ sub releaseTypeName {
return $name || $releaseType;
}

sub releaseType {
my ($self, $client) = @_;
return $self->releaseTypeName($self->release_type, $client);
}

# Update the title dynamically if we're part of a set.
sub title {
my $self = shift;
Expand Down
2 changes: 1 addition & 1 deletion Slim/Web/XMLBrowser.pm
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ sub handleFeed {
my $i = 0;

my $roles = join ('|', Slim::Schema::Contributor->contributorRoles());
my $allLabels = join ('|', $roles, qw(ALBUM GENRE YEAR ALBUMREPLAYGAIN ALBUMLENGTH COMPILATION WORK));
my $allLabels = join ('|', $roles, qw(ALBUM GENRE YEAR ALBUMREPLAYGAIN ALBUMLENGTH COMPILATION WORK RELEASE_TYPE));

foreach my $item ( @{ $feed->{'albumData'} || $stash->{'items'} } ) {

Expand Down
6 changes: 6 additions & 0 deletions strings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12373,6 +12373,12 @@ ALBUM
SV Album
ZH_CN 专辑

RELEASE_TYPE
DE Veröffentlichungstyp
EN Release type
FR Type de sorties
NL Releasetype

RELEASE_TYPE_SINGLE
EN Single

Expand Down

0 comments on commit 159766a

Please sign in to comment.