Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions Plugin.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1753,11 +1753,12 @@ sub _trackItem {
my $genre = $track->{album}->{genre};

my $item = {
name => $tags ? $title : sprintf('%s %s %s %s %s', $title, cstring($client, 'BY'), $artist, cstring($client, 'FROM'), $album),
line1 => $title,
line2 => $artist . ($artist && $album ? ' - ' : '') . $album,
image => Plugins::Qobuz::API::Common->getImageFromImagesHash($track->{album}->{image}),
name => sprintf('%s %s %s %s %s', $title, cstring($client, 'BY'), $artist, cstring($client, 'FROM'), $album),
line1 => $title,
line2 => $artist . ($artist && $album ? ' - ' : '') . $album,
image => Plugins::Qobuz::API::Common->getImageFromImagesHash($track->{album}->{image}),
hasMetadata => 'track',
title => $track->{title},
album => $track->{album}->{title},
artist => $track->{performer}->{name},
secs => $track->{duration},
Expand All @@ -1770,6 +1771,7 @@ sub _trackItem {
};

if ( $track->{hires_streamable} && $item->{name} !~ /hi.?res|bits|khz/i && $prefs->get('labelHiResAlbums') && Plugins::Qobuz::API::Common->getStreamingFormat($track->{album}) eq 'flac' ) {
$item->{title} .= ' (' . cstring($client, 'PLUGIN_QOBUZ_HIRES') . ')';
$item->{name} .= ' (' . cstring($client, 'PLUGIN_QOBUZ_HIRES') . ')';
$item->{line1} .= ' (' . cstring($client, 'PLUGIN_QOBUZ_HIRES') . ')';
}
Expand All @@ -1791,12 +1793,14 @@ sub _trackItem {
my @titleSplit = split /:\s*/, $track->{title};
my $tempTitle = @titleSplit[-1];
$item->{work} =~ s/:\s*\Q$tempTitle\E//;
$item->{title} =~ s/\Q$item->{work}\E://;
$item->{line1} =~ s/\Q$item->{work}\E://;
}
$item->{displayWork} = $item->{work};
if ( $track->{composer}->{name} ) {
$item->{displayWork} = $track->{composer}->{name} . string('COLON') . ' ' . $item->{work};
my $composerSurname = (split ' ', $track->{composer}->{name})[-1];
$item->{title} =~ s/\Q$composerSurname\E://;
$item->{line1} =~ s/\Q$composerSurname\E://;
}
$item->{line2} .= " - " . $item->{work} if $item->{work};
Expand All @@ -1807,6 +1811,7 @@ sub _trackItem {
}

if ( $prefs->get('parentalWarning') && $track->{parental_warning} ) {
$item->{title} .= ' [E]';
Copy link
Member

@michaelherger michaelherger Jun 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's really try to leave the title alone. This should be the title and nothing else, as it might be used to look up additional metadata etc. Let's see whether anyone would miss that additional piece of information. The same applies to the asterisk for the samples.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "explicit" indicator was a user-requested enhancement (there's also the * added for not-yet streamable tracks). Same argument as above applies: if it goes into line1 it needs to be in title.

But in this case, we could set a different element with these indicators, with corresponding client changes to append to the displayed title.

The [E] and * indicators may also be added to the album name. I think the solution at the album level would be to include in a version element (again with the necessary client changes). This is related to LMS-Community/slimserver#1398 which I need to finalise (although changing this for the plugin would not be dependent on that PR).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be in support of an extra element for such additions. As you might know I'm often struggling trying to match names and titles to whatever a web site might be using. And all these additions complicate things considerably.

$item->{name} .= ' [E]';
$item->{line1} .= ' [E]';
}
Expand All @@ -1816,10 +1821,12 @@ sub _trackItem {
name => cstring($client, 'PLUGIN_QOBUZ_NOT_AVAILABLE'),
type => 'textarea'
}];
$item->{title} = '* ' . $item->{name};
$item->{name} = '* ' . $item->{name};
$item->{line1} = '* ' . $item->{line1};
}
else {
$item->{title} = '* ' . $item->{title} if !$track->{streamable};
$item->{name} = '* ' . $item->{name} if !$track->{streamable};
$item->{line1} = '* ' . $item->{line1} if !$track->{streamable};
$item->{play} = Plugins::Qobuz::API::Common->getUrl($client, $track);
Expand Down