mirror of
https://github.com/Readarr/Readarr
synced 2026-01-06 15:43:19 +01:00
Fixed: Validate calibre connection before saving root folder
This commit is contained in:
parent
d2fa75dee5
commit
8781b78be9
1 changed files with 13 additions and 0 deletions
|
|
@ -2,11 +2,15 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
using NLog;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Common.Http;
|
||||
using NzbDrone.Core.Books.Calibre;
|
||||
using NzbDrone.Core.Exceptions;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.MediaFiles.Commands;
|
||||
using NzbDrone.Core.Messaging.Commands;
|
||||
|
|
@ -30,16 +34,19 @@ public class RootFolderService : IRootFolderService
|
|||
{
|
||||
private readonly IRootFolderRepository _rootFolderRepository;
|
||||
private readonly IDiskProvider _diskProvider;
|
||||
private readonly ICalibreProxy _calibreProxy;
|
||||
private readonly IManageCommandQueue _commandQueueManager;
|
||||
private readonly Logger _logger;
|
||||
|
||||
public RootFolderService(IRootFolderRepository rootFolderRepository,
|
||||
ICalibreProxy calibreProxy,
|
||||
IDiskProvider diskProvider,
|
||||
IManageCommandQueue commandQueueManager,
|
||||
Logger logger)
|
||||
{
|
||||
_rootFolderRepository = rootFolderRepository;
|
||||
_diskProvider = diskProvider;
|
||||
_calibreProxy = calibreProxy;
|
||||
_commandQueueManager = commandQueueManager;
|
||||
_logger = logger;
|
||||
}
|
||||
|
|
@ -91,6 +98,12 @@ private void VerifyRootFolder(RootFolder rootFolder)
|
|||
{
|
||||
throw new UnauthorizedAccessException(string.Format("Root folder path '{0}' is not writable by user '{1}'", rootFolder.Path, Environment.UserName));
|
||||
}
|
||||
|
||||
if (rootFolder.IsCalibreLibrary)
|
||||
{
|
||||
// This will throw on failure
|
||||
_calibreProxy.GetLibraryInfo(rootFolder.CalibreSettings);
|
||||
}
|
||||
}
|
||||
|
||||
public RootFolder Add(RootFolder rootFolder)
|
||||
|
|
|
|||
Loading…
Reference in a new issue