Exemple #1
0
        public DiskScanService(IConfigService configService,
                               IDiskProvider diskProvider,
                               ICalibreProxy calibre,
                               IMediaFileService mediaFileService,
                               IMakeImportDecision importDecisionMaker,
                               IImportApprovedBooks importApprovedTracks,
                               IAuthorService authorService,
                               IRootFolderService rootFolderService,
                               IMediaFileTableCleanupService mediaFileTableCleanupService,
                               IEventAggregator eventAggregator,
                               Logger logger)
        {
            _configService = configService;
            _diskProvider  = diskProvider;
            _calibre       = calibre;

            _mediaFileService             = mediaFileService;
            _importDecisionMaker          = importDecisionMaker;
            _importApprovedTracks         = importApprovedTracks;
            _authorService                = authorService;
            _mediaFileTableCleanupService = mediaFileTableCleanupService;
            _rootFolderService            = rootFolderService;
            _eventAggregator              = eventAggregator;
            _logger = logger;
        }
        public RootFolderModule(IRootFolderService rootFolderService,
                                ICalibreProxy calibreProxy,
                                IBroadcastSignalRMessage signalRBroadcaster,
                                RootFolderValidator rootFolderValidator,
                                PathExistsValidator pathExistsValidator,
                                MappedNetworkDriveValidator mappedNetworkDriveValidator,
                                StartupFolderValidator startupFolderValidator,
                                SystemFolderValidator systemFolderValidator,
                                FolderWritableValidator folderWritableValidator,
                                QualityProfileExistsValidator qualityProfileExistsValidator,
                                MetadataProfileExistsValidator metadataProfileExistsValidator)
            : base(signalRBroadcaster)
        {
            _rootFolderService = rootFolderService;
            _calibreProxy      = calibreProxy;

            GetResourceAll  = GetRootFolders;
            GetResourceById = GetRootFolder;
            CreateResource  = CreateRootFolder;
            UpdateResource  = UpdateRootFolder;
            DeleteResource  = DeleteFolder;

            SharedValidator.RuleFor(c => c.Path)
            .Cascade(CascadeMode.StopOnFirstFailure)
            .IsValidPath()
            .SetValidator(mappedNetworkDriveValidator)
            .SetValidator(startupFolderValidator)
            .SetValidator(pathExistsValidator)
            .SetValidator(systemFolderValidator)
            .SetValidator(folderWritableValidator);

            PostValidator.RuleFor(c => c.Path)
            .SetValidator(rootFolderValidator);

            SharedValidator.RuleFor(c => c)
            .Must(x => CalibreLibraryOnlyUsedOnce(x))
            .When(x => x.IsCalibreLibrary)
            .WithMessage("Calibre library is already configured as a root folder");

            SharedValidator.RuleFor(c => c.Name)
            .NotEmpty();

            SharedValidator.RuleFor(c => c.DefaultMetadataProfileId)
            .SetValidator(metadataProfileExistsValidator);

            SharedValidator.RuleFor(c => c.DefaultQualityProfileId)
            .SetValidator(qualityProfileExistsValidator);

            SharedValidator.RuleFor(c => c.Host).ValidHost().When(x => x.IsCalibreLibrary);
            SharedValidator.RuleFor(c => c.Port).InclusiveBetween(1, 65535).When(x => x.IsCalibreLibrary);
            SharedValidator.RuleFor(c => c.UrlBase).ValidUrlBase().When(c => c.UrlBase.IsNotNullOrWhiteSpace());
            SharedValidator.RuleFor(c => c.Username).NotEmpty().When(c => !string.IsNullOrWhiteSpace(c.Password));
            SharedValidator.RuleFor(c => c.Password).NotEmpty().When(c => !string.IsNullOrWhiteSpace(c.Username));

            SharedValidator.RuleFor(c => c.OutputFormat).Must(x => x.Split(',').All(y => Enum.TryParse <CalibreFormat>(y, true, out _))).When(x => x.OutputFormat.IsNotNullOrWhiteSpace()).WithMessage("Invalid output formats");
            SharedValidator.RuleFor(c => c.OutputProfile).IsEnumName(typeof(CalibreProfile));
        }
 public CalibreRootFolderCheck(IDiskProvider diskProvider,
                               IRootFolderService rootFolderService,
                               ICalibreProxy calibreProxy,
                               IOsInfo osInfo,
                               Logger logger)
 {
     _diskProvider      = diskProvider;
     _rootFolderService = rootFolderService;
     _calibreProxy      = calibreProxy;
     _logger            = logger;
     _osInfo            = osInfo;
 }
Exemple #4
0
 public RootFolderService(IRootFolderRepository rootFolderRepository,
                          ICalibreProxy calibreProxy,
                          IDiskProvider diskProvider,
                          IManageCommandQueue commandQueueManager,
                          Logger logger)
 {
     _rootFolderRepository = rootFolderRepository;
     _diskProvider         = diskProvider;
     _calibreProxy         = calibreProxy;
     _commandQueueManager  = commandQueueManager;
     _logger = logger;
 }
Exemple #5
0
        public EBookTagService(IAuthorService authorService,
                               IMediaFileService mediaFileService,
                               IRootFolderService rootFolderService,
                               IConfigService configService,
                               ICalibreProxy calibre,
                               Logger logger)
        {
            _authorService     = authorService;
            _mediaFileService  = mediaFileService;
            _rootFolderService = rootFolderService;
            _configService     = configService;
            _calibre           = calibre;

            _logger = logger;
        }
Exemple #6
0
 public UpgradeMediaFileService(IRecycleBinProvider recycleBinProvider,
                                IMediaFileService mediaFileService,
                                IMetadataTagService metadataTagService,
                                IMoveBookFiles bookFileMover,
                                IDiskProvider diskProvider,
                                IRootFolderService rootFolderService,
                                ICalibreProxy calibre,
                                Logger logger)
 {
     _recycleBinProvider = recycleBinProvider;
     _mediaFileService   = mediaFileService;
     _metadataTagService = metadataTagService;
     _bookFileMover      = bookFileMover;
     _diskProvider       = diskProvider;
     _rootFolderService  = rootFolderService;
     _calibre            = calibre;
     _logger             = logger;
 }
 public MediaFileDeletionService(IDiskProvider diskProvider,
                                 IRecycleBinProvider recycleBinProvider,
                                 IMediaFileService mediaFileService,
                                 IAuthorService authorService,
                                 IConfigService configService,
                                 IRootFolderService rootFolderService,
                                 ICalibreProxy calibre,
                                 Logger logger)
 {
     _diskProvider       = diskProvider;
     _recycleBinProvider = recycleBinProvider;
     _mediaFileService   = mediaFileService;
     _authorService      = authorService;
     _configService      = configService;
     _rootFolderService  = rootFolderService;
     _calibre            = calibre;
     _logger             = logger;
 }
 public UpgradeMediaFileService(IConfigService configService,
                                IRecycleBinProvider recycleBinProvider,
                                IMediaFileService mediaFileService,
                                IAudioTagService audioTagService,
                                IMoveBookFiles bookFileMover,
                                IDiskProvider diskProvider,
                                IRootFolderService rootFolderService,
                                IRootFolderWatchingService rootFolderWatchingService,
                                ICalibreProxy calibre,
                                Logger logger)
 {
     _configService             = configService;
     _recycleBinProvider        = recycleBinProvider;
     _mediaFileService          = mediaFileService;
     _audioTagService           = audioTagService;
     _bookFileMover             = bookFileMover;
     _diskProvider              = diskProvider;
     _rootFolderService         = rootFolderService;
     _rootFolderWatchingService = rootFolderWatchingService;
     _calibre = calibre;
     _logger  = logger;
 }