show genres on artist page

This commit is contained in:
Luke Pulverenti 2013-06-10 21:28:41 -04:00
parent d2933cab73
commit c61ebf2b53

View File

@ -46,6 +46,7 @@ namespace MediaBrowser.Providers.Music
progress.Report(10); progress.Report(10);
var allMusicArtists = allItems.OfType<MusicArtist>().ToList(); var allMusicArtists = allItems.OfType<MusicArtist>().ToList();
var allSongs = allItems.OfType<Audio>().ToList();
var numComplete = 0; var numComplete = 0;
@ -60,6 +61,17 @@ namespace MediaBrowser.Providers.Music
artist.BackdropImagePaths = musicArtist.BackdropImagePaths.ToList(); artist.BackdropImagePaths = musicArtist.BackdropImagePaths.ToList();
artist.ScreenshotImagePaths = musicArtist.ScreenshotImagePaths.ToList(); artist.ScreenshotImagePaths = musicArtist.ScreenshotImagePaths.ToList();
artist.SetProviderId(MetadataProviders.Musicbrainz, musicArtist.GetProviderId(MetadataProviders.Musicbrainz)); artist.SetProviderId(MetadataProviders.Musicbrainz, musicArtist.GetProviderId(MetadataProviders.Musicbrainz));
artist.Genres = musicArtist.Genres.ToList();
}
else
{
// Avoid implicitly captured closure
var artist1 = artist;
artist.Genres = allSongs.Where(i => i.HasArtist(artist1.Name))
.SelectMany(i => i.Genres)
.Distinct(StringComparer.OrdinalIgnoreCase)
.ToList();
} }
numComplete++; numComplete++;