Skip to content
Merged
Changes from all 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
27 changes: 18 additions & 9 deletions Plugin.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1657,19 +1657,19 @@ sub _albumItem {
my $showYearWithAlbum = $prefs->get('showYearWithAlbum');
my $albumYear = $showYearWithAlbum ? $album->{year} || substr($album->{release_date_stream},0,4) || 0 : 0;

if ( $album->{hires_streamable} && $albumName !~ /hi.?res|bits|khz/i && $prefs->get('labelHiResAlbums') && Plugins::Qobuz::API::Common->getStreamingFormat($album) eq 'flac' ) {
$albumName .= ' (' . cstring($client, 'PLUGIN_QOBUZ_HIRES') . ')';
}

my $item = {
image => $album->{image},
image => $album->{image},
hasMetadata => 'album',
album => $album->{title},
artist => $album->{artist}->{name},
genre => $album->{genre},
year => $album->{year} || substr($album->{release_date_stream},0,4) || 0,
};

if ( $album->{hires_streamable} && $albumName !~ /hi.?res|bits|khz/i && $prefs->get('labelHiResAlbums') && Plugins::Qobuz::API::Common->getStreamingFormat($album) eq 'flac' ) {
$item->{version} .= '(' . cstring($client, 'PLUGIN_QOBUZ_HIRES') . ') ';
}

my $sortFavsAlphabetically = $prefs->get('sortFavsAlphabetically') || 0;
if ($sortFavsAlphabetically == 1) {
$item->{name} = $albumName . ($artist ? ' - ' . $artist : '');
Expand All @@ -1685,11 +1685,13 @@ sub _albumItem {
}

if ( $prefs->get('parentalWarning') && $album->{parental_warning} ) {
$item->{version} .= '[E] ';
$item->{name} .= ' [E]';
$item->{line1} .= ' [E]';
}

if (!$album->{streamable} || !_isReleased($album) ) {
$item->{version} .= '* ';
$item->{name} = '* ' . $item->{name};
$item->{line1} = '* ' . $item->{line1};
} else {
Expand Down Expand Up @@ -1753,11 +1755,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 +1773,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->{titleFlags} .= '(' . cstring($client, 'PLUGIN_QOBUZ_HIRES') . ') ';
$item->{name} .= ' (' . cstring($client, 'PLUGIN_QOBUZ_HIRES') . ')';
$item->{line1} .= ' (' . cstring($client, 'PLUGIN_QOBUZ_HIRES') . ')';
}
Expand All @@ -1791,12 +1795,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 +1813,7 @@ sub _trackItem {
}

if ( $prefs->get('parentalWarning') && $track->{parental_warning} ) {
$item->{titleFlags} .= '[E] ';
$item->{name} .= ' [E]';
$item->{line1} .= ' [E]';
}
Expand All @@ -1816,10 +1823,12 @@ sub _trackItem {
name => cstring($client, 'PLUGIN_QOBUZ_NOT_AVAILABLE'),
type => 'textarea'
}];
$item->{titleFlags}= '* ' . $item->{name};
$item->{name} = '* ' . $item->{name};
$item->{line1} = '* ' . $item->{line1};
}
else {
$item->{titleFlags}= '* ' . $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