You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
2.0 KiB
58 lines
2.0 KiB
7 years ago
|
using NzbDrone.Core.ImportLists;
|
||
|
|
||
5 years ago
|
namespace Readarr.Api.V1.ImportLists
|
||
7 years ago
|
{
|
||
|
public class ImportListResource : ProviderResource
|
||
|
{
|
||
|
public bool EnableAutomaticAdd { get; set; }
|
||
5 years ago
|
public ImportListMonitorType ShouldMonitor { get; set; }
|
||
7 years ago
|
public string RootFolderPath { get; set; }
|
||
7 years ago
|
public int QualityProfileId { get; set; }
|
||
7 years ago
|
public int MetadataProfileId { get; set; }
|
||
5 years ago
|
public ImportListType ListType { get; set; }
|
||
5 years ago
|
public int ListOrder { get; set; }
|
||
7 years ago
|
}
|
||
|
|
||
|
public class ImportListResourceMapper : ProviderResourceMapper<ImportListResource, ImportListDefinition>
|
||
|
{
|
||
|
public override ImportListResource ToResource(ImportListDefinition definition)
|
||
|
{
|
||
|
if (definition == null)
|
||
|
{
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
var resource = base.ToResource(definition);
|
||
5 years ago
|
|
||
7 years ago
|
resource.EnableAutomaticAdd = definition.EnableAutomaticAdd;
|
||
|
resource.ShouldMonitor = definition.ShouldMonitor;
|
||
|
resource.RootFolderPath = definition.RootFolderPath;
|
||
7 years ago
|
resource.QualityProfileId = definition.ProfileId;
|
||
7 years ago
|
resource.MetadataProfileId = definition.MetadataProfileId;
|
||
5 years ago
|
resource.ListType = definition.ListType;
|
||
5 years ago
|
resource.ListOrder = (int)definition.ListType;
|
||
7 years ago
|
|
||
|
return resource;
|
||
|
}
|
||
|
|
||
|
public override ImportListDefinition ToModel(ImportListResource resource)
|
||
|
{
|
||
|
if (resource == null)
|
||
|
{
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
var definition = base.ToModel(resource);
|
||
5 years ago
|
|
||
7 years ago
|
definition.EnableAutomaticAdd = resource.EnableAutomaticAdd;
|
||
|
definition.ShouldMonitor = resource.ShouldMonitor;
|
||
|
definition.RootFolderPath = resource.RootFolderPath;
|
||
7 years ago
|
definition.ProfileId = resource.QualityProfileId;
|
||
7 years ago
|
definition.MetadataProfileId = resource.MetadataProfileId;
|
||
5 years ago
|
definition.ListType = resource.ListType;
|
||
7 years ago
|
|
||
|
return definition;
|
||
|
}
|
||
|
}
|
||
|
}
|