fixes #379 - artist images don't show on web interface

pull/702/head
Luke Pulverenti 12 years ago
parent f064d6c9c7
commit ab70effd5e

@ -56,14 +56,28 @@ namespace MediaBrowser.Providers.Music
if (musicArtist != null)
{
artist.Images = new Dictionary<ImageType, string>(musicArtist.Images);
MergeImages(musicArtist.Images, artist.Images);
// Merge backdrops
var backdrops = musicArtist.BackdropImagePaths.ToList();
backdrops.InsertRange(0, artist.BackdropImagePaths);
artist.BackdropImagePaths = backdrops.Distinct(StringComparer.OrdinalIgnoreCase)
.ToList();
if (!artist.LockedFields.Contains(MetadataFields.Genres))
{
// Merge genres
var genres = musicArtist.Genres.ToList();
genres.InsertRange(0, artist.Genres);
artist.Genres = genres.Distinct(StringComparer.OrdinalIgnoreCase)
.ToList();
artist.BackdropImagePaths = musicArtist.BackdropImagePaths.ToList();
artist.ScreenshotImagePaths = musicArtist.ScreenshotImagePaths.ToList();
artist.SetProviderId(MetadataProviders.Musicbrainz, musicArtist.GetProviderId(MetadataProviders.Musicbrainz));
artist.Genres = musicArtist.Genres.ToList();
}
}
else
{
if (!artist.LockedFields.Contains(MetadataFields.Genres))
{
// Avoid implicitly captured closure
var artist1 = artist;
@ -73,6 +87,7 @@ namespace MediaBrowser.Providers.Music
.Distinct(StringComparer.OrdinalIgnoreCase)
.ToList();
}
}
numComplete++;
double percent = numComplete;
@ -89,6 +104,21 @@ namespace MediaBrowser.Providers.Music
await _libraryManager.ValidateArtists(cancellationToken, innerProgress).ConfigureAwait(false);
}
private void MergeImages(Dictionary<ImageType, string> source, Dictionary<ImageType, string> target)
{
foreach (var key in source.Keys
.ToList()
.Where(k => !target.ContainsKey(k)))
{
string path;
if (source.TryGetValue(key, out path))
{
target[key] = path;
}
}
}
/// <summary>
/// Gets all artists.
/// </summary>

@ -40,7 +40,6 @@ namespace MediaBrowser.Providers.Music
target.Tags = source.Tags.ToList();
target.Overview = source.Overview;
target.ProductionLocations = source.ProductionLocations.ToList();
target.Genres = source.Genres.ToList();
}
public static void ProcessAlbumData(BaseItem item, LastfmAlbum data)

Loading…
Cancel
Save