protected ValidationFailure TestOutputPath() { try { var downloadDir = GetDefaultDir(); if (downloadDir == null) { return(new NzbDroneValidationFailure(nameof(Settings.TvDirectory), "No default destination") { DetailedDescription = $"You must login into your Diskstation as {Settings.Username} and manually set it up into DownloadStation settings under BT/HTTP/FTP/NZB -> Location." }); } downloadDir = GetDownloadDirectory(); if (downloadDir != null) { var sharedFolder = downloadDir.Split('\\', '/')[0]; var fieldName = Settings.TvDirectory.IsNotNullOrWhiteSpace() ? nameof(Settings.TvDirectory) : nameof(Settings.MusicCategory); var folderInfo = _fileStationProxy.GetInfoFileOrDirectory($"/{downloadDir}", Settings); if (folderInfo.Additional == null) { return(new NzbDroneValidationFailure(fieldName, $"Shared folder does not exist") { DetailedDescription = $"The Diskstation does not have a Shared Folder with the name '{sharedFolder}', are you sure you specified it correctly?" }); } if (!folderInfo.IsDir) { return(new NzbDroneValidationFailure(fieldName, $"Folder does not exist") { DetailedDescription = $"The folder '{downloadDir}' does not exist, it must be created manually inside the Shared Folder '{sharedFolder}'." }); } } return(null); } catch (DownloadClientAuthenticationException ex) { // User could not have permission to access to downloadstation _logger.Error(ex, "Unable to authenticate"); return(new NzbDroneValidationFailure(string.Empty, ex.Message)); } catch (Exception ex) { _logger.Error(ex, "Error testing Torrent Download Station"); return(new NzbDroneValidationFailure(string.Empty, $"Unknown exception: {ex.Message}")); } }
protected ValidationFailure TestOutputPath() { try { var downloadDir = GetDownloadDirectory(); if (downloadDir != null) { var sharedFolder = downloadDir.Split('\\', '/')[0]; var fieldName = Settings.TvDirectory.IsNotNullOrWhiteSpace() ? nameof(Settings.TvDirectory) : nameof(Settings.TvCategory); var folderInfo = _fileStationProxy.GetInfoFileOrDirectory($"/{downloadDir}", Settings); if (folderInfo.Additional == null) { return(new NzbDroneValidationFailure(fieldName, $"Shared folder does not exist") { DetailedDescription = $"The DownloadStation does not have a Shared Folder with the name '{sharedFolder}', are you sure you specified it correctly?" }); } if (!folderInfo.IsDir) { return(new NzbDroneValidationFailure(fieldName, $"Folder does not exist") { DetailedDescription = $"The folder '{downloadDir}' does not exist, it must be created manually inside the Shared Folder '{sharedFolder}'." }); } } return(null); } catch (Exception ex) { _logger.Error(ex); return(new NzbDroneValidationFailure(string.Empty, $"Unknown exception: {ex.Message}")); } }