From 5f2be93e1900c641a334a28bb73a4aed70ee760b Mon Sep 17 00:00:00 2001 From: JPVenson Date: Thu, 14 Nov 2024 08:48:53 +0000 Subject: [PATCH] Fixed Tests --- .../Item/BaseItemRepository.cs | 3 ++- .../Probing/ProbeResultNormalizerTests.cs | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Jellyfin.Server.Implementations/Item/BaseItemRepository.cs b/Jellyfin.Server.Implementations/Item/BaseItemRepository.cs index 757c3ff374..f1afd35435 100644 --- a/Jellyfin.Server.Implementations/Item/BaseItemRepository.cs +++ b/Jellyfin.Server.Implementations/Item/BaseItemRepository.cs @@ -1300,7 +1300,8 @@ public sealed class BaseItemRepository( } } - var itemValuesToSave = GetItemValuesToSave(item.Item, item.InheritedTags); + // Never save duplicate itemValues as they are now mapped anyway. + var itemValuesToSave = GetItemValuesToSave(item.Item, item.InheritedTags).DistinctBy(e => (GetCleanValue(e.Value), e.MagicNumber)); context.ItemValuesMap.Where(e => e.ItemId == entity.Id).ExecuteDelete(); foreach (var itemValue in itemValuesToSave) { diff --git a/tests/Jellyfin.MediaEncoding.Tests/Probing/ProbeResultNormalizerTests.cs b/tests/Jellyfin.MediaEncoding.Tests/Probing/ProbeResultNormalizerTests.cs index df51d39cb7..61282785f8 100644 --- a/tests/Jellyfin.MediaEncoding.Tests/Probing/ProbeResultNormalizerTests.cs +++ b/tests/Jellyfin.MediaEncoding.Tests/Probing/ProbeResultNormalizerTests.cs @@ -65,7 +65,7 @@ namespace Jellyfin.MediaEncoding.Tests.Probing Assert.True(res.VideoStream.IsDefault); Assert.False(res.VideoStream.IsExternal); Assert.False(res.VideoStream.IsForced); - Assert.False(res.VideoStream.IsHearingImpaired); + Assert.False(res.VideoStream.IsHearingImpaired.GetValueOrDefault()); Assert.False(res.VideoStream.IsInterlaced); Assert.False(res.VideoStream.IsTextSubtitleStream); Assert.Equal(13d, res.VideoStream.Level); @@ -152,19 +152,19 @@ namespace Jellyfin.MediaEncoding.Tests.Probing Assert.Equal(MediaStreamType.Subtitle, res.MediaStreams[3].Type); Assert.Equal("DVDSUB", res.MediaStreams[3].Codec); Assert.Null(res.MediaStreams[3].Title); - Assert.False(res.MediaStreams[3].IsHearingImpaired); + Assert.False(res.MediaStreams[3].IsHearingImpaired.GetValueOrDefault()); Assert.Equal("eng", res.MediaStreams[4].Language); Assert.Equal(MediaStreamType.Subtitle, res.MediaStreams[4].Type); Assert.Equal("mov_text", res.MediaStreams[4].Codec); Assert.Null(res.MediaStreams[4].Title); - Assert.True(res.MediaStreams[4].IsHearingImpaired); + Assert.True(res.MediaStreams[4].IsHearingImpaired.GetValueOrDefault()); Assert.Equal("eng", res.MediaStreams[5].Language); Assert.Equal(MediaStreamType.Subtitle, res.MediaStreams[5].Type); Assert.Equal("mov_text", res.MediaStreams[5].Codec); Assert.Equal("Commentary", res.MediaStreams[5].Title); - Assert.False(res.MediaStreams[5].IsHearingImpaired); + Assert.False(res.MediaStreams[5].IsHearingImpaired.GetValueOrDefault()); } [Fact]