Address review comments

Co-authored-by: Bond-009 <bond.009@outlook.com>
This commit is contained in:
Joe Rogers 2022-01-16 13:20:15 +01:00
parent 62dc4a79ff
commit f87e780fb5
No known key found for this signature in database
GPG Key ID: 0074AD57B8FDBBB4
2 changed files with 9 additions and 7 deletions

View File

@ -1071,10 +1071,14 @@ namespace MediaBrowser.Providers.Manager
var key = id.Key; var key = id.Key;
// Don't replace existing Id's. // Don't replace existing Id's.
if (replaceData || !target.ProviderIds.ContainsKey(key)) if (replaceData)
{ {
target.ProviderIds[key] = id.Value; target.ProviderIds[key] = id.Value;
} }
else
{
target.ProviderIds.TryAdd(key, id.Value);
}
} }
MergeAlbumArtist(source, target, replaceData); MergeAlbumArtist(source, target, replaceData);
@ -1120,10 +1124,7 @@ namespace MediaBrowser.Providers.Manager
{ {
foreach (var providerId in personInSource.ProviderIds) foreach (var providerId in personInSource.ProviderIds)
{ {
if (!person.ProviderIds.ContainsKey(providerId.Key)) person.ProviderIds.TryAdd(providerId.Key, providerId.Value);
{
person.ProviderIds[providerId.Key] = providerId.Value;
}
} }
if (string.IsNullOrWhiteSpace(person.ImageUrl)) if (string.IsNullOrWhiteSpace(person.ImageUrl))

View File

@ -157,8 +157,9 @@ namespace Jellyfin.Providers.Tests.Manager
{ {
Assert.True(changed); Assert.True(changed);
// before and after paths are the same, verify updated by size reset to 0 // before and after paths are the same, verify updated by size reset to 0
Assert.Equal(imageCount, item.GetImages(imageType).Count()); var typedImages = item.GetImages(imageType).ToArray();
foreach (var image in item.GetImages(imageType)) Assert.Equal(imageCount, typedImages.Length);
foreach (var image in typedImages)
{ {
Assert.Equal(updatedTime, image.DateModified); Assert.Equal(updatedTime, image.DateModified);
Assert.Equal(0, image.Height); Assert.Equal(0, image.Height);