refactor: Remove remnants of RP v1 support

spectre-console-remove-di-hacks
Robert Dailey 8 months ago
parent 0106bc5111
commit 3a7fba2980

@ -1,24 +0,0 @@
using AutoMapper;
using JetBrains.Annotations;
using Recyclarr.Cli.Pipelines.ReleaseProfile.Api.Objects;
namespace Recyclarr.Cli.Pipelines.ReleaseProfile.Api.Mappings;
[UsedImplicitly]
public class SonarrApiObjectMappingProfile : Profile
{
public SonarrApiObjectMappingProfile()
{
CreateMap<SonarrReleaseProfileV1, SonarrReleaseProfile>()
.ForMember(d => d.Ignored, x => x.MapFrom(
s => s.Ignored.Split(',', StringSplitOptions.RemoveEmptyEntries).ToList()))
.ForMember(d => d.Required, x => x.MapFrom(
s => s.Required.Split(',', StringSplitOptions.RemoveEmptyEntries).ToList()));
CreateMap<SonarrReleaseProfile, SonarrReleaseProfileV1>()
.ForMember(d => d.Ignored, x => x.MapFrom(
s => string.Join(',', s.Ignored)))
.ForMember(d => d.Required, x => x.MapFrom(
s => string.Join(',', s.Required)));
}
}

@ -19,24 +19,6 @@ public class SonarrPreferredTerm
public int Score { get; set; }
}
// Retained for supporting versions of Sonarr prior to v3.0.6.1355
// Offending change is here:
// https://github.com/Sonarr/Sonarr/blob/deed85d2f9147e6180014507ef4f5af3695b0c61/src/NzbDrone.Core/Datastore/Migration/162_release_profile_to_array.cs
// The Ignored and Required JSON properties were converted from string -> array in a backward-breaking way.
[UsedImplicitly(ImplicitUseKindFlags.Assign, ImplicitUseTargetFlags.Members)]
public class SonarrReleaseProfileV1
{
public int Id { get; set; }
public bool Enabled { get; set; }
public string Name { get; set; } = "";
public string Required { get; set; } = "";
public string Ignored { get; set; } = "";
public IReadOnlyCollection<SonarrPreferredTerm> Preferred { get; set; } = new List<SonarrPreferredTerm>();
public bool IncludePreferredWhenRenaming { get; set; }
public int IndexerId { get; set; }
public IReadOnlyCollection<int> Tags { get; set; } = new List<int>();
}
[UsedImplicitly(ImplicitUseKindFlags.Assign, ImplicitUseTargetFlags.Members)]
public class SonarrReleaseProfile
{

@ -1,168 +0,0 @@
namespace Recyclarr.Cli.Pipelines.ReleaseProfile.Api.Schemas;
public static class SonarrReleaseProfileSchema
{
public static string V1 =>
"""
{
"definitions": {
"SonarrPreferredTerm": {
"type": [
"object",
"null"
],
"properties": {
"key": {
"type": [
"string",
"null"
]
},
"value": {
"type": "integer"
}
}
}
},
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"enabled": {
"type": "boolean"
},
"name": {
"type": [
"string",
"null"
]
},
"required": {
"type": [
"string",
"null"
]
},
"ignored": {
"type": [
"string",
"null"
]
},
"preferred": {
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/SonarrPreferredTerm"
}
},
"includePreferredWhenRenaming": {
"type": "boolean"
},
"indexerId": {
"type": "integer"
},
"tags": {
"type": [
"array",
"null"
],
"items": {
"type": "integer"
}
}
}
}
""";
public static string V2 =>
"""
{
"definitions": {
"SonarrPreferredTerm": {
"type": [
"object",
"null"
],
"properties": {
"key": {
"type": [
"string",
"null"
]
},
"value": {
"type": "integer"
}
}
}
},
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"enabled": {
"type": "boolean"
},
"name": {
"type": [
"string",
"null"
]
},
"required": {
"type": [
"array",
"null"
],
"items": {
"type": [
"string",
"null"
]
}
},
"ignored": {
"type": [
"array",
"null"
],
"items": {
"type": [
"string",
"null"
]
}
},
"preferred": {
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/SonarrPreferredTerm"
}
},
"includePreferredWhenRenaming": {
"type": "boolean"
},
"indexerId": {
"type": "integer"
},
"tags": {
"type": [
"array",
"null"
],
"items": {
"type": "integer"
}
}
}
}
""";
}
Loading…
Cancel
Save