mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-23 22:25:14 -04:00
[WIP] Additions to custom formats, such as rescanning old files. (#2949)
This commit is contained in:
@@ -3,6 +3,7 @@ using System.Linq;
|
||||
using FluentValidation;
|
||||
using Nancy;
|
||||
using NzbDrone.Api.Extensions;
|
||||
using NzbDrone.Api.Validation;
|
||||
using NzbDrone.Core.CustomFormats;
|
||||
using NzbDrone.Core.Parser;
|
||||
|
||||
@@ -21,7 +22,7 @@ namespace NzbDrone.Api.Qualities
|
||||
SharedValidator.RuleFor(c => c.Name).NotEmpty();
|
||||
SharedValidator.RuleFor(c => c.Name)
|
||||
.Must((v, c) => !_formatService.All().Any(f => f.Name == c && f.Id != v.Id)).WithMessage("Must be unique.");
|
||||
SharedValidator.RuleFor(c => c.FormatTags).Must((v, c) => c.All(s => FormatTag.QualityTagRegex.IsMatch(s))).WithMessage("Invalid format.");
|
||||
SharedValidator.RuleFor(c => c.FormatTags).AreValidFormatTags();
|
||||
SharedValidator.RuleFor(c => c.FormatTags).Must((v, c) =>
|
||||
{
|
||||
var allFormats = _formatService.All();
|
||||
@@ -44,6 +45,8 @@ namespace NzbDrone.Api.Qualities
|
||||
|
||||
CreateResource = Create;
|
||||
|
||||
DeleteResource = Delete;
|
||||
|
||||
Get["/test"] = x => Test();
|
||||
|
||||
Post["/test"] = x => TestWithNewModel();
|
||||
@@ -73,6 +76,11 @@ namespace NzbDrone.Api.Qualities
|
||||
return _formatService.All().ToResource();
|
||||
}
|
||||
|
||||
private void Delete(int id)
|
||||
{
|
||||
_formatService.Delete(id);
|
||||
}
|
||||
|
||||
private Response GetTemplates()
|
||||
{
|
||||
return CustomFormatService.Templates.SelectMany(t =>
|
||||
@@ -107,8 +115,9 @@ namespace NzbDrone.Api.Qualities
|
||||
var resource = ReadResourceFromRequest();
|
||||
|
||||
var model = resource.ToModel();
|
||||
model.Name = model.Name += " (New)";
|
||||
|
||||
var parsed = _parsingService.ParseMovieInfo((string) Request.Query.title, new List<object>{model});
|
||||
var parsed = _parsingService.ParseMovieInfo(queryTitle, new List<object>{model});
|
||||
if (parsed == null)
|
||||
{
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user