|
|
|
@ -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>
|
|
|
|
|