Index: Slim/Schema/Contributor.pm =================================================================== --- Slim/Schema/Contributor.pm (revision 11059) +++ Slim/Schema/Contributor.pm (working copy) @@ -15,6 +15,7 @@ 'BAND' => 4, 'ALBUMARTIST' => 5, 'TRACKARTIST' => 6, + '_SORTARTIST' =>10, # internal contributor role for album sorting ); { Index: Slim/Schema/ResultSet/Album.pm =================================================================== --- Slim/Schema/ResultSet/Album.pm (revision 11059) +++ Slim/Schema/ResultSet/Album.pm (working copy) @@ -95,6 +95,9 @@ if ($sort =~ /contributor/) { push @join, { 'contributorAlbums' => 'contributor' }; + + # experimental sortartist + $cond->{'contributorAlbums.role'} = { 'in' => [ Slim::Schema::Contributor->typeToRole('_SORTARTIST') ] }; } if ($sort =~ /genre/) { Index: Slim/Schema.pm =================================================================== --- Slim/Schema.pm (revision 11059) +++ Slim/Schema.pm (working copy) @@ -1197,6 +1197,16 @@ $albumObj->update; } + # add experimental sort artist contributor - sort on the first artist returned by album->artists + if ($markAsCompilation || (my @artists = $albumObj->artists)) { + + $albumObj->contributorAlbums->find_or_create({ + 'album' => $albumObj->id, + 'contributor' => $markAsCompilation ? $vaObjId : $artists[0]->id, + 'role' => Slim::Schema::Contributor->typeToRole('_SORTARTIST'), + }); + } + $progress->update if $progress; }