public void TestStackAndExtras() { // No stacking here because there is no part/disc/etc var files = new[] { "Harry Potter and the Deathly Hallows-trailer.mkv", "Harry Potter and the Deathly Hallows.trailer.mkv", "Harry Potter and the Deathly Hallows part1.mkv", "Harry Potter and the Deathly Hallows part2.mkv", "Harry Potter and the Deathly Hallows part3.mkv", "Harry Potter and the Deathly Hallows part4.mkv", "Batman-deleted.mkv", "Batman-sample.mkv", "Batman-trailer.mkv", "Batman part1.mkv", "Batman part2.mkv", "Batman part3.mkv", "Avengers.mkv", "Avengers-trailer.mkv", // Despite having a keyword in the name that will return an ExtraType, there's no original video to match it to // So this is just a standalone video "trailer.mkv", // Same as above "WillyWonka-trailer.mkv" }; var result = VideoListResolver.Resolve( files.Select(i => VideoResolver.Resolve(i, false, _namingOptions)).OfType <VideoFileInfo>().ToList(), _namingOptions).ToList(); Assert.Equal(11, result.Count); var batman = result.FirstOrDefault(x => string.Equals(x.Name, "Batman", StringComparison.Ordinal)); Assert.NotNull(batman); Assert.Equal(3, batman !.Files.Count); var harry = result.FirstOrDefault(x => string.Equals(x.Name, "Harry Potter and the Deathly Hallows", StringComparison.Ordinal)); Assert.NotNull(harry); Assert.Equal(4, harry !.Files.Count); Assert.False(result[2].ExtraType.HasValue); Assert.Equal(ExtraType.Trailer, result[3].ExtraType); Assert.Equal(ExtraType.Trailer, result[4].ExtraType); Assert.Equal(ExtraType.DeletedScene, result[5].ExtraType); Assert.Equal(ExtraType.Sample, result[6].ExtraType); Assert.Equal(ExtraType.Trailer, result[7].ExtraType); Assert.Equal(ExtraType.Trailer, result[8].ExtraType); Assert.Equal(ExtraType.Trailer, result[9].ExtraType); Assert.Equal(ExtraType.Trailer, result[10].ExtraType); }
public void TestArgumentOutOfRangeException() { var files = new[] { @"/nas-markrobbo78/Videos/INDEX HTPC/Movies/Watched/3 - ACTION/Argo (2012)/movie.mkv" }; var result = VideoListResolver.Resolve( files.Select(i => VideoResolver.Resolve(i, false, _namingOptions)).OfType <VideoFileInfo>().ToList(), _namingOptions).ToList(); Assert.Single(result); }
public void TestColony() { var files = new[] { @"The Colony.mkv" }; var result = VideoListResolver.Resolve( files.Select(i => VideoResolver.Resolve(i, false, _namingOptions)).OfType <VideoFileInfo>().ToList(), _namingOptions).ToList(); Assert.Single(result); }
public void TestMultiVersion7() { var files = new[] { @"/movies/Iron Man/Iron Man - B (2006).mkv", @"/movies/Iron Man/Iron Man - C (2007).mkv" }; var result = VideoListResolver.Resolve( files.Select(i => VideoResolver.Resolve(i, false, _namingOptions)).OfType <VideoFileInfo>().ToList(), _namingOptions).ToList(); Assert.Equal(2, result.Count); }
public void TestFourSisters() { var files = new[] { @"Four Sisters and a Wedding - A.avi", @"Four Sisters and a Wedding - B.avi" }; var result = VideoListResolver.Resolve( files.Select(i => VideoResolver.Resolve(i, false, _namingOptions)).OfType <VideoFileInfo>().ToList(), _namingOptions).ToList(); Assert.Single(result); }
public void Resolve_GivenUnclosedBrackets_DoesNotGroup() { var files = new[] { @"/movies/John Wick - Chapter 3 (2019)/John Wick - Chapter 3 (2019) [Version 1].mkv", @"/movies/John Wick - Chapter 3 (2019)/John Wick - Chapter 3 (2019) [Version 2.mkv" }; var result = VideoListResolver.Resolve( files.Select(i => VideoResolver.Resolve(i, false, _namingOptions)).OfType <VideoFileInfo>().ToList(), _namingOptions).ToList(); Assert.Equal(2, result.Count); }
public void TestMultiDisc() { var files = new[] { @"M:/Movies (DVD)/Movies (Musical)/Sound of Music (1965)/Sound of Music Disc 1", @"M:/Movies (DVD)/Movies (Musical)/Sound of Music (1965)/Sound of Music Disc 2" }; var result = VideoListResolver.Resolve( files.Select(i => VideoResolver.Resolve(i, true, _namingOptions)).OfType <VideoFileInfo>().ToList(), _namingOptions).ToList(); Assert.Single(result); }
public void TestFourRooms() { var files = new[] { @"Four Rooms - A.avi", @"Four Rooms - A.mp4" }; var result = VideoListResolver.Resolve( files.Select(i => VideoResolver.Resolve(i, false, _namingOptions)).OfType <VideoFileInfo>().ToList(), _namingOptions).ToList(); Assert.Equal(2, result.Count); }
public void TestWithMetadata() { var files = new[] { "300.mkv", "300.nfo" }; var result = VideoListResolver.Resolve( files.Select(i => VideoResolver.Resolve(i, false, _namingOptions)).OfType <VideoFileInfo>().ToList(), _namingOptions).ToList(); Assert.Single(result); }
public void TestPoundSign() { // These should be considered separate, unrelated videos var files = new[] { @"My movie #1.mp4", @"My movie #2.mp4" }; var result = VideoListResolver.Resolve( files.Select(i => VideoResolver.Resolve(i, true, _namingOptions)).OfType <VideoFileInfo>().ToList(), _namingOptions).ToList(); Assert.Equal(2, result.Count); }
public void TestMultiEdition3() { var files = new[] { @"/movies/The Phantom of the Opera (1925)/The Phantom of the Opera (1925) - 1925 version.mkv", @"/movies/The Phantom of the Opera (1925)/The Phantom of the Opera (1925) - 1929 version.mkv" }; var result = VideoListResolver.Resolve( files.Select(i => VideoResolver.Resolve(i, false, _namingOptions)).OfType <VideoFileInfo>().ToList(), _namingOptions).ToList(); Assert.Single(result); Assert.Single(result[0].AlternateVersions); }
public void Resolve_GivenFolderNameWithBracketsAndHyphens_GroupsBasedOnFolderName() { var files = new[] { @"/movies/John Wick - Kapitel 3 (2019) [imdbid=tt6146586]/John Wick - Kapitel 3 (2019) [imdbid=tt6146586] - Version 1.mkv", @"/movies/John Wick - Kapitel 3 (2019) [imdbid=tt6146586]/John Wick - Kapitel 3 (2019) [imdbid=tt6146586] - Version 2.mkv" }; var result = VideoListResolver.Resolve( files.Select(i => VideoResolver.Resolve(i, false, _namingOptions)).OfType <VideoFileInfo>().ToList(), _namingOptions).ToList(); Assert.Single(result); Assert.Single(result[0].AlternateVersions); }
public void TestMultiVersion10() { var files = new[] { @"/movies/Blade Runner (1982)/Blade Runner (1982) [Final Cut] [1080p HEVC AAC].mkv", @"/movies/Blade Runner (1982)/Blade Runner (1982) [EE by ADM] [480p HEVC AAC,AAC,AAC].mkv" }; var result = VideoListResolver.Resolve( files.Select(i => VideoResolver.Resolve(i, false, _namingOptions)).OfType <VideoFileInfo>().ToList(), _namingOptions).ToList(); Assert.Single(result); Assert.Single(result[0].AlternateVersions); }
public void TestMultiVersion11() { var files = new[] { @"/movies/X-Men Apocalypse (2016)/X-Men Apocalypse (2016) [1080p] Blu-ray.x264.DTS.mkv", @"/movies/X-Men Apocalypse (2016)/X-Men Apocalypse (2016) [2160p] Blu-ray.x265.AAC.mkv" }; var result = VideoListResolver.Resolve( files.Select(i => VideoResolver.Resolve(i, false, _namingOptions)).OfType <VideoFileInfo>().ToList(), _namingOptions).ToList(); Assert.Single(result); Assert.Single(result[0].AlternateVersions); }
public void Resolve_TrailerMatchesFolderName_ReturnsSingleItem() { var files = new[] { "/movies/Looper (2012)/Looper (2012)-trailer.mkv", "/movies/Looper (2012)/Looper.bluray.720p.x264.mkv" }; var result = VideoListResolver.Resolve( files.Select(i => VideoResolver.Resolve(i, false, _namingOptions)).OfType <VideoFileInfo>().ToList(), _namingOptions).ToList(); Assert.Equal(2, result.Count); Assert.False(result[0].ExtraType.HasValue); Assert.Equal(ExtraType.Trailer, result[1].ExtraType); }
public void Resolve_TrailerInTrailersFolder_ReturnsCorrectExtraType() { var files = new[] { @"/Server/Despicable Me/Despicable Me (2010).mkv", @"/Server/Despicable Me/trailers/some title.mkv" }; var result = VideoListResolver.Resolve( files.Select(i => VideoResolver.Resolve(i, false, _namingOptions)).OfType <VideoFileInfo>().ToList(), _namingOptions).ToList(); Assert.Equal(2, result.Count); Assert.False(result[0].ExtraType.HasValue); Assert.Equal(ExtraType.Trailer, result[1].ExtraType); }
public void TestWithExtra() { var files = new[] { "300.mkv", "300 trailer.mkv" }; var result = VideoListResolver.Resolve( files.Select(i => VideoResolver.Resolve(i, false, _namingOptions)).OfType <VideoFileInfo>().ToList(), _namingOptions).ToList(); Assert.Equal(2, result.Count); Assert.False(result[0].ExtraType.HasValue); Assert.Equal(ExtraType.Trailer, result[1].ExtraType); }
public void TestDoubleTags() { var files = new[] { @"/MCFAMILY-PC/Private3$/Heterosexual/Breast In Class 2 Counterfeit Racks (2011)/Breast In Class 2 Counterfeit Racks (2011) Disc 1 cd1.avi", @"/MCFAMILY-PC/Private3$/Heterosexual/Breast In Class 2 Counterfeit Racks (2011)/Breast In Class 2 Counterfeit Racks (2011) Disc 1 cd2.avi", @"/MCFAMILY-PC/Private3$/Heterosexual/Breast In Class 2 Counterfeit Racks (2011)/Breast In Class 2 Disc 2 cd1.avi", @"/MCFAMILY-PC/Private3$/Heterosexual/Breast In Class 2 Counterfeit Racks (2011)/Breast In Class 2 Disc 2 cd2.avi" }; var result = VideoListResolver.Resolve( files.Select(i => VideoResolver.Resolve(i, false, _namingOptions)).OfType <VideoFileInfo>().ToList(), _namingOptions).ToList(); Assert.Equal(2, result.Count); }
public void TestSubfolders() { var files = new[] { @"/Movies/Despicable Me/Despicable Me.mkv", @"/Movies/Despicable Me/trailers/trailer.mkv" }; var result = VideoListResolver.Resolve( files.Select(i => VideoResolver.Resolve(i, false, _namingOptions)).OfType <VideoFileInfo>().ToList(), _namingOptions).ToList(); Assert.Equal(2, result.Count); Assert.False(result[0].ExtraType.HasValue); Assert.Equal(ExtraType.Trailer, result[1].ExtraType); }
public void TestVariationWithFolderName() { var files = new[] { "X-Men Days of Future Past - 1080p.mkv", "X-Men Days of Future Past-trailer.mp4" }; var result = VideoListResolver.Resolve( files.Select(i => VideoResolver.Resolve(i, false, _namingOptions)).OfType <VideoFileInfo>().ToList(), _namingOptions).ToList(); Assert.Equal(2, result.Count); Assert.False(result[0].ExtraType.HasValue); Assert.Equal(ExtraType.Trailer, result[1].ExtraType); }
public void TestMultiEdition1() { var files = new[] { @"/movies/X-Men Days of Future Past/X-Men Days of Future Past - 1080p.mkv", @"/movies/X-Men Days of Future Past/X-Men Days of Future Past-trailer.mp4", @"/movies/X-Men Days of Future Past/X-Men Days of Future Past - [hsbs].mkv", @"/movies/X-Men Days of Future Past/X-Men Days of Future Past [hsbs].mkv" }; var result = VideoListResolver.Resolve( files.Select(i => VideoResolver.Resolve(i, false, _namingOptions)).OfType <VideoFileInfo>().ToList(), _namingOptions).ToList(); Assert.Single(result.Where(v => v.ExtraType == null)); Assert.Single(result.Where(v => v.ExtraType != null)); }
public void TestSeparateFiles() { // These should be considered separate, unrelated videos var files = new[] { "My video 1.mkv", "My video 2.mkv", "My video 3.mkv", "My video 4.mkv", "My video 5.mkv" }; var result = VideoListResolver.Resolve( files.Select(i => VideoResolver.Resolve(i, false, _namingOptions)).OfType <VideoFileInfo>().ToList(), _namingOptions).ToList(); Assert.Equal(5, result.Count); }
public void TestMultiEdition2() { var files = new[] { @"/movies/X-Men Days of Future Past/X-Men Days of Future Past - apple.mkv", @"/movies/X-Men Days of Future Past/X-Men Days of Future Past-trailer.mp4", @"/movies/X-Men Days of Future Past/X-Men Days of Future Past - banana.mkv", @"/movies/X-Men Days of Future Past/X-Men Days of Future Past [banana].mp4" }; var result = VideoListResolver.Resolve( files.Select(i => VideoResolver.Resolve(i, false, _namingOptions)).OfType <VideoFileInfo>().ToList(), _namingOptions).ToList(); Assert.Single(result.Where(v => v.ExtraType == null)); Assert.Single(result.Where(v => v.ExtraType != null)); Assert.Equal(2, result[0].AlternateVersions.Count); }
public void Resolve_SameNameAndYear_ReturnsSingleItem() { var files = new[] { "Looper (2012)-trailer.mkv", "Looper 2012-trailer.mkv", "Looper.2012.bluray.720p.x264.mkv" }; var result = VideoListResolver.Resolve( files.Select(i => VideoResolver.Resolve(i, false, _namingOptions)).OfType <VideoFileInfo>().ToList(), _namingOptions).ToList(); Assert.Equal(3, result.Count); Assert.False(result[0].ExtraType.HasValue); Assert.Equal(ExtraType.Trailer, result[1].ExtraType); Assert.Equal(ExtraType.Trailer, result[2].ExtraType); }
public void TestMultiVersion3() { var files = new[] { @"/movies/Movie/Movie 1.mkv", @"/movies/Movie/Movie 2.mkv", @"/movies/Movie/Movie 3.mkv", @"/movies/Movie/Movie 4.mkv", @"/movies/Movie/Movie 5.mkv" }; var result = VideoListResolver.Resolve( files.Select(i => VideoResolver.Resolve(i, false, _namingOptions)).OfType <VideoFileInfo>().ToList(), _namingOptions).ToList(); Assert.Equal(5, result.Count); Assert.Empty(result[0].AlternateVersions); }
public void TestStackedWithTrailer() { var files = new[] { @"No (2012) part1.mp4", @"No (2012) part2.mp4", @"No (2012) part1-trailer.mp4", @"No (2012)-trailer.mp4" }; var result = VideoListResolver.Resolve( files.Select(i => VideoResolver.Resolve(i, false, _namingOptions)).OfType <VideoFileInfo>().ToList(), _namingOptions).ToList(); Assert.Equal(3, result.Count); Assert.False(result[0].ExtraType.HasValue); Assert.Equal(ExtraType.Trailer, result[1].ExtraType); Assert.Equal(ExtraType.Trailer, result[2].ExtraType); }
public void TestExtrasByFolderName() { var files = new[] { @"/Movies/Top Gun (1984)/movie.mp4", @"/Movies/Top Gun (1984)/Top Gun (1984)-trailer.mp4", @"/Movies/Top Gun (1984)/Top Gun (1984)-trailer2.mp4", @"/Movies/trailer.mp4" }; var result = VideoListResolver.Resolve( files.Select(i => VideoResolver.Resolve(i, false, _namingOptions)).OfType <VideoFileInfo>().ToList(), _namingOptions).ToList(); Assert.Equal(4, result.Count); Assert.False(result[0].ExtraType.HasValue); Assert.Equal(ExtraType.Trailer, result[1].ExtraType); Assert.Equal(ExtraType.Trailer, result[2].ExtraType); Assert.Equal(ExtraType.Trailer, result[3].ExtraType); }
public void TestMultiVersion9() { // Test for false positive var files = new[] { @"/movies/Iron Man/Iron Man (2007).mkv", @"/movies/Iron Man/Iron Man (2008).mkv", @"/movies/Iron Man/Iron Man (2009).mkv", @"/movies/Iron Man/Iron Man (2010).mkv", @"/movies/Iron Man/Iron Man (2011).mkv" }; var result = VideoListResolver.Resolve( files.Select(i => VideoResolver.Resolve(i, false, _namingOptions)).OfType <VideoFileInfo>().ToList(), _namingOptions).ToList(); Assert.Equal(5, result.Count); Assert.Empty(result[0].AlternateVersions); }
public void TestMultiVersion8() { var files = new[] { @"/movies/Iron Man/Iron Man.mkv", @"/movies/Iron Man/Iron Man_720p.mkv", @"/movies/Iron Man/Iron Man_test.mkv", @"/movies/Iron Man/Iron Man_bluray.mkv", @"/movies/Iron Man/Iron Man_3d.mkv", @"/movies/Iron Man/Iron Man_3d-hsbs.mkv", @"/movies/Iron Man/Iron Man_3d.hsbs.mkv" }; var result = VideoListResolver.Resolve( files.Select(i => VideoResolver.Resolve(i, false, _namingOptions)).OfType <VideoFileInfo>().ToList(), _namingOptions).ToList(); Assert.Equal(7, result.Count); Assert.Empty(result[0].AlternateVersions); }
public void TestMultiVersionLimit() { var files = new[] { @"/movies/Movie/Movie.mkv", @"/movies/Movie/Movie-2.mkv", @"/movies/Movie/Movie-3.mkv", @"/movies/Movie/Movie-4.mkv", @"/movies/Movie/Movie-5.mkv", @"/movies/Movie/Movie-6.mkv", @"/movies/Movie/Movie-7.mkv", @"/movies/Movie/Movie-8.mkv" }; var result = VideoListResolver.Resolve( files.Select(i => VideoResolver.Resolve(i, false, _namingOptions)).OfType <VideoFileInfo>().ToList(), _namingOptions).ToList(); Assert.Single(result); Assert.Equal(7, result[0].AlternateVersions.Count); }