Skip to content
Open
Show file tree
Hide file tree
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
20 changes: 8 additions & 12 deletions API/Common.pm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use Exporter::Lite;
our @EXPORT = qw(
QOBUZ_BASE_URL QOBUZ_DEFAULT_EXPIRY QOBUZ_USER_DATA_EXPIRY QOBUZ_EDITORIAL_EXPIRY QOBUZ_DEFAULT_LIMIT QOBUZ_LIMIT QOBUZ_USERDATA_LIMIT
QOBUZ_STREAMING_MP3 QOBUZ_STREAMING_FLAC QOBUZ_STREAMING_FLAC_HIRES QOBUZ_STREAMING_FLAC_HIRES2
_precacheAlbum _precacheTracks precacheTrack
_precacheAlbum _precacheTracks precacheTrack isClassique
);

use Slim::Utils::Cache;
Expand All @@ -31,7 +31,6 @@ use constant QOBUZ_STREAMING_FLAC_HIRES2 => 27;
my $cache;
my $prefs = preferences('plugin.qobuz');
my $log = logger('plugin.qobuz');
my $isClassique;
my %genreList;

initGenreMap();
Expand Down Expand Up @@ -158,14 +157,6 @@ sub _precacheAlbum {
$album->{genre} = $album->{genre}->{name};
$album->{image} = __PACKAGE__->getImageFromImagesHash($album->{image}) || '';

# If the user pref is for classical music enhancements to the display, is this a classical release or has the user added the genre to their custom classical list?
$isClassique = 0;
if ( $prefs->get('useClassicalEnhancements') ) {
if ( ( $album->{genres_list} && grep(/Classique/,@{$album->{genres_list}}) ) || $genreList{$album->{genre}} ) {
$isClassique = 1;
}
}

my $albumInfo = {
title => $album->{title},
id => $album->{id},
Expand All @@ -176,7 +167,6 @@ sub _precacheAlbum {
goodies=> $album->{goodies},
genre => $album->{genre},
genres_list => $album->{genres_list},
isClassique => $isClassique,
parental_warning => $album->{parental_warning},
media_count => $album->{media_count},
duration => 0,
Expand Down Expand Up @@ -267,7 +257,6 @@ sub precacheTrack {
work => $track->{work},
genre => $album->{genre},
genres_list => $album->{genres_list},
isClassique => $isClassique,
parental_warning => $track->{parental_warning},
track_number => $track->{track_number},
media_number => $track->{media_number},
Expand Down Expand Up @@ -419,4 +408,11 @@ sub getPlaylistImage {
return $image;
}

sub isClassique {
my $album = shift;

# Is this a classical release or has the user added the genre to their custom classical list?
return ( $album->{genres_list} && grep(/Classique/,@{$album->{genres_list}}) ) || $genreList{$album->{genre}};
}

1;
2 changes: 1 addition & 1 deletion Importer.pm
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ sub _prepareTrack {
if ( $prefs->get('importWorks') ) {

# if work is blank, try to derive from title
if ( $track->{album}->{isClassique} && $track->{title} && !$track->{work} ) {
if ( isClassique($track->{album}) && $track->{title} && !$track->{work} ) {
# Try to set work to the title, but without composer if it's in there
my @titleSplit = split /:\s*/, $track->{title};
$track->{work} = $track->{title};
Expand Down
2 changes: 1 addition & 1 deletion Plugin.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1768,7 +1768,7 @@ sub _trackItem {
}

# Enhancements to work/composer display for classical music (tags returned from Qobuz are all over the place)
if ( $track->{album}->{isClassique} ) {
if ( isClassique($track->{album}) && $prefs->get('useClassicalEnhancements') ) {
if ( $track->{work} ) {
$item->{work} = $track->{work};
} else {
Expand Down
2 changes: 1 addition & 1 deletion ProtocolHandler.pm
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ sub getMetadataFor {
$meta->{title} = Plugins::Qobuz::API::Common->addVersionToTitle($meta);

# user pref is for enhanced classical music display, and we have a classical release (this is where playlist track titles is set up)
if ( $meta->{isClassique} ) {
if ( isClassique($meta) ) {
# if the title doesn't already contain the work text
if ( $meta->{work} && index($meta->{title},$meta->{work}) == -1 ) {
# remove composer name from track title
Expand Down