New: Allow keeping calibre in sync with goodreads

This commit is contained in:
ta264
2021-03-30 21:24:40 +01:00
parent 7072b913a6
commit f584d2d8d2
14 changed files with 152 additions and 57 deletions
@@ -1,7 +1,10 @@
using System.Linq;
using System.Reflection;
using FluentValidation;
using Microsoft.AspNetCore.Mvc;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Validation;
using NzbDrone.Http.REST.Attributes;
using Readarr.Http;
using Readarr.Http.REST;
@@ -19,6 +22,8 @@ namespace Prowlarr.Api.V1.Config
{
_configFileProvider = configFileProvider;
_configService = configService;
SharedValidator.RuleFor(c => c.MetadataSource).IsValidUrl().When(c => !c.MetadataSource.IsNullOrWhiteSpace());
}
public override DevelopmentConfigResource GetResourceById(int id)
@@ -5,6 +5,7 @@ namespace Prowlarr.Api.V1.Config
{
public class DevelopmentConfigResource : RestResource
{
public string MetadataSource { get; set; }
public string ConsoleLogLevel { get; set; }
public bool LogSql { get; set; }
public int LogRotate { get; set; }
@@ -17,6 +18,7 @@ namespace Prowlarr.Api.V1.Config
{
return new DevelopmentConfigResource
{
MetadataSource = configService.MetadataSource,
ConsoleLogLevel = model.ConsoleLogLevel,
LogSql = model.LogSql,
LogRotate = model.LogRotate,
@@ -1,7 +1,4 @@
using FluentValidation;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Validation;
using Readarr.Http;
namespace Readarr.Api.V1.Config
@@ -12,7 +9,6 @@ namespace Readarr.Api.V1.Config
public MetadataProviderConfigController(IConfigService configService)
: base(configService)
{
SharedValidator.RuleFor(c => c.MetadataSource).IsValidUrl().When(c => !c.MetadataSource.IsNullOrWhiteSpace());
}
protected override MetadataProviderConfigResource ToResource(IConfigService model)
@@ -5,9 +5,9 @@ namespace Readarr.Api.V1.Config
{
public class MetadataProviderConfigResource : RestResource
{
public string MetadataSource { get; set; }
public WriteAudioTagsType WriteAudioTags { get; set; }
public bool ScrubAudioTags { get; set; }
public WriteBookTagsType WriteBookTags { get; set; }
public bool UpdateCovers { get; set; }
public bool EmbedMetadata { get; set; }
}
public static class MetadataProviderConfigResourceMapper
@@ -16,9 +16,9 @@ namespace Readarr.Api.V1.Config
{
return new MetadataProviderConfigResource
{
MetadataSource = model.MetadataSource,
WriteAudioTags = model.WriteAudioTags,
ScrubAudioTags = model.ScrubAudioTags,
WriteBookTags = model.WriteBookTags,
UpdateCovers = model.UpdateCovers,
EmbedMetadata = model.EmbedMetadata
};
}
}