public void TestMixedExpressions() { var files = new[] { "Bad Boys (2006) part1.mkv", "Bad Boys (2006) part2.mkv", "Bad Boys (2006) part3.mkv", "Bad Boys (2006) part4.mkv", "Bad Boys (2006)-trailer.mkv", "300 (2006) parta.mkv", "300 (2006) partb.mkv", "300 (2006) partc.mkv", "300 (2006) partd.mkv", "300 (2006)-trailer.mkv", "300a.mkv", "300b.mkv", "300c.mkv", "300-trailer.mkv" }; var result = StackResolver.ResolveFiles(files, _namingOptions).ToList(); Assert.Equal(3, result.Count); TestStackInfo(result[0], "300 (2006)", 4); TestStackInfo(result[1], "300", 3); TestStackInfo(result[2], "Bad Boys (2006)", 4); }
public void TestFalsePositives5() { var files = new[] { "Star Trek 1 - The motion picture.mkv", "Star Trek 2- The wrath of khan.mkv" }; var result = StackResolver.ResolveFiles(files, _namingOptions).ToList(); Assert.Empty(result); }
public void TestFalsePositives4() { var files = new[] { "300 2006.mkv", "300 2007.mkv" }; var result = StackResolver.ResolveFiles(files, _namingOptions).ToList(); Assert.Empty(result); }
public void TestStackName() { var files = new[] { "d:/movies/300 2006 part1.mkv", "d:/movies/300 2006 part2.mkv" }; var result = StackResolver.ResolveFiles(files, _namingOptions).ToList(); Assert.Single(result); TestStackInfo(result[0], "300 2006", 2); }
public void TestFalsePositives6() { var files = new[] { "Red Riding in the Year of Our Lord 1983 (2009).mkv", "Red Riding in the Year of Our Lord 1980 (2009).mkv", "Red Riding in the Year of Our Lord 1974 (2009).mkv" }; var result = StackResolver.ResolveFiles(files, _namingOptions).ToList(); Assert.Empty(result); }
public void TestNumbersAppearingBeforePartNumber() { // No stacking here because there is no part/disc/etc var files = new[] { "Neverland (2011)[720p][PG][Voted 6.5][Family-Fantasy]part1.mkv", "Neverland (2011)[720p][PG][Voted 6.5][Family-Fantasy]part2.mkv" }; var result = StackResolver.ResolveFiles(files, _namingOptions).ToList(); Assert.Single(result); Assert.Equal(2, result[0].Files.Count); }
public void ResolveFiles_FileNamesWithMissingPartType_ReturnsNoStack() { var files = new[] { "Bad Boys (2006).mkv", "Bad Boys (2006) 1.mkv", "Bad Boys (2006) 2.mkv", "Bad Boys (2006) 3.mkv", "Bad Boys (2006)-trailer.mkv" }; var result = StackResolver.ResolveFiles(files, _namingOptions).ToList(); Assert.Empty(result); }
public void ResolveFiles_GivenPartInMiddleOfName_ReturnsNoStack() { var files = new[] { "Bad Boys (2006).part1.stv.unrated.multi.1080p.bluray.x264-rough.mkv", "Bad Boys (2006).part2.stv.unrated.multi.1080p.bluray.x264-rough.mkv", "Bad Boys (2006).part3.stv.unrated.multi.1080p.bluray.x264-rough.mkv", "Bad Boys (2006).part4.stv.unrated.multi.1080p.bluray.x264-rough.mkv", "Bad Boys (2006)-trailer.mkv" }; var result = StackResolver.ResolveFiles(files, _namingOptions).ToList(); Assert.Empty(result); }
public void TestNamesWithoutParts() { // No stacking here because there is no part/disc/etc var files = new[] { "Harry Potter and the Deathly Hallows.mkv", "Harry Potter and the Deathly Hallows 1.mkv", "Harry Potter and the Deathly Hallows 2.mkv", "Harry Potter and the Deathly Hallows 3.mkv", "Harry Potter and the Deathly Hallows 4.mkv" }; var result = StackResolver.ResolveFiles(files, _namingOptions).ToList(); Assert.Empty(result); }
public void TestFalsePositive() { var files = new[] { "300a.mkv", "300b.mkv", "300c.mkv", "300-trailer.mkv" }; var result = StackResolver.ResolveFiles(files, _namingOptions).ToList(); Assert.Single(result); TestStackInfo(result[0], "300", 3); }
public void TestMixedExpressionsNotAllowed() { var files = new[] { "Bad Boys (2006) part1.mkv", "Bad Boys (2006) part2.mkv", "Bad Boys (2006) part3.mkv", "Bad Boys (2006) parta.mkv", "Bad Boys (2006)-trailer.mkv" }; var result = StackResolver.ResolveFiles(files, _namingOptions).ToList(); Assert.Single(result); TestStackInfo(result[0], "Bad Boys (2006)", 3); }
public void TestSimpleStackWithNumericName() { var files = new[] { "300 (2006) part1.mkv", "300 (2006) part2.mkv", "300 (2006) part3.mkv", "300 (2006) part4.mkv", "300 (2006)-trailer.mkv" }; var result = StackResolver.ResolveFiles(files, _namingOptions).ToList(); Assert.Single(result); TestStackInfo(result[0], "300 (2006)", 4); }
public void TestFailSequence() { var files = new[] { "300 part1.mkv", "300 part2.mkv", "Avatar", "Avengers part1.mkv", "Avengers part2.mkv", "Avengers part3.mkv" }; var result = StackResolver.ResolveFiles(files, _namingOptions).ToList(); Assert.Equal(2, result.Count); TestStackInfo(result[0], "300", 2); TestStackInfo(result[1], "Avengers", 3); }
public void TestAlphaLimitOfFour() { var files = new[] { "300 (2006) parta.mkv", "300 (2006) partb.mkv", "300 (2006) partc.mkv", "300 (2006) partd.mkv", "300 (2006) parte.mkv", "300 (2006) partf.mkv", "300 (2006) partg.mkv", "300 (2006)-trailer.mkv" }; var result = StackResolver.ResolveFiles(files, _namingOptions).ToList(); Assert.Single(result); TestStackInfo(result[0], "300 (2006)", 4); }
public void TestDualStacks() { var files = new[] { "Bad Boys (2006) part1.mkv", "Bad Boys (2006) part2.mkv", "Bad Boys (2006) part3.mkv", "Bad Boys (2006) part4.mkv", "Bad Boys (2006)-trailer.mkv", "300 (2006) part1.mkv", "300 (2006) part2.mkv", "300 (2006) part3.mkv", "300 (2006)-trailer.mkv" }; var result = StackResolver.ResolveFiles(files, _namingOptions).ToList(); Assert.Equal(2, result.Count); TestStackInfo(result[1], "Bad Boys (2006)", 4); TestStackInfo(result[0], "300 (2006)", 3); }
/// <summary> /// Gets the multi file movie. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="movies">The movies.</param> /// <returns>``0.</returns> private T GetMultiFileMovie <T>(IEnumerable <T> movies) where T : Video, new() { var sortedMovies = movies.OrderBy(i => i.Path).ToList(); var firstMovie = sortedMovies[0]; var paths = sortedMovies.Select(i => i.Path).ToList(); var resolver = new StackResolver(new ExtendedNamingOptions(), new Naming.Logging.NullLogger()); var result = resolver.ResolveFiles(paths); if (result.Stacks.Count != 1) { return(null); } firstMovie.IsMultiPart = true; firstMovie.Name = result.Stacks[0].Name; // They must all be part of the sequence if we're going to consider it a multi-part movie return(firstMovie); }