Beispiel #1
0
 public SeriesEditorModule(ISeriesService seriesService, ILanguageProfileService languageProfileService)
     : base("/series/editor")
 {
     _seriesService          = seriesService;
     _languageProfileService = languageProfileService;
     Put("/", series => SaveAll());
 }
Beispiel #2
0
        public ReleaseModule(IFetchAndParseRss rssFetcherAndParser,
                             ISearchForReleases releaseSearchService,
                             IMakeDownloadDecision downloadDecisionMaker,
                             IPrioritizeDownloadDecision prioritizeDownloadDecision,
                             IDownloadService downloadService,
                             ISeriesService seriesService,
                             IEpisodeService episodeService,
                             IParsingService parsingService,
                             ICacheManager cacheManager,
                             ILanguageProfileService languageProfileService,
                             IQualityProfileService qualityProfileService,
                             Logger logger) :
            base(languageProfileService, qualityProfileService)
        {
            _rssFetcherAndParser        = rssFetcherAndParser;
            _releaseSearchService       = releaseSearchService;
            _downloadDecisionMaker      = downloadDecisionMaker;
            _prioritizeDownloadDecision = prioritizeDownloadDecision;
            _downloadService            = downloadService;
            _seriesService  = seriesService;
            _episodeService = episodeService;
            _parsingService = parsingService;
            _logger         = logger;

            PostValidator.RuleFor(s => s.IndexerId).ValidId();
            PostValidator.RuleFor(s => s.Guid).NotEmpty();

            GetResourceAll = GetReleases;
            Post("/", x => DownloadRelease(ReadResourceFromRequest()));

            _remoteEpisodeCache = cacheManager.GetCache <RemoteEpisode>(GetType(), "remoteEpisodes");
        }
Beispiel #3
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);
        }
Beispiel #4
0
        public LanguageProfileModule(ILanguageProfileService profileService)
        {
            _profileService = profileService;
            SharedValidator.RuleFor(c => c.Name).NotEmpty();
            SharedValidator.RuleFor(c => c.Cutoff).NotNull();
            SharedValidator.RuleFor(c => c.Languages).MustHaveAllowedLanguage();

            GetResourceAll  = GetAll;
            GetResourceById = GetById;
            UpdateResource  = Update;
            CreateResource  = Create;
            DeleteResource  = DeleteProfile;
        }
Beispiel #5
0
        public QueueModule(IBroadcastSignalRMessage broadcastSignalRMessage,
                           IQueueService queueService,
                           IPendingReleaseService pendingReleaseService,
                           ILanguageProfileService languageProfileService,
                           QualityProfileService qualityProfileService)
            : base(broadcastSignalRMessage)
        {
            _queueService          = queueService;
            _pendingReleaseService = pendingReleaseService;
            GetResourcePaged       = GetQueue;

            LANGUAGE_COMPARER = new LanguageComparer(languageProfileService.GetDefaultProfile(string.Empty));
            QUALITY_COMPARER  = new QualityModelComparer(qualityProfileService.GetDefaultProfile(string.Empty));
        }
Beispiel #6
0
        public ReleasePushModule(IMakeDownloadDecision downloadDecisionMaker,
                                 IProcessDownloadDecisions downloadDecisionProcessor,
                                 IIndexerFactory indexerFactory,
                                 ILanguageProfileService languageProfileService,
                                 IQualityProfileService qualityProfileService,
                                 Logger logger) :
            base(languageProfileService, qualityProfileService)
        {
            _downloadDecisionMaker     = downloadDecisionMaker;
            _downloadDecisionProcessor = downloadDecisionProcessor;
            _indexerFactory            = indexerFactory;
            _logger = logger;

            PostValidator.RuleFor(s => s.Title).NotEmpty();
            PostValidator.RuleFor(s => s.DownloadUrl).NotEmpty();
            PostValidator.RuleFor(s => s.Protocol).NotEmpty();
            PostValidator.RuleFor(s => s.PublishDate).NotEmpty();

            Post("/push", x => ProcessRelease(ReadResourceFromRequest()));
        }
 public EnsureValidLanguageProfileId(ISeriesRepository seriesRepository, ILanguageProfileService languageProfileService)
 {
     _seriesRepository       = seriesRepository;
     _languageProfileService = languageProfileService;
 }
Beispiel #8
0
 public LanguageProfileExistsValidator(ILanguageProfileService profileService)
     : base("Language profile does not exist")
 {
     _profileService = profileService;
 }
Beispiel #9
0
 public EpisodeCutoffService(IEpisodeRepository episodeRepository, IProfileService profileService, ILanguageProfileService languageProfileService, Logger logger)
 {
     _episodeRepository      = episodeRepository;
     _profileService         = profileService;
     _languageProfileService = languageProfileService;
 }
Beispiel #10
0
 public ReleaseModuleBase(ILanguageProfileService languageProfileService,
                          IQualityProfileService qualityProfileService)
 {
     LANGUAGE_PROFILE = languageProfileService.GetDefaultProfile(string.Empty);
     QUALITY_PROFILE  = qualityProfileService.GetDefaultProfile(string.Empty);
 }
 public EpisodeCutoffService(IEpisodeRepository episodeRepository, IQualityProfileService qualityProfileService, ILanguageProfileService languageProfileService, Logger logger)
 {
     _episodeRepository      = episodeRepository;
     _qualityProfileService  = qualityProfileService;
     _languageProfileService = languageProfileService;
 }