2017-12-02 05:03:12 +00:00
|
|
|
using NzbDrone.Core.Indexers;
|
2017-09-04 02:20:56 +00:00
|
|
|
|
2017-10-31 01:28:29 +00:00
|
|
|
namespace Lidarr.Api.V1.Indexers
|
2017-09-04 02:20:56 +00:00
|
|
|
{
|
2021-04-26 20:56:39 +00:00
|
|
|
public class IndexerResource : ProviderResource<IndexerResource>
|
2017-09-04 02:20:56 +00:00
|
|
|
{
|
|
|
|
public bool EnableRss { get; set; }
|
2017-12-02 05:03:12 +00:00
|
|
|
public bool EnableAutomaticSearch { get; set; }
|
|
|
|
public bool EnableInteractiveSearch { get; set; }
|
2017-09-04 02:20:56 +00:00
|
|
|
public bool SupportsRss { get; set; }
|
|
|
|
public bool SupportsSearch { get; set; }
|
2022-07-19 20:08:53 +00:00
|
|
|
public string Protocol { get; set; }
|
2020-09-10 22:04:53 +00:00
|
|
|
public int Priority { get; set; }
|
2022-06-07 03:06:40 +00:00
|
|
|
public int DownloadClientId { get; set; }
|
2017-09-04 02:20:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public class IndexerResourceMapper : ProviderResourceMapper<IndexerResource, IndexerDefinition>
|
|
|
|
{
|
|
|
|
public override IndexerResource ToResource(IndexerDefinition definition)
|
|
|
|
{
|
2020-01-03 12:49:24 +00:00
|
|
|
if (definition == null)
|
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
2017-09-04 02:20:56 +00:00
|
|
|
|
|
|
|
var resource = base.ToResource(definition);
|
|
|
|
|
|
|
|
resource.EnableRss = definition.EnableRss;
|
2017-12-02 05:03:12 +00:00
|
|
|
resource.EnableAutomaticSearch = definition.EnableAutomaticSearch;
|
|
|
|
resource.EnableInteractiveSearch = definition.EnableInteractiveSearch;
|
2017-09-04 02:20:56 +00:00
|
|
|
resource.SupportsRss = definition.SupportsRss;
|
|
|
|
resource.SupportsSearch = definition.SupportsSearch;
|
|
|
|
resource.Protocol = definition.Protocol;
|
2020-09-10 22:04:53 +00:00
|
|
|
resource.Priority = definition.Priority;
|
2022-06-07 03:06:40 +00:00
|
|
|
resource.DownloadClientId = definition.DownloadClientId;
|
2017-09-04 02:20:56 +00:00
|
|
|
|
|
|
|
return resource;
|
|
|
|
}
|
|
|
|
|
2022-05-24 03:41:50 +00:00
|
|
|
public override IndexerDefinition ToModel(IndexerResource resource, IndexerDefinition existingDefinition)
|
2017-09-04 02:20:56 +00:00
|
|
|
{
|
2020-01-03 12:49:24 +00:00
|
|
|
if (resource == null)
|
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
2017-09-04 02:20:56 +00:00
|
|
|
|
2022-05-24 03:41:50 +00:00
|
|
|
var definition = base.ToModel(resource, existingDefinition);
|
2017-09-04 02:20:56 +00:00
|
|
|
|
|
|
|
definition.EnableRss = resource.EnableRss;
|
2017-12-02 05:03:12 +00:00
|
|
|
definition.EnableAutomaticSearch = resource.EnableAutomaticSearch;
|
|
|
|
definition.EnableInteractiveSearch = resource.EnableInteractiveSearch;
|
2020-09-10 22:04:53 +00:00
|
|
|
definition.Priority = resource.Priority;
|
2022-06-07 03:06:40 +00:00
|
|
|
definition.DownloadClientId = resource.DownloadClientId;
|
2017-09-04 02:20:56 +00:00
|
|
|
|
|
|
|
return definition;
|
|
|
|
}
|
|
|
|
}
|
2017-12-02 05:03:12 +00:00
|
|
|
}
|