aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Jellyfin.Naming.Tests/TV/SeasonPathParserTests.cs68
-rw-r--r--tests/Jellyfin.Providers.Tests/MediaInfo/MediaInfoResolverTests.cs52
-rw-r--r--tests/Jellyfin.Server.Implementations.Tests/Localization/LocalizationManagerTests.cs5
-rw-r--r--tests/Jellyfin.XbmcMetadata.Tests/Parsers/EpisodeNfoProviderTests.cs2
-rw-r--r--tests/Jellyfin.XbmcMetadata.Tests/Parsers/MovieNfoParserTests.cs2
-rw-r--r--tests/Jellyfin.XbmcMetadata.Tests/Parsers/MusicAlbumNfoProviderTests.cs2
-rw-r--r--tests/Jellyfin.XbmcMetadata.Tests/Parsers/MusicArtistNfoParserTests.cs2
7 files changed, 74 insertions, 59 deletions
diff --git a/tests/Jellyfin.Naming.Tests/TV/SeasonPathParserTests.cs b/tests/Jellyfin.Naming.Tests/TV/SeasonPathParserTests.cs
index 3a042df68..4c8ba58d0 100644
--- a/tests/Jellyfin.Naming.Tests/TV/SeasonPathParserTests.cs
+++ b/tests/Jellyfin.Naming.Tests/TV/SeasonPathParserTests.cs
@@ -6,32 +6,54 @@ namespace Jellyfin.Naming.Tests.TV;
public class SeasonPathParserTests
{
[Theory]
- [InlineData("/Drive/Season 1", 1, true)]
- [InlineData("/Drive/s1", 1, true)]
- [InlineData("/Drive/S1", 1, true)]
- [InlineData("/Drive/Season 2", 2, true)]
- [InlineData("/Drive/Season 02", 2, true)]
- [InlineData("/Drive/Seinfeld/S02", 2, true)]
- [InlineData("/Drive/Seinfeld/2", 2, true)]
- [InlineData("/Drive/Seinfeld - S02", 2, true)]
- [InlineData("/Drive/Season 2009", 2009, true)]
- [InlineData("/Drive/Season1", 1, true)]
- [InlineData("The Wonder Years/The.Wonder.Years.S04.PDTV.x264-JCH", 4, true)]
- [InlineData("/Drive/Season 7 (2016)", 7, false)]
- [InlineData("/Drive/Staffel 7 (2016)", 7, false)]
- [InlineData("/Drive/Stagione 7 (2016)", 7, false)]
- [InlineData("/Drive/Season (8)", null, false)]
- [InlineData("/Drive/3.Staffel", 3, false)]
- [InlineData("/Drive/s06e05", null, false)]
- [InlineData("/Drive/The.Legend.of.Condor.Heroes.2017.V2.web-dl.1080p.h264.aac-hdctv", null, false)]
- [InlineData("/Drive/extras", 0, true)]
- [InlineData("/Drive/specials", 0, true)]
- public void GetSeasonNumberFromPathTest(string path, int? seasonNumber, bool isSeasonDirectory)
+ [InlineData("/Drive/Season 1", "/Drive", 1, true)]
+ [InlineData("/Drive/Staffel 1", "/Drive", 1, true)]
+ [InlineData("/Drive/Stagione 1", "/Drive", 1, true)]
+ [InlineData("/Drive/sæson 1", "/Drive", 1, true)]
+ [InlineData("/Drive/Temporada 1", "/Drive", 1, true)]
+ [InlineData("/Drive/series 1", "/Drive", 1, true)]
+ [InlineData("/Drive/Kausi 1", "/Drive", 1, true)]
+ [InlineData("/Drive/Säsong 1", "/Drive", 1, true)]
+ [InlineData("/Drive/Seizoen 1", "/Drive", 1, true)]
+ [InlineData("/Drive/Seasong 1", "/Drive", 1, true)]
+ [InlineData("/Drive/Sezon 1", "/Drive", 1, true)]
+ [InlineData("/Drive/sezona 1", "/Drive", 1, true)]
+ [InlineData("/Drive/sezóna 1", "/Drive", 1, true)]
+ [InlineData("/Drive/Sezonul 1", "/Drive", 1, true)]
+ [InlineData("/Drive/시즌 1", "/Drive", 1, true)]
+ [InlineData("/Drive/シーズン 1", "/Drive", 1, true)]
+ [InlineData("/Drive/сезон 1", "/Drive", 1, true)]
+ [InlineData("/Drive/Сезон 1", "/Drive", 1, true)]
+ [InlineData("/Drive/Season 10", "/Drive", 10, true)]
+ [InlineData("/Drive/Season 100", "/Drive", 100, true)]
+ [InlineData("/Drive/s1", "/Drive", 1, true)]
+ [InlineData("/Drive/S1", "/Drive", 1, true)]
+ [InlineData("/Drive/Season 2", "/Drive", 2, true)]
+ [InlineData("/Drive/Season 02", "/Drive", 2, true)]
+ [InlineData("/Drive/Seinfeld/S02", "/Seinfeld", 2, true)]
+ [InlineData("/Drive/Seinfeld/2", "/Seinfeld", 2, true)]
+ [InlineData("/Drive/Seinfeld Season 2", "/Drive", null, false)]
+ [InlineData("/Drive/Season 2009", "/Drive", 2009, true)]
+ [InlineData("/Drive/Season1", "/Drive", 1, true)]
+ [InlineData("The Wonder Years/The.Wonder.Years.S04.PDTV.x264-JCH", "/The Wonder Years", 4, true)]
+ [InlineData("/Drive/Season 7 (2016)", "/Drive", 7, true)]
+ [InlineData("/Drive/Staffel 7 (2016)", "/Drive", 7, true)]
+ [InlineData("/Drive/Stagione 7 (2016)", "/Drive", 7, true)]
+ [InlineData("/Drive/Stargate SG-1/Season 1", "/Drive/Stargate SG-1", 1, true)]
+ [InlineData("/Drive/Stargate SG-1/Stargate SG-1 Season 1", "/Drive/Stargate SG-1", 1, true)]
+ [InlineData("/Drive/Season (8)", "/Drive", null, false)]
+ [InlineData("/Drive/3.Staffel", "/Drive", 3, true)]
+ [InlineData("/Drive/s06e05", "/Drive", null, false)]
+ [InlineData("/Drive/The.Legend.of.Condor.Heroes.2017.V2.web-dl.1080p.h264.aac-hdctv", "/Drive", null, false)]
+ [InlineData("/Drive/extras", "/Drive", 0, true)]
+ [InlineData("/Drive/specials", "/Drive", 0, true)]
+ [InlineData("/Drive/Episode 1 Season 2", "/Drive", null, false)]
+ public void GetSeasonNumberFromPathTest(string path, string? parentPath, int? seasonNumber, bool isSeasonDirectory)
{
- var result = SeasonPathParser.Parse(path, true, true);
+ var result = SeasonPathParser.Parse(path, parentPath, true, true);
Assert.Equal(result.SeasonNumber is not null, result.Success);
- Assert.Equal(result.SeasonNumber, seasonNumber);
+ Assert.Equal(seasonNumber, result.SeasonNumber);
Assert.Equal(isSeasonDirectory, result.IsSeasonFolder);
}
}
diff --git a/tests/Jellyfin.Providers.Tests/MediaInfo/MediaInfoResolverTests.cs b/tests/Jellyfin.Providers.Tests/MediaInfo/MediaInfoResolverTests.cs
index db427308c..222e624aa 100644
--- a/tests/Jellyfin.Providers.Tests/MediaInfo/MediaInfoResolverTests.cs
+++ b/tests/Jellyfin.Providers.Tests/MediaInfo/MediaInfoResolverTests.cs
@@ -217,68 +217,58 @@ public class MediaInfoResolverTests
string file = "My.Video.srt";
data.Add(
file,
- new[]
- {
+ [
CreateMediaStream(VideoDirectoryPath + "/" + file, null, null, 0)
- },
- new[]
- {
+ ],
+ [
CreateMediaStream(VideoDirectoryPath + "/" + file, null, null, 0)
- });
+ ]);
// filename has metadata
file = "My.Video.Title1.default.forced.sdh.en.srt";
data.Add(
file,
- new[]
- {
+ [
CreateMediaStream(VideoDirectoryPath + "/" + file, null, null, 0)
- },
- new[]
- {
+ ],
+ [
CreateMediaStream(VideoDirectoryPath + "/" + file, "eng", "Title1", 0, true, true, true)
- });
+ ]);
// single stream with metadata
file = "My.Video.mks";
data.Add(
file,
- new[]
- {
+ [
CreateMediaStream(VideoDirectoryPath + "/" + file, "eng", "Title", 0, true, true, true)
- },
- new[]
- {
- CreateMediaStream(VideoDirectoryPath + "/" + file, "eng", "Title", 0, true, true, true)
- });
+ ],
+ [
+ CreateMediaStream(VideoDirectoryPath + "/" + file, "eng", "Title", 0, true, false, true)
+ ]);
// stream wins for title/language, filename wins for flags when conflicting
file = "My.Video.Title2.default.forced.sdh.en.srt";
data.Add(
file,
- new[]
- {
+ [
CreateMediaStream(VideoDirectoryPath + "/" + file, "fra", "Metadata", 0)
- },
- new[]
- {
+ ],
+ [
CreateMediaStream(VideoDirectoryPath + "/" + file, "fra", "Metadata", 0, true, true, true)
- });
+ ]);
// multiple stream with metadata - filename flags ignored but other data filled in when missing from stream
file = "My.Video.Title3.default.forced.en.srt";
data.Add(
file,
- new[]
- {
+ [
CreateMediaStream(VideoDirectoryPath + "/" + file, null, null, 0, true, true),
CreateMediaStream(VideoDirectoryPath + "/" + file, "fra", "Metadata", 1)
- },
- new[]
- {
+ ],
+ [
CreateMediaStream(VideoDirectoryPath + "/" + file, "eng", "Title3", 0, true, true),
CreateMediaStream(VideoDirectoryPath + "/" + file, "fra", "Metadata", 1)
- });
+ ]);
return data;
}
diff --git a/tests/Jellyfin.Server.Implementations.Tests/Localization/LocalizationManagerTests.cs b/tests/Jellyfin.Server.Implementations.Tests/Localization/LocalizationManagerTests.cs
index 65f018ee3..cc67dbc39 100644
--- a/tests/Jellyfin.Server.Implementations.Tests/Localization/LocalizationManagerTests.cs
+++ b/tests/Jellyfin.Server.Implementations.Tests/Localization/LocalizationManagerTests.cs
@@ -1,6 +1,5 @@
using System;
using System.Linq;
-using System.Runtime.InteropServices;
using System.Threading.Tasks;
using Emby.Server.Implementations.Localization;
using MediaBrowser.Controller.Configuration;
@@ -116,6 +115,10 @@ namespace Jellyfin.Server.Implementations.Tests.Localization
[InlineData("TV-MA", "US", 17)]
[InlineData("XXX", "asdf", 1000)]
[InlineData("Germany: FSK-18", "DE", 18)]
+ [InlineData("Rated : R", "US", 17)]
+ [InlineData("Rated: R", "US", 17)]
+ [InlineData("Rated R", "US", 17)]
+ [InlineData(" PG-13 ", "US", 13)]
public async Task GetRatingLevel_GivenValidString_Success(string value, string countryCode, int expectedLevel)
{
var localizationManager = Setup(new ServerConfiguration()
diff --git a/tests/Jellyfin.XbmcMetadata.Tests/Parsers/EpisodeNfoProviderTests.cs b/tests/Jellyfin.XbmcMetadata.Tests/Parsers/EpisodeNfoProviderTests.cs
index f9126ce9b..a04b37f21 100644
--- a/tests/Jellyfin.XbmcMetadata.Tests/Parsers/EpisodeNfoProviderTests.cs
+++ b/tests/Jellyfin.XbmcMetadata.Tests/Parsers/EpisodeNfoProviderTests.cs
@@ -26,7 +26,7 @@ namespace Jellyfin.XbmcMetadata.Tests.Parsers
var providerManager = new Mock<IProviderManager>();
var imdbExternalId = new ImdbExternalId();
- var externalIdInfo = new ExternalIdInfo(imdbExternalId.ProviderName, imdbExternalId.Key, imdbExternalId.Type, imdbExternalId.UrlFormatString);
+ var externalIdInfo = new ExternalIdInfo(imdbExternalId.ProviderName, imdbExternalId.Key, imdbExternalId.Type);
providerManager.Setup(x => x.GetExternalIdInfos(It.IsAny<IHasProviderIds>()))
.Returns(new[] { externalIdInfo });
diff --git a/tests/Jellyfin.XbmcMetadata.Tests/Parsers/MovieNfoParserTests.cs b/tests/Jellyfin.XbmcMetadata.Tests/Parsers/MovieNfoParserTests.cs
index 9c2655154..a71a08d8c 100644
--- a/tests/Jellyfin.XbmcMetadata.Tests/Parsers/MovieNfoParserTests.cs
+++ b/tests/Jellyfin.XbmcMetadata.Tests/Parsers/MovieNfoParserTests.cs
@@ -34,7 +34,7 @@ namespace Jellyfin.XbmcMetadata.Tests.Parsers
var providerManager = new Mock<IProviderManager>();
var tmdbExternalId = new TmdbMovieExternalId();
- var externalIdInfo = new ExternalIdInfo(tmdbExternalId.ProviderName, tmdbExternalId.Key, tmdbExternalId.Type, tmdbExternalId.UrlFormatString);
+ var externalIdInfo = new ExternalIdInfo(tmdbExternalId.ProviderName, tmdbExternalId.Key, tmdbExternalId.Type);
providerManager.Setup(x => x.GetExternalIdInfos(It.IsAny<IHasProviderIds>()))
.Returns(new[] { externalIdInfo });
diff --git a/tests/Jellyfin.XbmcMetadata.Tests/Parsers/MusicAlbumNfoProviderTests.cs b/tests/Jellyfin.XbmcMetadata.Tests/Parsers/MusicAlbumNfoProviderTests.cs
index f815dfaa9..24e9b9fee 100644
--- a/tests/Jellyfin.XbmcMetadata.Tests/Parsers/MusicAlbumNfoProviderTests.cs
+++ b/tests/Jellyfin.XbmcMetadata.Tests/Parsers/MusicAlbumNfoProviderTests.cs
@@ -24,7 +24,7 @@ namespace Jellyfin.XbmcMetadata.Tests.Parsers
var providerManager = new Mock<IProviderManager>();
var musicBrainzArtist = new MusicBrainzArtistExternalId();
- var externalIdInfo = new ExternalIdInfo(musicBrainzArtist.ProviderName, musicBrainzArtist.Key, musicBrainzArtist.Type, "MusicBrainzServer");
+ var externalIdInfo = new ExternalIdInfo(musicBrainzArtist.ProviderName, musicBrainzArtist.Key, musicBrainzArtist.Type);
providerManager.Setup(x => x.GetExternalIdInfos(It.IsAny<IHasProviderIds>()))
.Returns(new[] { externalIdInfo });
diff --git a/tests/Jellyfin.XbmcMetadata.Tests/Parsers/MusicArtistNfoParserTests.cs b/tests/Jellyfin.XbmcMetadata.Tests/Parsers/MusicArtistNfoParserTests.cs
index 78183d9ff..4d1956bde 100644
--- a/tests/Jellyfin.XbmcMetadata.Tests/Parsers/MusicArtistNfoParserTests.cs
+++ b/tests/Jellyfin.XbmcMetadata.Tests/Parsers/MusicArtistNfoParserTests.cs
@@ -24,7 +24,7 @@ namespace Jellyfin.XbmcMetadata.Tests.Parsers
var providerManager = new Mock<IProviderManager>();
var musicBrainzArtist = new MusicBrainzArtistExternalId();
- var externalIdInfo = new ExternalIdInfo(musicBrainzArtist.ProviderName, musicBrainzArtist.Key, musicBrainzArtist.Type, "MusicBrainzServer");
+ var externalIdInfo = new ExternalIdInfo(musicBrainzArtist.ProviderName, musicBrainzArtist.Key, musicBrainzArtist.Type);
providerManager.Setup(x => x.GetExternalIdInfos(It.IsAny<IHasProviderIds>()))
.Returns(new[] { externalIdInfo });