From 53b48cc71d842e5236cefc6c992dc20ed0d8d3bb Mon Sep 17 00:00:00 2001 From: darrell-k Date: Sun, 22 Jun 2025 02:18:28 +0100 Subject: [PATCH 1/4] Only set extra track metadata if param is present Signed-off-by: darrell-k --- Plugin.pm | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/Plugin.pm b/Plugin.pm index 6599992..273bc67 100644 --- a/Plugin.pm +++ b/Plugin.pm @@ -1757,17 +1757,22 @@ sub _trackItem { line1 => $title, line2 => $artist . ($artist && $album ? ' - ' : '') . $album, image => Plugins::Qobuz::API::Common->getImageFromImagesHash($track->{album}->{image}), - hasMetadata => 'track', - album => $track->{album}->{title}, - artist => $track->{performer}->{name}, - secs => $track->{duration}, - duration => Slim::Utils::DateTime::secsToMMSS($track->{duration}), - tracknum => $track->{track_number}, - discnum => $track->{media_number}, - disccount => $track->{album}->{media_count}, - work => $track->{work}, - composer => $track->{composer}->{name}, }; + if ( $tags ) { + my $itemExtras = { + hasMetadata => 'track', + album => $track->{album}->{title}, + artist => $track->{performer}->{name}, + secs => $track->{duration}, + duration => Slim::Utils::DateTime::secsToMMSS($track->{duration}), + tracknum => $track->{track_number}, + discnum => $track->{media_number}, + disccount => $track->{album}->{media_count}, + work => $track->{work}, + composer => $track->{composer}->{name}, + }; + $item = { %$item, %$itemExtras }; + } if ( $track->{hires_streamable} && $item->{name} !~ /hi.?res|bits|khz/i && $prefs->get('labelHiResAlbums') && Plugins::Qobuz::API::Common->getStreamingFormat($track->{album}) eq 'flac' ) { $item->{name} .= ' (' . cstring($client, 'PLUGIN_QOBUZ_HIRES') . ')'; From 784e7938367cca6a24fd373219496ae9d6c165a1 Mon Sep 17 00:00:00 2001 From: darrell-k Date: Mon, 23 Jun 2025 19:02:57 +0100 Subject: [PATCH 2/4] always set title element Signed-off-by: darrell-k --- Plugin.pm | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/Plugin.pm b/Plugin.pm index 273bc67..64076e0 100644 --- a/Plugin.pm +++ b/Plugin.pm @@ -1753,28 +1753,25 @@ 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}, + duration => Slim::Utils::DateTime::secsToMMSS($track->{duration}), + tracknum => $track->{track_number}, + discnum => $track->{media_number}, + disccount => $track->{album}->{media_count}, + work => $track->{work}, + composer => $track->{composer}->{name}, }; - if ( $tags ) { - my $itemExtras = { - hasMetadata => 'track', - album => $track->{album}->{title}, - artist => $track->{performer}->{name}, - secs => $track->{duration}, - duration => Slim::Utils::DateTime::secsToMMSS($track->{duration}), - tracknum => $track->{track_number}, - discnum => $track->{media_number}, - disccount => $track->{album}->{media_count}, - work => $track->{work}, - composer => $track->{composer}->{name}, - }; - $item = { %$item, %$itemExtras }; - } 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') . ')'; } @@ -1796,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}; @@ -1812,6 +1811,7 @@ sub _trackItem { } if ( $prefs->get('parentalWarning') && $track->{parental_warning} ) { + $item->{title} .= ' [E]'; $item->{name} .= ' [E]'; $item->{line1} .= ' [E]'; } @@ -1821,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); From dbda99dc2a767026956ed18d85d946c8ff9f8188 Mon Sep 17 00:00:00 2001 From: darrell-k Date: Tue, 24 Jun 2025 19:13:16 +0100 Subject: [PATCH 3/4] Keep album name and track title clean Signed-off-by: darrell-k --- Plugin.pm | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/Plugin.pm b/Plugin.pm index 64076e0..f14da10 100644 --- a/Plugin.pm +++ b/Plugin.pm @@ -1657,12 +1657,8 @@ 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}, @@ -1670,6 +1666,10 @@ sub _albumItem { 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 : ''); @@ -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 { @@ -1701,6 +1703,7 @@ sub _albumItem { album_id => $album->{id}, album_title => $album->{title}, }]; +$item->{version}= 'darrell album'; return $item; } @@ -1771,7 +1774,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->{titleFlags} .= '(' . cstring($client, 'PLUGIN_QOBUZ_HIRES') . ') '; $item->{name} .= ' (' . cstring($client, 'PLUGIN_QOBUZ_HIRES') . ')'; $item->{line1} .= ' (' . cstring($client, 'PLUGIN_QOBUZ_HIRES') . ')'; } @@ -1811,7 +1814,7 @@ sub _trackItem { } if ( $prefs->get('parentalWarning') && $track->{parental_warning} ) { - $item->{title} .= ' [E]'; + $item->{titleFlags} .= '[E] '; $item->{name} .= ' [E]'; $item->{line1} .= ' [E]'; } @@ -1821,12 +1824,12 @@ sub _trackItem { name => cstring($client, 'PLUGIN_QOBUZ_NOT_AVAILABLE'), type => 'textarea' }]; - $item->{title} = '* ' . $item->{name}; + $item->{titleFlags}= '* ' . $item->{name}; $item->{name} = '* ' . $item->{name}; $item->{line1} = '* ' . $item->{line1}; } else { - $item->{title} = '* ' . $item->{title} if !$track->{streamable}; + $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); @@ -1838,6 +1841,7 @@ sub _trackItem { $item->{tracknum} = $track->{track_number}; $item->{media_number} = $track->{media_number}; $item->{media_count} = $track->{album}->{media_count}; +$item->{titleFlags}= 'darrell track'; return $item; } From 0b4daa044e0dd615c2fbbe701063ec1fe0b8ad4f Mon Sep 17 00:00:00 2001 From: darrell-k Date: Tue, 24 Jun 2025 19:16:42 +0100 Subject: [PATCH 4/4] oops! Signed-off-by: darrell-k --- Plugin.pm | 2 -- 1 file changed, 2 deletions(-) diff --git a/Plugin.pm b/Plugin.pm index f14da10..081881b 100644 --- a/Plugin.pm +++ b/Plugin.pm @@ -1703,7 +1703,6 @@ sub _albumItem { album_id => $album->{id}, album_title => $album->{title}, }]; -$item->{version}= 'darrell album'; return $item; } @@ -1841,7 +1840,6 @@ sub _trackItem { $item->{tracknum} = $track->{track_number}; $item->{media_number} = $track->{media_number}; $item->{media_count} = $track->{album}->{media_count}; -$item->{titleFlags}= 'darrell track'; return $item; }