From 924dfe1db0127c5494a874bae21983e59c3338a2 Mon Sep 17 00:00:00 2001 From: MrTimscampi Date: Sat, 7 Aug 2021 22:24:10 +0200 Subject: Add test for year-only parsing for FFProbe --- .../Probing/ProbeResultNormalizerTests.cs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'tests/Jellyfin.MediaEncoding.Tests/Probing/ProbeResultNormalizerTests.cs') diff --git a/tests/Jellyfin.MediaEncoding.Tests/Probing/ProbeResultNormalizerTests.cs b/tests/Jellyfin.MediaEncoding.Tests/Probing/ProbeResultNormalizerTests.cs index d8089eea2..6d6abdb90 100644 --- a/tests/Jellyfin.MediaEncoding.Tests/Probing/ProbeResultNormalizerTests.cs +++ b/tests/Jellyfin.MediaEncoding.Tests/Probing/ProbeResultNormalizerTests.cs @@ -71,5 +71,25 @@ namespace Jellyfin.MediaEncoding.Tests.Probing Assert.True(res.PremiereDate.HasValue); Assert.Equal(DateTime.Parse("2021-01-01T00:00Z", DateTimeFormatInfo.CurrentInfo).ToUniversalTime(), res.PremiereDate); } + + [Fact] + public void GetMediaInfo_Music_Year_Only_Success() + { + var bytes = File.ReadAllBytes("Test Data/Probing/music_year_only_metadata.json"); + var internalMediaInfoResult = JsonSerializer.Deserialize(bytes, _jsonOptions); + MediaInfo res = _probeResultNormalizer.GetMediaInfo(internalMediaInfoResult, null, true, "Test Data/Probing/music.flac", MediaProtocol.File); + + Assert.Equal("Baker Street", res.Name); + Assert.Single(res.Artists); + Assert.Equal("Gerry Rafferty", res.Artists[0]); + Assert.Equal("City to City", res.Album); + Assert.Equal(1978, res.ProductionYear); + Assert.True(res.PremiereDate.HasValue); + Assert.Equal(DateTime.Parse("1978-01-01T00:00Z", DateTimeFormatInfo.CurrentInfo).ToUniversalTime(), res.PremiereDate); + Assert.Contains("Electronic", res.Genres); + Assert.Contains("Ambient", res.Genres); + Assert.Contains("Pop", res.Genres); + Assert.Contains("Jazz", res.Genres); + } } } -- cgit v1.2.3 From 8d5b87025b9e34eaa3d67c97d4a8a380b52c6830 Mon Sep 17 00:00:00 2001 From: Julien Machiels Date: Wed, 11 Aug 2021 09:42:40 +0200 Subject: Update tests/Jellyfin.MediaEncoding.Tests/Probing/ProbeResultNormalizerTests.cs Co-authored-by: Claus Vium --- .../Jellyfin.MediaEncoding.Tests/Probing/ProbeResultNormalizerTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/Jellyfin.MediaEncoding.Tests/Probing/ProbeResultNormalizerTests.cs') diff --git a/tests/Jellyfin.MediaEncoding.Tests/Probing/ProbeResultNormalizerTests.cs b/tests/Jellyfin.MediaEncoding.Tests/Probing/ProbeResultNormalizerTests.cs index 6d6abdb90..59037c263 100644 --- a/tests/Jellyfin.MediaEncoding.Tests/Probing/ProbeResultNormalizerTests.cs +++ b/tests/Jellyfin.MediaEncoding.Tests/Probing/ProbeResultNormalizerTests.cs @@ -73,7 +73,7 @@ namespace Jellyfin.MediaEncoding.Tests.Probing } [Fact] - public void GetMediaInfo_Music_Year_Only_Success() + public void GetMediaInfo_GivenOriginalDateContainsOnlyYear_Success() { var bytes = File.ReadAllBytes("Test Data/Probing/music_year_only_metadata.json"); var internalMediaInfoResult = JsonSerializer.Deserialize(bytes, _jsonOptions); -- cgit v1.2.3