New: Per download client setting to Remove Completed/Failed downloads instead of global setting

(cherry picked from commit 2dba5ef4b431bee0a061be67354c9a7a612a03c8)
pull/2682/head
Taloth Saldono 4 years ago committed by Bogdan
parent e5a1b7a72e
commit 8bb52105fd

@ -16,4 +16,9 @@
color: var(--textColor); color: var(--textColor);
font-size: 21px; font-size: 21px;
line-height: inherit; line-height: inherit;
&.small {
color: #909293;
font-size: 18px;
}
} }

@ -3,6 +3,7 @@
interface CssExports { interface CssExports {
'fieldSet': string; 'fieldSet': string;
'legend': string; 'legend': string;
'small': string;
} }
export const cssExports: CssExports; export const cssExports: CssExports;
export default cssExports; export default cssExports;

@ -1,5 +1,7 @@
import classNames from 'classnames';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import React, { Component } from 'react'; import React, { Component } from 'react';
import { sizes } from 'Helpers/Props';
import styles from './FieldSet.css'; import styles from './FieldSet.css';
class FieldSet extends Component { class FieldSet extends Component {
@ -9,13 +11,14 @@ class FieldSet extends Component {
render() { render() {
const { const {
size,
legend, legend,
children children
} = this.props; } = this.props;
return ( return (
<fieldset className={styles.fieldSet}> <fieldset className={styles.fieldSet}>
<legend className={styles.legend}> <legend className={classNames(styles.legend, (size === sizes.SMALL) && styles.small)}>
{legend} {legend}
</legend> </legend>
{children} {children}
@ -26,8 +29,13 @@ class FieldSet extends Component {
} }
FieldSet.propTypes = { FieldSet.propTypes = {
size: PropTypes.oneOf(sizes.all).isRequired,
legend: PropTypes.oneOfType([PropTypes.node, PropTypes.string]), legend: PropTypes.oneOfType([PropTypes.node, PropTypes.string]),
children: PropTypes.node children: PropTypes.node
}; };
FieldSet.defaultProps = {
size: sizes.MEDIUM
};
export default FieldSet; export default FieldSet;

@ -1,6 +1,7 @@
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import React, { Component } from 'react'; import React, { Component } from 'react';
import Alert from 'Components/Alert'; import Alert from 'Components/Alert';
import FieldSet from 'Components/FieldSet';
import Form from 'Components/Form/Form'; import Form from 'Components/Form/Form';
import FormGroup from 'Components/Form/FormGroup'; import FormGroup from 'Components/Form/FormGroup';
import FormInputGroup from 'Components/Form/FormInputGroup'; import FormInputGroup from 'Components/Form/FormInputGroup';
@ -13,7 +14,7 @@ import ModalBody from 'Components/Modal/ModalBody';
import ModalContent from 'Components/Modal/ModalContent'; import ModalContent from 'Components/Modal/ModalContent';
import ModalFooter from 'Components/Modal/ModalFooter'; import ModalFooter from 'Components/Modal/ModalFooter';
import ModalHeader from 'Components/Modal/ModalHeader'; import ModalHeader from 'Components/Modal/ModalHeader';
import { inputTypes, kinds } from 'Helpers/Props'; import { inputTypes, kinds, sizes } from 'Helpers/Props';
import translate from 'Utilities/String/translate'; import translate from 'Utilities/String/translate';
import styles from './EditDownloadClientModalContent.css'; import styles from './EditDownloadClientModalContent.css';
@ -45,7 +46,10 @@ class EditDownloadClientModalContent extends Component {
implementationName, implementationName,
name, name,
enable, enable,
protocol,
priority, priority,
removeCompletedDownloads,
removeFailedDownloads,
fields, fields,
message message
} = item; } = item;
@ -142,6 +146,37 @@ class EditDownloadClientModalContent extends Component {
/> />
</FormGroup> </FormGroup>
<FieldSet
size={sizes.SMALL}
legend={translate('CompletedDownloadHandling')}
>
<FormGroup>
<FormLabel>{translate('RemoveCompleted')}</FormLabel>
<FormInputGroup
type={inputTypes.CHECK}
name="removeCompletedDownloads"
helpText={translate('RemoveCompletedDownloadsHelpText')}
{...removeCompletedDownloads}
onChange={onInputChange}
/>
</FormGroup>
{
protocol.value !== 'torrent' &&
<FormGroup>
<FormLabel>{translate('RemoveFailed')}</FormLabel>
<FormInputGroup
type={inputTypes.CHECK}
name="removeFailedDownloads"
helpText={translate('RemoveFailedDownloadsHelpText')}
{...removeFailedDownloads}
onChange={onInputChange}
/>
</FormGroup>
}
</FieldSet>
</Form> </Form>
} }
</ModalBody> </ModalBody>

@ -35,39 +35,23 @@ function DownloadClientOptions(props) {
} }
{ {
hasSettings && !isFetching && !error && hasSettings && !isFetching && !error && advancedSettings &&
<div> <div>
<FieldSet legend={translate('CompletedDownloadHandling')}> <FieldSet legend={translate('CompletedDownloadHandling')}>
<Form> <Form>
<FormGroup size={sizes.MEDIUM}>
<FormLabel>
{translate('Enable')}
</FormLabel>
<FormInputGroup
type={inputTypes.CHECK}
name="enableCompletedDownloadHandling"
helpText={translate('EnableCompletedDownloadHandlingHelpText')}
onChange={onInputChange}
{...settings.enableCompletedDownloadHandling}
/>
</FormGroup>
<FormGroup <FormGroup
advancedSettings={advancedSettings} advancedSettings={advancedSettings}
isAdvanced={true} isAdvanced={true}
size={sizes.MEDIUM} size={sizes.MEDIUM}
> >
<FormLabel> <FormLabel>{translate('Enable')}</FormLabel>
{translate('Remove')}
</FormLabel>
<FormInputGroup <FormInputGroup
type={inputTypes.CHECK} type={inputTypes.CHECK}
name="removeCompletedDownloads" name="enableCompletedDownloadHandling"
helpText={translate('RemoveCompletedDownloadsHelpText')} helpText={translate('EnableCompletedDownloadHandlingHelpText')}
onChange={onInputChange} onChange={onInputChange}
{...settings.removeCompletedDownloads} {...settings.enableCompletedDownloadHandling}
/> />
</FormGroup> </FormGroup>
</Form> </Form>
@ -78,9 +62,7 @@ function DownloadClientOptions(props) {
> >
<Form> <Form>
<FormGroup size={sizes.MEDIUM}> <FormGroup size={sizes.MEDIUM}>
<FormLabel> <FormLabel>{translate('RedownloadFailed')}</FormLabel>
{translate('Redownload')}
</FormLabel>
<FormInputGroup <FormInputGroup
type={inputTypes.CHECK} type={inputTypes.CHECK}
@ -90,25 +72,10 @@ function DownloadClientOptions(props) {
{...settings.autoRedownloadFailed} {...settings.autoRedownloadFailed}
/> />
</FormGroup> </FormGroup>
<FormGroup
advancedSettings={advancedSettings}
isAdvanced={true}
size={sizes.MEDIUM}
>
<FormLabel>
{translate('Remove')}
</FormLabel>
<FormInputGroup
type={inputTypes.CHECK}
name="removeFailedDownloads"
helpText={translate('RemoveFailedDownloadsHelpText')}
onChange={onInputChange}
{...settings.removeFailedDownloads}
/>
</FormGroup>
</Form> </Form>
<Alert kind={kinds.INFO}>
{translate('RemoveDownloadsAlert')}
</Alert>
</FieldSet> </FieldSet>
</div> </div>
} }

@ -0,0 +1,130 @@
using System.Linq;
using FluentAssertions;
using Newtonsoft.Json.Linq;
using NUnit.Framework;
using NzbDrone.Common.Serializer;
using NzbDrone.Core.Datastore.Migration;
using NzbDrone.Core.Download.Clients.RTorrent;
using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.Datastore.Migration
{
[TestFixture]
public class cdh_per_downloadclientFixture : MigrationTest<cdh_per_downloadclient>
{
[Test]
public void should_set_cdh_to_enabled()
{
var db = WithMigrationTestDb(c =>
{
c.Insert.IntoTable("DownloadClients").Row(new
{
Enable = true,
Name = "Deluge",
Implementation = "Deluge",
Priority = 1,
Settings = new DelugeSettings34
{
Host = "127.0.0.1",
TvCategory = "abc",
UrlBase = "/my/"
}.ToJson(),
ConfigContract = "DelugeSettings"
});
});
var items = db.Query<DownloadClientDefinition34>("SELECT * FROM \"DownloadClients\"");
items.Should().HaveCount(1);
items.First().RemoveCompletedDownloads.Should().BeFalse();
items.First().RemoveFailedDownloads.Should().BeTrue();
}
[Test]
public void should_set_cdh_to_disabled_when_globally_disabled()
{
var db = WithMigrationTestDb(c =>
{
c.Insert.IntoTable("Config").Row(new
{
Key = "removecompleteddownloads",
Value = "True"
});
c.Insert.IntoTable("DownloadClients").Row(new
{
Enable = true,
Name = "Deluge",
Implementation = "Deluge",
Priority = 1,
Settings = new DelugeSettings34
{
Host = "127.0.0.1",
TvCategory = "abc",
UrlBase = "/my/"
}.ToJson(),
ConfigContract = "DelugeSettings"
});
});
var items = db.Query<DownloadClientDefinition34>("SELECT * FROM \"DownloadClients\"");
items.Should().HaveCount(1);
items.First().RemoveCompletedDownloads.Should().BeTrue();
items.First().RemoveFailedDownloads.Should().BeTrue();
}
[Test]
public void should_disable_remove_for_existing_rtorrent()
{
var db = WithMigrationTestDb(c =>
{
c.Insert.IntoTable("DownloadClients").Row(new
{
Enable = true,
Name = "RTorrent",
Implementation = "RTorrent",
Priority = 1,
Settings = new RTorrentSettings
{
Host = "127.0.0.1",
MusicCategory = "abc",
UrlBase = "/my/"
}.ToJson(),
ConfigContract = "RTorrentSettings"
});
});
var items = db.Query<DownloadClientDefinition34>("SELECT * FROM \"DownloadClients\"");
items.Should().HaveCount(1);
items.First().RemoveCompletedDownloads.Should().BeFalse();
items.First().RemoveFailedDownloads.Should().BeTrue();
}
}
public class DelugeSettings34
{
public string Host { get; set; }
public int Port { get; set; }
public string UrlBase { get; set; }
public string Password { get; set; }
public string TvCategory { get; set; }
public int RecentTvPriority { get; set; }
public int OlderTvPriority { get; set; }
public bool UseSsl { get; set; }
}
public class DownloadClientDefinition34
{
public int Id { get; set; }
public bool Enable { get; set; }
public int Priority { get; set; }
public string Name { get; set; }
public string Implementation { get; set; }
public JObject Settings { get; set; }
public string ConfigContract { get; set; }
public bool RemoveCompletedDownloads { get; set; }
public bool RemoveFailedDownloads { get; set; }
}
}

@ -137,13 +137,6 @@ namespace NzbDrone.Core.Configuration
set { SetValue("EnableCompletedDownloadHandling", value); } set { SetValue("EnableCompletedDownloadHandling", value); }
} }
public bool RemoveCompletedDownloads
{
get { return GetValueBoolean("RemoveCompletedDownloads", false); }
set { SetValue("RemoveCompletedDownloads", value); }
}
public bool AutoRedownloadFailed public bool AutoRedownloadFailed
{ {
get { return GetValueBoolean("AutoRedownloadFailed", true); } get { return GetValueBoolean("AutoRedownloadFailed", true); }
@ -151,13 +144,6 @@ namespace NzbDrone.Core.Configuration
set { SetValue("AutoRedownloadFailed", value); } set { SetValue("AutoRedownloadFailed", value); }
} }
public bool RemoveFailedDownloads
{
get { return GetValueBoolean("RemoveFailedDownloads", true); }
set { SetValue("RemoveFailedDownloads", value); }
}
public bool CreateEmptyAuthorFolders public bool CreateEmptyAuthorFolders
{ {
get { return GetValueBoolean("CreateEmptyAuthorFolders", false); } get { return GetValueBoolean("CreateEmptyAuthorFolders", false); }

@ -18,10 +18,7 @@ namespace NzbDrone.Core.Configuration
//Completed/Failed Download Handling (Download client) //Completed/Failed Download Handling (Download client)
bool EnableCompletedDownloadHandling { get; set; } bool EnableCompletedDownloadHandling { get; set; }
bool RemoveCompletedDownloads { get; set; }
bool AutoRedownloadFailed { get; set; } bool AutoRedownloadFailed { get; set; }
bool RemoveFailedDownloads { get; set; }
//Media Management //Media Management
bool AutoUnmonitorPreviouslyDownloadedBooks { get; set; } bool AutoUnmonitorPreviouslyDownloadedBooks { get; set; }

@ -0,0 +1,48 @@
using System.Data;
using Dapper;
using FluentMigrator;
using NzbDrone.Core.Datastore.Migration.Framework;
namespace NzbDrone.Core.Datastore.Migration
{
[Migration(158)]
public class cdh_per_downloadclient : NzbDroneMigrationBase
{
protected override void MainDbUpgrade()
{
Alter.Table("DownloadClients")
.AddColumn("RemoveCompletedDownloads").AsBoolean().NotNullable().WithDefaultValue(true)
.AddColumn("RemoveFailedDownloads").AsBoolean().NotNullable().WithDefaultValue(true);
Execute.WithConnection(MoveRemoveSettings);
}
private void MoveRemoveSettings(IDbConnection conn, IDbTransaction tran)
{
var removeCompletedDownloads = false;
var removeFailedDownloads = true;
using (var removeCompletedDownloadsCmd = conn.CreateCommand(tran, "SELECT \"Value\" FROM \"Config\" WHERE \"Key\" = 'removecompleteddownloads'"))
{
if ((removeCompletedDownloadsCmd.ExecuteScalar() as string)?.ToLower() == "true")
{
removeCompletedDownloads = true;
}
}
using (var removeFailedDownloadsCmd = conn.CreateCommand(tran, "SELECT \"Value\" FROM \"Config\" WHERE \"Key\" = 'removefaileddownloads'"))
{
if ((removeFailedDownloadsCmd.ExecuteScalar() as string)?.ToLower() == "false")
{
removeFailedDownloads = false;
}
}
var parameters = new { RemoveFailedDownloads = removeFailedDownloads, RemoveCompletedDownloads = removeCompletedDownloads };
var updateSql = $"UPDATE \"DownloadClients\" SET \"RemoveCompletedDownloads\" = (CASE WHEN \"Implementation\" IN ('RTorrent', 'Flood') THEN 'false' ELSE @RemoveCompletedDownloads END), \"RemoveFailedDownloads\" = @RemoveFailedDownloads";
conn.Execute(updateSql, parameters, transaction: tran);
conn.Execute("DELETE FROM \"Config\" WHERE \"Key\" IN ('removecompleteddownloads', 'removefaileddownloads')");
}
}
}

@ -1,4 +1,5 @@
using FluentMigrator; using System.Data;
using FluentMigrator;
using FluentMigrator.Builders.Create; using FluentMigrator.Builders.Create;
using FluentMigrator.Builders.Create.Table; using FluentMigrator.Builders.Create.Table;
using FluentMigrator.Runner; using FluentMigrator.Runner;
@ -16,7 +17,16 @@ namespace NzbDrone.Core.Datastore.Migration.Framework
return expressionRoot.Table(name).WithColumn("Id").AsInt32().PrimaryKey().Identity(); return expressionRoot.Table(name).WithColumn("Id").AsInt32().PrimaryKey().Identity();
} }
public static void AddParameter(this System.Data.IDbCommand command, object value) public static IDbCommand CreateCommand(this IDbConnection conn, IDbTransaction tran, string query)
{
var command = conn.CreateCommand();
command.Transaction = tran;
command.CommandText = query;
return command;
}
public static void AddParameter(this IDbCommand command, object value)
{ {
var parameter = command.CreateParameter(); var parameter = command.CreateParameter();
parameter.Value = value; parameter.Value = value;

@ -7,5 +7,8 @@ namespace NzbDrone.Core.Download
{ {
public DownloadProtocol Protocol { get; set; } public DownloadProtocol Protocol { get; set; }
public int Priority { get; set; } = 1; public int Priority { get; set; } = 1;
public bool RemoveCompletedDownloads { get; set; } = true;
public bool RemoveFailedDownloads { get; set; } = true;
} }
} }

@ -27,38 +27,65 @@ namespace NzbDrone.Core.Download
{ {
var trackedDownload = message.TrackedDownload; var trackedDownload = message.TrackedDownload;
if (trackedDownload == null || !trackedDownload.DownloadItem.CanBeRemoved || _configService.RemoveFailedDownloads == false) if (trackedDownload == null ||
message.TrackedDownload.DownloadItem.Removed ||
!trackedDownload.DownloadItem.CanBeRemoved)
{ {
return; return;
} }
RemoveFromDownloadClient(trackedDownload); var downloadClient = _downloadClientProvider.Get(message.TrackedDownload.DownloadClient);
var definition = downloadClient.Definition as DownloadClientDefinition;
if (!definition.RemoveFailedDownloads)
{
return;
}
RemoveFromDownloadClient(trackedDownload, downloadClient);
} }
public void Handle(DownloadCompletedEvent message) public void Handle(DownloadCompletedEvent message)
{ {
if (_configService.RemoveCompletedDownloads && var trackedDownload = message.TrackedDownload;
!message.TrackedDownload.DownloadItem.Removed && var downloadClient = _downloadClientProvider.Get(trackedDownload.DownloadClient);
message.TrackedDownload.DownloadItem.CanBeRemoved && var definition = downloadClient.Definition as DownloadClientDefinition;
message.TrackedDownload.DownloadItem.Status != DownloadItemStatus.Downloading)
MarkItemAsImported(trackedDownload, downloadClient);
if (trackedDownload.DownloadItem.Removed ||
!trackedDownload.DownloadItem.CanBeRemoved ||
trackedDownload.DownloadItem.Status == DownloadItemStatus.Downloading)
{ {
RemoveFromDownloadClient(message.TrackedDownload); return;
} }
else
if (!definition.RemoveCompletedDownloads)
{ {
MarkItemAsImported(message.TrackedDownload); return;
} }
RemoveFromDownloadClient(message.TrackedDownload, downloadClient);
} }
public void Handle(DownloadCanBeRemovedEvent message) public void Handle(DownloadCanBeRemovedEvent message)
{ {
// Already verified that it can be removed, just needs to be removed var trackedDownload = message.TrackedDownload;
RemoveFromDownloadClient(message.TrackedDownload); var downloadClient = _downloadClientProvider.Get(trackedDownload.DownloadClient);
var definition = downloadClient.Definition as DownloadClientDefinition;
if (trackedDownload.DownloadItem.Removed ||
!trackedDownload.DownloadItem.CanBeRemoved ||
!definition.RemoveCompletedDownloads)
{
return;
}
RemoveFromDownloadClient(message.TrackedDownload, downloadClient);
} }
private void RemoveFromDownloadClient(TrackedDownload trackedDownload) private void RemoveFromDownloadClient(TrackedDownload trackedDownload, IDownloadClient downloadClient)
{ {
var downloadClient = _downloadClientProvider.Get(trackedDownload.DownloadClient);
try try
{ {
_logger.Debug("[{0}] Removing download from {1} history", trackedDownload.DownloadItem.Title, trackedDownload.DownloadItem.DownloadClientInfo.Name); _logger.Debug("[{0}] Removing download from {1} history", trackedDownload.DownloadItem.Title, trackedDownload.DownloadItem.DownloadClientInfo.Name);
@ -75,9 +102,8 @@ namespace NzbDrone.Core.Download
} }
} }
private void MarkItemAsImported(TrackedDownload trackedDownload) private void MarkItemAsImported(TrackedDownload trackedDownload, IDownloadClient downloadClient)
{ {
var downloadClient = _downloadClientProvider.Get(trackedDownload.DownloadClient);
try try
{ {
_logger.Debug("[{0}] Marking download as imported from {1}", trackedDownload.DownloadItem.Title, trackedDownload.DownloadItem.DownloadClientInfo.Name); _logger.Debug("[{0}] Marking download as imported from {1}", trackedDownload.DownloadItem.Title, trackedDownload.DownloadItem.DownloadClientInfo.Name);

@ -47,7 +47,6 @@ namespace NzbDrone.Core.Download
public void Execute(ProcessMonitoredDownloadsCommand message) public void Execute(ProcessMonitoredDownloadsCommand message)
{ {
var enableCompletedDownloadHandling = _configService.EnableCompletedDownloadHandling; var enableCompletedDownloadHandling = _configService.EnableCompletedDownloadHandling;
var removeCompletedDownloads = _configService.RemoveCompletedDownloads;
var trackedDownloads = _trackedDownloadService.GetTrackedDownloads() var trackedDownloads = _trackedDownloadService.GetTrackedDownloads()
.Where(t => t.IsTrackable) .Where(t => t.IsTrackable)
.ToList(); .ToList();
@ -72,10 +71,7 @@ namespace NzbDrone.Core.Download
} }
// Imported downloads are no longer trackable so process them after processing trackable downloads // Imported downloads are no longer trackable so process them after processing trackable downloads
if (removeCompletedDownloads)
{
RemoveCompletedDownloads(); RemoveCompletedDownloads();
}
_eventAggregator.PublishEvent(new DownloadsProcessedEvent()); _eventAggregator.PublishEvent(new DownloadsProcessedEvent());
} }

@ -625,6 +625,7 @@
"RecyclingBin": "Recycling Bin", "RecyclingBin": "Recycling Bin",
"RecyclingBinCleanup": "Recycling Bin Cleanup", "RecyclingBinCleanup": "Recycling Bin Cleanup",
"Redownload": "Redownload", "Redownload": "Redownload",
"RedownloadFailed": "Redownload Failed",
"Refresh": "Refresh", "Refresh": "Refresh",
"RefreshAndScan": "Refresh & Scan", "RefreshAndScan": "Refresh & Scan",
"RefreshAuthor": "Refresh Author", "RefreshAuthor": "Refresh Author",
@ -656,7 +657,10 @@
"RemotePathMappingCheckWrongOSPath": "Remote download client {0} places downloads in {1} but this is not a valid {2} path. Review your remote path mappings and download client settings.", "RemotePathMappingCheckWrongOSPath": "Remote download client {0} places downloads in {1} but this is not a valid {2} path. Review your remote path mappings and download client settings.",
"RemotePathMappings": "Remote Path Mappings", "RemotePathMappings": "Remote Path Mappings",
"Remove": "Remove", "Remove": "Remove",
"RemoveCompleted": "Remove Completed",
"RemoveCompletedDownloadsHelpText": "Remove imported downloads from download client history", "RemoveCompletedDownloadsHelpText": "Remove imported downloads from download client history",
"RemoveDownloadsAlert": "The Remove settings were moved to the individual Download Client settings in the table above.",
"RemoveFailed": "Remove Failed",
"RemoveFailedDownloadsHelpText": "Remove failed downloads from download client history", "RemoveFailedDownloadsHelpText": "Remove failed downloads from download client history",
"RemoveFilter": "Remove filter", "RemoveFilter": "Remove filter",
"RemoveFromBlocklist": "Remove from blocklist", "RemoveFromBlocklist": "Remove from blocklist",

@ -8,10 +8,7 @@ namespace Readarr.Api.V1.Config
public string DownloadClientWorkingFolders { get; set; } public string DownloadClientWorkingFolders { get; set; }
public bool EnableCompletedDownloadHandling { get; set; } public bool EnableCompletedDownloadHandling { get; set; }
public bool RemoveCompletedDownloads { get; set; }
public bool AutoRedownloadFailed { get; set; } public bool AutoRedownloadFailed { get; set; }
public bool RemoveFailedDownloads { get; set; }
} }
public static class DownloadClientConfigResourceMapper public static class DownloadClientConfigResourceMapper
@ -23,10 +20,7 @@ namespace Readarr.Api.V1.Config
DownloadClientWorkingFolders = model.DownloadClientWorkingFolders, DownloadClientWorkingFolders = model.DownloadClientWorkingFolders,
EnableCompletedDownloadHandling = model.EnableCompletedDownloadHandling, EnableCompletedDownloadHandling = model.EnableCompletedDownloadHandling,
RemoveCompletedDownloads = model.RemoveCompletedDownloads, AutoRedownloadFailed = model.AutoRedownloadFailed
AutoRedownloadFailed = model.AutoRedownloadFailed,
RemoveFailedDownloads = model.RemoveFailedDownloads
}; };
} }
} }

@ -8,6 +8,8 @@ namespace Readarr.Api.V1.DownloadClient
public bool Enable { get; set; } public bool Enable { get; set; }
public DownloadProtocol Protocol { get; set; } public DownloadProtocol Protocol { get; set; }
public int Priority { get; set; } public int Priority { get; set; }
public bool RemoveCompletedDownloads { get; set; }
public bool RemoveFailedDownloads { get; set; }
} }
public class DownloadClientResourceMapper : ProviderResourceMapper<DownloadClientResource, DownloadClientDefinition> public class DownloadClientResourceMapper : ProviderResourceMapper<DownloadClientResource, DownloadClientDefinition>
@ -24,6 +26,8 @@ namespace Readarr.Api.V1.DownloadClient
resource.Enable = definition.Enable; resource.Enable = definition.Enable;
resource.Protocol = definition.Protocol; resource.Protocol = definition.Protocol;
resource.Priority = definition.Priority; resource.Priority = definition.Priority;
resource.RemoveCompletedDownloads = definition.RemoveCompletedDownloads;
resource.RemoveFailedDownloads = definition.RemoveFailedDownloads;
return resource; return resource;
} }
@ -40,6 +44,8 @@ namespace Readarr.Api.V1.DownloadClient
definition.Enable = resource.Enable; definition.Enable = resource.Enable;
definition.Protocol = resource.Protocol; definition.Protocol = resource.Protocol;
definition.Priority = resource.Priority; definition.Priority = resource.Priority;
definition.RemoveCompletedDownloads = resource.RemoveCompletedDownloads;
definition.RemoveFailedDownloads = resource.RemoveFailedDownloads;
return definition; return definition;
} }

Loading…
Cancel
Save