Пример #1
0
        public SeriesModule(IBroadcastSignalRMessage signalRBroadcaster,
                            ISeriesService seriesService,
                            IAddSeriesService addSeriesService,
                            ISeriesStatisticsService seriesStatisticsService,
                            ISceneMappingService sceneMappingService,
                            IMapCoversToLocal coverMapper,
                            IManageCommandQueue commandQueueManager,
                            IRootFolderService rootFolderService,
                            RootFolderValidator rootFolderValidator,
                            MappedNetworkDriveValidator mappedNetworkDriveValidator,
                            SeriesPathValidator seriesPathValidator,
                            SeriesExistsValidator seriesExistsValidator,
                            SeriesAncestorValidator seriesAncestorValidator,
                            SystemFolderValidator systemFolderValidator,
                            ProfileExistsValidator profileExistsValidator,
                            LanguageProfileExistsValidator languageProfileExistsValidator,
                            SeriesFolderAsRootFolderValidator seriesFolderAsRootFolderValidator
                            )
            : base(signalRBroadcaster)
        {
            _seriesService           = seriesService;
            _addSeriesService        = addSeriesService;
            _seriesStatisticsService = seriesStatisticsService;
            _sceneMappingService     = sceneMappingService;

            _coverMapper         = coverMapper;
            _commandQueueManager = commandQueueManager;
            _rootFolderService   = rootFolderService;

            GetResourceAll  = AllSeries;
            GetResourceById = GetSeries;
            CreateResource  = AddSeries;
            UpdateResource  = UpdateSeries;
            DeleteResource  = DeleteSeries;

            Http.Validation.RuleBuilderExtensions.ValidId(SharedValidator.RuleFor(s => s.QualityProfileId));

            SharedValidator.RuleFor(s => s.Path)
            .Cascade(CascadeMode.StopOnFirstFailure)
            .IsValidPath()
            .SetValidator(rootFolderValidator)
            .SetValidator(mappedNetworkDriveValidator)
            .SetValidator(seriesPathValidator)
            .SetValidator(seriesAncestorValidator)
            .SetValidator(systemFolderValidator)
            .When(s => !s.Path.IsNullOrWhiteSpace());

            SharedValidator.RuleFor(s => s.QualityProfileId).SetValidator(profileExistsValidator);
            SharedValidator.RuleFor(s => s.LanguageProfileId).SetValidator(languageProfileExistsValidator);

            PostValidator.RuleFor(s => s.Path).IsValidPath().When(s => s.RootFolderPath.IsNullOrWhiteSpace());
            PostValidator.RuleFor(s => s.RootFolderPath)
            .IsValidPath()
            .SetValidator(seriesFolderAsRootFolderValidator)
            .When(s => s.Path.IsNullOrWhiteSpace());
            PostValidator.RuleFor(s => s.Title).NotEmpty();
            PostValidator.RuleFor(s => s.TvdbId).GreaterThan(0).SetValidator(seriesExistsValidator);

            PutValidator.RuleFor(s => s.Path).IsValidPath();
        }
Пример #2
0
        public SeriesModule(IBroadcastSignalRMessage signalRBroadcaster,
                            ISeriesService seriesService,
                            IAddSeriesService addSeriesService,
                            ISeriesStatisticsService seriesStatisticsService,
                            ISceneMappingService sceneMappingService,
                            IMapCoversToLocal coverMapper,
                            ILanguageProfileService languageProfileService,
                            RootFolderValidator rootFolderValidator,
                            SeriesPathValidator seriesPathValidator,
                            SeriesExistsValidator seriesExistsValidator,
                            SeriesAncestorValidator seriesAncestorValidator,
                            SystemFolderValidator systemFolderValidator,
                            ProfileExistsValidator profileExistsValidator,
                            LanguageProfileExistsValidator languageProfileExistsValidator
                            )
            : base(signalRBroadcaster)
        {
            _seriesService           = seriesService;
            _addSeriesService        = addSeriesService;
            _seriesStatisticsService = seriesStatisticsService;
            _sceneMappingService     = sceneMappingService;

            _coverMapper            = coverMapper;
            _languageProfileService = languageProfileService;

            GetResourceAll  = AllSeries;
            GetResourceById = GetSeries;
            CreateResource  = AddSeries;
            UpdateResource  = UpdateSeries;
            DeleteResource  = DeleteSeries;

            SharedValidator.RuleFor(s => s.ProfileId).ValidId();
            SharedValidator.RuleFor(s => s.LanguageProfileId);

            SharedValidator.RuleFor(s => s.Path)
            .Cascade(CascadeMode.StopOnFirstFailure)
            .IsValidPath()
            .SetValidator(rootFolderValidator)
            .SetValidator(seriesPathValidator)
            .SetValidator(seriesAncestorValidator)
            .SetValidator(systemFolderValidator)
            .When(s => !s.Path.IsNullOrWhiteSpace());

            SharedValidator.RuleFor(s => s.ProfileId).SetValidator(profileExistsValidator);

            PostValidator.RuleFor(s => s.Path).IsValidPath().When(s => s.RootFolderPath.IsNullOrWhiteSpace());
            PostValidator.RuleFor(s => s.RootFolderPath).IsValidPath().When(s => s.Path.IsNullOrWhiteSpace());
            PostValidator.RuleFor(s => s.TvdbId).GreaterThan(0).SetValidator(seriesExistsValidator);
            PostValidator.RuleFor(s => s.LanguageProfileId).SetValidator(languageProfileExistsValidator).When(s => s.LanguageProfileId != 0);

            PutValidator.RuleFor(s => s.Path).IsValidPath();

            // Ensure any editing has a valid LanguageProfile
            PutValidator.RuleFor(s => s.LanguageProfileId).SetValidator(languageProfileExistsValidator);
        }
Пример #3
0
        public SeriesModule(IBroadcastSignalRMessage signalRBroadcaster,
                            ISeriesService seriesService,
                            IAddSeriesService addSeriesService,
                            ISeriesStatisticsService seriesStatisticsService,
                            ISceneMappingService sceneMappingService,
                            IMapCoversToLocal coverMapper,
                            RootFolderValidator rootFolderValidator,
                            SeriesPathValidator seriesPathValidator,
                            SeriesExistsValidator seriesExistsValidator,
                            DroneFactoryValidator droneFactoryValidator,
                            SeriesAncestorValidator seriesAncestorValidator,
                            SystemFolderValidator systemFolderValidator,
                            ProfileExistsValidator profileExistsValidator
                            )
            : base(signalRBroadcaster)
        {
            _seriesService           = seriesService;
            _addSeriesService        = addSeriesService;
            _seriesStatisticsService = seriesStatisticsService;
            _sceneMappingService     = sceneMappingService;

            _coverMapper = coverMapper;

            GetResourceAll  = AllSeries;
            GetResourceById = GetSeries;
            CreateResource  = AddSeries;
            UpdateResource  = UpdateSeries;
            DeleteResource  = DeleteSeries;

            Validation.RuleBuilderExtensions.ValidId(SharedValidator.RuleFor(s => s.ProfileId));

            SharedValidator.RuleFor(s => s.Path)
            .Cascade(CascadeMode.StopOnFirstFailure)
            .IsValidPath()
            .SetValidator(rootFolderValidator)
            .SetValidator(seriesPathValidator)
            .SetValidator(droneFactoryValidator)
            .SetValidator(seriesAncestorValidator)
            .SetValidator(systemFolderValidator)
            .When(s => !s.Path.IsNullOrWhiteSpace());

            SharedValidator.RuleFor(s => s.ProfileId).SetValidator(profileExistsValidator);

            PostValidator.RuleFor(s => s.Path).IsValidPath().When(s => s.RootFolderPath.IsNullOrWhiteSpace());
            PostValidator.RuleFor(s => s.RootFolderPath).IsValidPath().When(s => s.Path.IsNullOrWhiteSpace());
            PostValidator.RuleFor(s => s.TvdbId).GreaterThan(0).SetValidator(seriesExistsValidator);

            PutValidator.RuleFor(s => s.Path).IsValidPath();
        }
Пример #4
0
 public ImportListSyncService(IImportListFactory importListFactory,
                              IImportListExclusionService importListExclusionService,
                              IFetchAndParseImportList listFetcherAndParser,
                              ISearchForNewSeries seriesSearchService,
                              ISeriesService seriesService,
                              IAddSeriesService addSeriesService,
                              Logger logger)
 {
     _importListFactory          = importListFactory;
     _importListExclusionService = importListExclusionService;
     _listFetcherAndParser       = listFetcherAndParser;
     _seriesSearchService        = seriesSearchService;
     _seriesService    = seriesService;
     _addSeriesService = addSeriesService;
     _logger           = logger;
 }
Пример #5
0
 public SeriesImportModule(IAddSeriesService addSeriesService)
     : base("/series/import")
 {
     _addSeriesService = addSeriesService;
     Post("/", x => Import());
 }