diff options
| author | mysticalsoap <github@esotericsuds.com> | 2026-09-15 16:31:24 -0400 |
|---|---|---|
| committer | mysticalsoap <github@esotericsuds.com> | 2026-10-15 17:35:24 -0400 |
| commit | 2416fb56b4904fcf1fbf561be0c05b37d2d0886f (patch) | |
| tree | 15ce903dc9b8602fa7337f736f7c7989c30457d5 /tests | |
| parent | aec42b345e1a7da25ee5492183f12209338df688 (diff) | |
Ignore container dates that disagree with a known production year
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/Jellyfin.Providers.Tests/MediaInfo/FFProbeVideoInfoTests.cs | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/Jellyfin.Providers.Tests/MediaInfo/FFProbeVideoInfoTests.cs b/tests/Jellyfin.Providers.Tests/MediaInfo/FFProbeVideoInfoTests.cs index 59d3f42edf..dc781af771 100644 --- a/tests/Jellyfin.Providers.Tests/MediaInfo/FFProbeVideoInfoTests.cs +++ b/tests/Jellyfin.Providers.Tests/MediaInfo/FFProbeVideoInfoTests.cs @@ -94,6 +94,52 @@ public class FFProbeVideoInfoTests [Theory] [InlineData(false)] [InlineData(true)] + public void FetchEmbeddedInfo_MismatchedYear_IgnoresContainerDates(bool replaceAllMetadata) + { + var video = new Video + { + ProductionYear = 2007 + }; + + _fFProbeVideoInfo.FetchEmbeddedInfo(video, CreateMediaInfoWithDates(), CreateRefreshOptions(replaceAllMetadata), new LibraryOptions()); + + Assert.Equal(2007, video.ProductionYear); + Assert.Null(video.PremiereDate); + } + + [Theory] + [InlineData(false)] + [InlineData(true)] + public void FetchEmbeddedInfo_MatchingYear_AppliesContainerDates(bool replaceAllMetadata) + { + var video = new Video + { + ProductionYear = 2016 + }; + + _fFProbeVideoInfo.FetchEmbeddedInfo(video, CreateMediaInfoWithDates(), CreateRefreshOptions(replaceAllMetadata), new LibraryOptions()); + + Assert.Equal(2016, video.ProductionYear); + Assert.Equal(new DateTime(2016, 5, 4, 0, 0, 0, DateTimeKind.Utc), video.PremiereDate); + } + + [Fact] + public void FetchEmbeddedInfo_NoContainerDates_DerivesYearFromPremiereDate() + { + var video = new Video + { + PremiereDate = new DateTime(1982, 6, 25, 0, 0, 0, DateTimeKind.Utc) + }; + + _fFProbeVideoInfo.FetchEmbeddedInfo(video, new MediaBrowser.Model.MediaInfo.MediaInfo(), CreateRefreshOptions(false), new LibraryOptions()); + + Assert.Equal(1982, video.ProductionYear); + Assert.Equal(new DateTime(1982, 6, 25, 0, 0, 0, DateTimeKind.Utc), video.PremiereDate); + } + + [Theory] + [InlineData(false)] + [InlineData(true)] public void FetchEmbeddedInfo_Extra_IgnoresContainerDates(bool replaceAllMetadata) { var video = new Video |
