コード例 #1
0
 private void ValidateMovie(Movie movie)
 {
     movie.Should().NotBeNull();
     movie.Title.Should().NotBeNullOrWhiteSpace();
     movie.CleanTitle.Should().Be(Parser.Parser.CleanSeriesTitle(movie.Title));
     movie.SortTitle.Should().Be(MovieTitleNormalizer.Normalize(movie.Title, movie.TmdbId));
     movie.Overview.Should().NotBeNullOrWhiteSpace();
     movie.InCinemas.Should().HaveValue();
     movie.Images.Should().NotBeEmpty();
     movie.ImdbId.Should().NotBeNullOrWhiteSpace();
     movie.Studio.Should().NotBeNullOrWhiteSpace();
     movie.Runtime.Should().BeGreaterThan(0);
     movie.TitleSlug.Should().NotBeNullOrWhiteSpace();
     //series.TvRageId.Should().BeGreaterThan(0);
     movie.TmdbId.Should().BeGreaterThan(0);
 }
コード例 #2
0
        // Add Movie:
        // Called whenever a movie is added from the GUI (and i assume via RSS feeds also)

        // Reason for patch:
        // Movie.Path must be root directory, not a sub folder.

        public static bool AddMovie(ref Movie newMovie, ref NzbDrone.Core.Movies.MovieService __instance,
                                    ref Logger ____logger, ref IConfigService ____configService, ref IMovieRepository ____movieRepository,
                                    ref IBuildFileNames ____fileNameBuilder, ref IEventAggregator ____eventAggregator, ref Movie __result)
        {
            var movie = newMovie;

            Ensure.That(newMovie, () => movie).IsNotNull();

            Utility.WriteToConsole("Patched AddMovie called!", ConsoleColor.Green);
            Utility.WriteToConsole($"New movie {movie.Title} added, patching file path to not have sub folders...", ConsoleColor.Green);

            MoviePathState defaultState = MoviePathState.Static;

            if (!____configService.PathsDefaultStatic)
            {
                defaultState = MoviePathState.Dynamic;
            }
            if (string.IsNullOrWhiteSpace(movie.Path))
            {
                // Call the original GetMovieFolder as it does other stuff too.
                var folderName = ____fileNameBuilder.GetMovieFolder(movie);

                // But replace our movie path with the root folder path, nothing more.
                movie.Path      = newMovie.RootFolderPath;
                movie.PathState = defaultState;
            }
            else
            {
                movie.PathState = defaultState == MoviePathState.Dynamic ? MoviePathState.StaticOnce : MoviePathState.Static;
            }

            ____logger.Info("Adding Movie {0} Path: [{1}]", newMovie, newMovie.Path);

            movie.CleanTitle = newMovie.Title.CleanSeriesTitle();
            movie.SortTitle  = MovieTitleNormalizer.Normalize(movie.Title, movie.TmdbId);
            movie.Added      = DateTime.UtcNow;

            ____movieRepository.Insert(newMovie);
            ____eventAggregator.PublishEvent(new MovieAddedEvent(__instance.GetMovie(movie.Id)));

            __result = movie;

            Utility.WriteToConsole($"Patching complete, new root directory of movie {movie.Title} is {movie.Path}", ConsoleColor.Green);
            Utility.WriteToConsole("Patching complete.", ConsoleColor.Green);
            return(false);
        }
コード例 #3
0
 public void should_normalize_title(string title, string expected)
 {
     MovieTitleNormalizer.Normalize(title, 0).Should().Be(expected);
 }