|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using Emby.Naming.Common;
|
|
|
|
|
using Emby.Naming.Video;
|
|
|
|
|
using MediaBrowser.Model.Entities;
|
|
|
|
@ -14,165 +15,135 @@ namespace Jellyfin.Naming.Tests.Video
|
|
|
|
|
{
|
|
|
|
|
yield return new object[]
|
|
|
|
|
{
|
|
|
|
|
new VideoFileInfo()
|
|
|
|
|
{
|
|
|
|
|
Path = @"/server/Movies/7 Psychos.mkv/7 Psychos.mkv",
|
|
|
|
|
Container = "mkv",
|
|
|
|
|
Name = "7 Psychos"
|
|
|
|
|
}
|
|
|
|
|
new VideoFileInfo(
|
|
|
|
|
path: @"/server/Movies/7 Psychos.mkv/7 Psychos.mkv",
|
|
|
|
|
container: "mkv",
|
|
|
|
|
name: "7 Psychos")
|
|
|
|
|
};
|
|
|
|
|
yield return new object[]
|
|
|
|
|
{
|
|
|
|
|
new VideoFileInfo()
|
|
|
|
|
{
|
|
|
|
|
Path = @"/server/Movies/3 days to kill (2005)/3 days to kill (2005).mkv",
|
|
|
|
|
Container = "mkv",
|
|
|
|
|
Name = "3 days to kill",
|
|
|
|
|
Year = 2005
|
|
|
|
|
}
|
|
|
|
|
new VideoFileInfo(
|
|
|
|
|
path: @"/server/Movies/3 days to kill (2005)/3 days to kill (2005).mkv",
|
|
|
|
|
container: "mkv",
|
|
|
|
|
name: "3 days to kill",
|
|
|
|
|
year: 2005)
|
|
|
|
|
};
|
|
|
|
|
yield return new object[]
|
|
|
|
|
{
|
|
|
|
|
new VideoFileInfo()
|
|
|
|
|
{
|
|
|
|
|
Path = @"/server/Movies/American Psycho/American.Psycho.mkv",
|
|
|
|
|
Container = "mkv",
|
|
|
|
|
Name = "American.Psycho",
|
|
|
|
|
}
|
|
|
|
|
new VideoFileInfo(
|
|
|
|
|
path: @"/server/Movies/American Psycho/American.Psycho.mkv",
|
|
|
|
|
container: "mkv",
|
|
|
|
|
name: "American.Psycho")
|
|
|
|
|
};
|
|
|
|
|
yield return new object[]
|
|
|
|
|
{
|
|
|
|
|
new VideoFileInfo()
|
|
|
|
|
{
|
|
|
|
|
Path = @"/server/Movies/brave (2007)/brave (2006).3d.sbs.mkv",
|
|
|
|
|
Container = "mkv",
|
|
|
|
|
Name = "brave",
|
|
|
|
|
Year = 2006,
|
|
|
|
|
Is3D = true,
|
|
|
|
|
Format3D = "sbs",
|
|
|
|
|
}
|
|
|
|
|
new VideoFileInfo(
|
|
|
|
|
path: @"/server/Movies/brave (2007)/brave (2006).3d.sbs.mkv",
|
|
|
|
|
container: "mkv",
|
|
|
|
|
name: "brave",
|
|
|
|
|
year: 2006,
|
|
|
|
|
is3D: true,
|
|
|
|
|
format3D: "sbs")
|
|
|
|
|
};
|
|
|
|
|
yield return new object[]
|
|
|
|
|
{
|
|
|
|
|
new VideoFileInfo()
|
|
|
|
|
{
|
|
|
|
|
Path = @"/server/Movies/300 (2007)/300 (2006).3d1.sbas.mkv",
|
|
|
|
|
Container = "mkv",
|
|
|
|
|
Name = "300",
|
|
|
|
|
Year = 2006
|
|
|
|
|
}
|
|
|
|
|
new VideoFileInfo(
|
|
|
|
|
path: @"/server/Movies/300 (2007)/300 (2006).3d1.sbas.mkv",
|
|
|
|
|
container: "mkv",
|
|
|
|
|
name: "300",
|
|
|
|
|
year: 2006)
|
|
|
|
|
};
|
|
|
|
|
yield return new object[]
|
|
|
|
|
{
|
|
|
|
|
new VideoFileInfo()
|
|
|
|
|
{
|
|
|
|
|
Path = @"/server/Movies/300 (2007)/300 (2006).3d.sbs.mkv",
|
|
|
|
|
Container = "mkv",
|
|
|
|
|
Name = "300",
|
|
|
|
|
Year = 2006,
|
|
|
|
|
Is3D = true,
|
|
|
|
|
Format3D = "sbs",
|
|
|
|
|
}
|
|
|
|
|
new VideoFileInfo(
|
|
|
|
|
path: @"/server/Movies/300 (2007)/300 (2006).3d.sbs.mkv",
|
|
|
|
|
container: "mkv",
|
|
|
|
|
name: "300",
|
|
|
|
|
year: 2006,
|
|
|
|
|
is3D: true,
|
|
|
|
|
format3D: "sbs")
|
|
|
|
|
};
|
|
|
|
|
yield return new object[]
|
|
|
|
|
{
|
|
|
|
|
new VideoFileInfo()
|
|
|
|
|
{
|
|
|
|
|
Path = @"/server/Movies/brave (2007)/brave (2006)-trailer.bluray.disc",
|
|
|
|
|
Container = "disc",
|
|
|
|
|
Name = "brave",
|
|
|
|
|
Year = 2006,
|
|
|
|
|
IsStub = true,
|
|
|
|
|
StubType = "bluray",
|
|
|
|
|
}
|
|
|
|
|
new VideoFileInfo(
|
|
|
|
|
path: @"/server/Movies/brave (2007)/brave (2006)-trailer.bluray.disc",
|
|
|
|
|
container: "disc",
|
|
|
|
|
name: "brave",
|
|
|
|
|
year: 2006,
|
|
|
|
|
isStub: true,
|
|
|
|
|
stubType: "bluray")
|
|
|
|
|
};
|
|
|
|
|
yield return new object[]
|
|
|
|
|
{
|
|
|
|
|
new VideoFileInfo()
|
|
|
|
|
{
|
|
|
|
|
Path = @"/server/Movies/300 (2007)/300 (2006)-trailer.bluray.disc",
|
|
|
|
|
Container = "disc",
|
|
|
|
|
Name = "300",
|
|
|
|
|
Year = 2006,
|
|
|
|
|
IsStub = true,
|
|
|
|
|
StubType = "bluray",
|
|
|
|
|
}
|
|
|
|
|
new VideoFileInfo(
|
|
|
|
|
path: @"/server/Movies/300 (2007)/300 (2006)-trailer.bluray.disc",
|
|
|
|
|
container: "disc",
|
|
|
|
|
name: "300",
|
|
|
|
|
year: 2006,
|
|
|
|
|
isStub: true,
|
|
|
|
|
stubType: "bluray")
|
|
|
|
|
};
|
|
|
|
|
yield return new object[]
|
|
|
|
|
{
|
|
|
|
|
new VideoFileInfo()
|
|
|
|
|
{
|
|
|
|
|
Path = @"/server/Movies/Brave (2007)/Brave (2006).bluray.disc",
|
|
|
|
|
Container = "disc",
|
|
|
|
|
Name = "Brave",
|
|
|
|
|
Year = 2006,
|
|
|
|
|
IsStub = true,
|
|
|
|
|
StubType = "bluray",
|
|
|
|
|
}
|
|
|
|
|
new VideoFileInfo(
|
|
|
|
|
path: @"/server/Movies/Brave (2007)/Brave (2006).bluray.disc",
|
|
|
|
|
container: "disc",
|
|
|
|
|
name: "Brave",
|
|
|
|
|
year: 2006,
|
|
|
|
|
isStub: true,
|
|
|
|
|
stubType: "bluray")
|
|
|
|
|
};
|
|
|
|
|
yield return new object[]
|
|
|
|
|
{
|
|
|
|
|
new VideoFileInfo()
|
|
|
|
|
{
|
|
|
|
|
Path = @"/server/Movies/300 (2007)/300 (2006).bluray.disc",
|
|
|
|
|
Container = "disc",
|
|
|
|
|
Name = "300",
|
|
|
|
|
Year = 2006,
|
|
|
|
|
IsStub = true,
|
|
|
|
|
StubType = "bluray",
|
|
|
|
|
}
|
|
|
|
|
new VideoFileInfo(
|
|
|
|
|
path: @"/server/Movies/300 (2007)/300 (2006).bluray.disc",
|
|
|
|
|
container: "disc",
|
|
|
|
|
name: "300",
|
|
|
|
|
year: 2006,
|
|
|
|
|
isStub: true,
|
|
|
|
|
stubType: "bluray")
|
|
|
|
|
};
|
|
|
|
|
yield return new object[]
|
|
|
|
|
{
|
|
|
|
|
new VideoFileInfo()
|
|
|
|
|
{
|
|
|
|
|
Path = @"/server/Movies/300 (2007)/300 (2006)-trailer.mkv",
|
|
|
|
|
Container = "mkv",
|
|
|
|
|
Name = "300",
|
|
|
|
|
Year = 2006,
|
|
|
|
|
ExtraType = ExtraType.Trailer,
|
|
|
|
|
}
|
|
|
|
|
new VideoFileInfo(
|
|
|
|
|
path: @"/server/Movies/300 (2007)/300 (2006)-trailer.mkv",
|
|
|
|
|
container: "mkv",
|
|
|
|
|
name: "300",
|
|
|
|
|
year: 2006,
|
|
|
|
|
extraType: ExtraType.Trailer)
|
|
|
|
|
};
|
|
|
|
|
yield return new object[]
|
|
|
|
|
{
|
|
|
|
|
new VideoFileInfo()
|
|
|
|
|
{
|
|
|
|
|
Path = @"/server/Movies/Brave (2007)/Brave (2006)-trailer.mkv",
|
|
|
|
|
Container = "mkv",
|
|
|
|
|
Name = "Brave",
|
|
|
|
|
Year = 2006,
|
|
|
|
|
ExtraType = ExtraType.Trailer,
|
|
|
|
|
}
|
|
|
|
|
new VideoFileInfo(
|
|
|
|
|
path: @"/server/Movies/Brave (2007)/Brave (2006)-trailer.mkv",
|
|
|
|
|
container: "mkv",
|
|
|
|
|
name: "Brave",
|
|
|
|
|
year: 2006,
|
|
|
|
|
extraType: ExtraType.Trailer)
|
|
|
|
|
};
|
|
|
|
|
yield return new object[]
|
|
|
|
|
{
|
|
|
|
|
new VideoFileInfo()
|
|
|
|
|
{
|
|
|
|
|
Path = @"/server/Movies/300 (2007)/300 (2006).mkv",
|
|
|
|
|
Container = "mkv",
|
|
|
|
|
Name = "300",
|
|
|
|
|
Year = 2006
|
|
|
|
|
}
|
|
|
|
|
new VideoFileInfo(
|
|
|
|
|
path: @"/server/Movies/300 (2007)/300 (2006).mkv",
|
|
|
|
|
container: "mkv",
|
|
|
|
|
name: "300",
|
|
|
|
|
year: 2006)
|
|
|
|
|
};
|
|
|
|
|
yield return new object[]
|
|
|
|
|
{
|
|
|
|
|
new VideoFileInfo()
|
|
|
|
|
{
|
|
|
|
|
Path = @"/server/Movies/Bad Boys (1995)/Bad Boys (1995).mkv",
|
|
|
|
|
Container = "mkv",
|
|
|
|
|
Name = "Bad Boys",
|
|
|
|
|
Year = 1995,
|
|
|
|
|
}
|
|
|
|
|
new VideoFileInfo(
|
|
|
|
|
path: @"/server/Movies/Bad Boys (1995)/Bad Boys (1995).mkv",
|
|
|
|
|
container: "mkv",
|
|
|
|
|
name: "Bad Boys",
|
|
|
|
|
year: 1995)
|
|
|
|
|
};
|
|
|
|
|
yield return new object[]
|
|
|
|
|
{
|
|
|
|
|
new VideoFileInfo()
|
|
|
|
|
{
|
|
|
|
|
Path = @"/server/Movies/Brave (2007)/Brave (2006).mkv",
|
|
|
|
|
Container = "mkv",
|
|
|
|
|
Name = "Brave",
|
|
|
|
|
Year = 2006,
|
|
|
|
|
}
|
|
|
|
|
new VideoFileInfo(
|
|
|
|
|
path: @"/server/Movies/Brave (2007)/Brave (2006).mkv",
|
|
|
|
|
container: "mkv",
|
|
|
|
|
name: "Brave",
|
|
|
|
|
year: 2006)
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -194,6 +165,34 @@ namespace Jellyfin.Naming.Tests.Video
|
|
|
|
|
Assert.Equal(result?.StubType, expectedResult.StubType);
|
|
|
|
|
Assert.Equal(result?.IsDirectory, expectedResult.IsDirectory);
|
|
|
|
|
Assert.Equal(result?.FileNameWithoutExtension, expectedResult.FileNameWithoutExtension);
|
|
|
|
|
Assert.Equal(result?.ToString(), expectedResult.ToString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void ResolveFile_EmptyPath()
|
|
|
|
|
{
|
|
|
|
|
var result = new VideoResolver(_namingOptions).ResolveFile(string.Empty);
|
|
|
|
|
|
|
|
|
|
Assert.Null(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void ResolveDirectoryTest()
|
|
|
|
|
{
|
|
|
|
|
var paths = new[]
|
|
|
|
|
{
|
|
|
|
|
@"/Server/Iron Man",
|
|
|
|
|
@"Batman",
|
|
|
|
|
string.Empty
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var resolver = new VideoResolver(_namingOptions);
|
|
|
|
|
var results = paths.Select(path => resolver.ResolveDirectory(path)).ToList();
|
|
|
|
|
|
|
|
|
|
Assert.Equal(3, results.Count);
|
|
|
|
|
Assert.NotNull(results[0]);
|
|
|
|
|
Assert.NotNull(results[1]);
|
|
|
|
|
Assert.Null(results[2]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|