Index: SQL/mysql/schema_1_up.sql =================================================================== --- SQL/mysql/schema_1_up.sql (revision 11088) +++ SQL/mysql/schema_1_up.sql (working copy) @@ -135,6 +135,7 @@ titlesort text, titlesearch text, customsearch text, + contributor int(10) unsigned, compilation bool, year smallint(5) unsigned, artwork int(10) unsigned, -- pointer to a track id that contains artwork Index: Slim/Schema/ResultSet/Album.pm =================================================================== --- Slim/Schema/ResultSet/Album.pm (revision 11088) +++ Slim/Schema/ResultSet/Album.pm (working copy) @@ -94,7 +94,7 @@ if ($sort =~ /contributor/) { - push @join, { 'contributorAlbums' => 'contributor' }; + push @join, 'contributor'; } if ($sort =~ /genre/) { Index: Slim/Schema/Album.pm =================================================================== --- Slim/Schema/Album.pm (revision 11088) +++ Slim/Schema/Album.pm (working copy) @@ -15,6 +15,7 @@ $class->add_columns(qw( id titlesort + contributor compilation year artwork @@ -30,6 +31,8 @@ $class->set_primary_key('id'); $class->add_unique_constraint('titlesearch' => [qw/id titlesearch/]); + $class->belongs_to('contributor' => 'Slim::Schema::Contributor'); + $class->has_many('tracks' => 'Slim::Schema::Track' => 'album'); $class->has_many('contributorAlbums' => 'Slim::Schema::ContributorAlbum' => 'album'); Index: Slim/Schema.pm =================================================================== --- Slim/Schema.pm (revision 11088) +++ Slim/Schema.pm (working copy) @@ -1211,6 +1211,7 @@ $::d_info && $_dump_postprocess_logic && msg("--- Album is a VA\n"); $albumObj->compilation(1); + $albumObj->contributor($vaObjId); $albumObj->update; } @@ -2039,6 +2040,16 @@ # Bug 2393 - was fixed here (now obsolete due to further code rework) $set{'compilation'} = $isCompilation; + # Bug 3255 - add album contributor which is either VA or the primary artist, used for sort by artist + if ($isCompilation && !$contributors->{'ALBUMARTIST'}) { + + $set{'contributor'} = $self->variousArtistsObject->id; + + } elsif (blessed($contributor)) { + + $set{'contributor'} = $contributor->id; + } + $set{'musicbrainz_id'} = $attributes->{'MUSICBRAINZ_ALBUM_ID'}; # Handle album gain tags.