mirror of
https://github.com/Radarr/Radarr.git
synced 2024-10-03 22:57:18 +02:00
New: Backend changes for new UI
This commit is contained in:
parent
e9eebd3ce6
commit
65efa15551
@ -1,6 +1,6 @@
|
||||
using FluentAssertions;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Api.ClientSchema;
|
||||
using Radarr.Http.ClientSchema;
|
||||
using NzbDrone.Core.Annotations;
|
||||
using NzbDrone.Test.Common;
|
||||
|
||||
@ -28,8 +28,8 @@ public void schema_should_have_proper_fields()
|
||||
|
||||
var schema = SchemaBuilder.ToSchema(model);
|
||||
|
||||
schema.Should().Contain(c => c.Order == 1 && c.Name == "LastName" && c.Label == "Last Name" && c.HelpText == "Your Last Name" && (string) c.Value == "Poop");
|
||||
schema.Should().Contain(c => c.Order == 0 && c.Name == "FirstName" && c.Label == "First Name" && c.HelpText == "Your First Name" && (string) c.Value == "Bob");
|
||||
schema.Should().Contain(c => c.Order == 1 && c.Name == "lastName" && c.Label == "Last Name" && c.HelpText == "Your Last Name" && (string) c.Value == "Poop");
|
||||
schema.Should().Contain(c => c.Order == 0 && c.Name == "firstName" && c.Label == "First Name" && c.HelpText == "Your First Name" && (string) c.Value == "Bob");
|
||||
}
|
||||
|
||||
}
|
||||
@ -45,4 +45,4 @@ public class TestModel
|
||||
|
||||
public string Other { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>NzbDrone.Api.Test</RootNamespace>
|
||||
<AssemblyName>NzbDrone.Api.Test</AssemblyName>
|
||||
<AssemblyName>Radarr.Api.Test</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
|
||||
@ -92,6 +92,10 @@
|
||||
<Project>{CADDFCE0-7509-4430-8364-2074E1EEFCA2}</Project>
|
||||
<Name>NzbDrone.Test.Common</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Radarr.Http\Radarr.Http.csproj">
|
||||
<Project>{c5953dab-89db-46d9-a401-d620f54b776e}</Project>
|
||||
<Name>Radarr.Http</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\NzbDrone.Test.Common\App.config">
|
||||
|
@ -4,11 +4,11 @@
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("NzbDrone.Api.Test")]
|
||||
[assembly: AssemblyTitle("Radarr.Api.Test")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("NzbDrone.Api.Test")]
|
||||
[assembly: AssemblyProduct("Radarr.Api.Test")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2013")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
@ -1,9 +1,10 @@
|
||||
using NzbDrone.Core.Blacklisting;
|
||||
using NzbDrone.Core.Blacklisting;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using Radarr.Http;
|
||||
|
||||
namespace NzbDrone.Api.Blacklist
|
||||
{
|
||||
public class BlacklistModule : NzbDroneRestModule<BlacklistResource>
|
||||
public class BlacklistModule : RadarrRestModule<BlacklistResource>
|
||||
{
|
||||
private readonly IBlacklistService _blacklistService;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NzbDrone.Api.Movies;
|
||||
using NzbDrone.Api.REST;
|
||||
using Radarr.Http.REST;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using NzbDrone.Core.Indexers;
|
||||
|
||||
|
@ -1,4 +0,0 @@
|
||||
namespace NzbDrone.Api.ClientSchema
|
||||
{
|
||||
|
||||
}
|
@ -1,193 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NzbDrone.Common.EnsureThat;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Common.Reflection;
|
||||
using NzbDrone.Core.Annotations;
|
||||
using NzbDrone.Core.Download.Clients.Nzbget;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using NzbDrone.Core.Profiles;
|
||||
|
||||
namespace NzbDrone.Api.ClientSchema
|
||||
{
|
||||
public static class SchemaBuilder
|
||||
{
|
||||
public static List<Field> ToSchema(object model)
|
||||
{
|
||||
Ensure.That(model, () => model).IsNotNull();
|
||||
|
||||
var properties = model.GetType().GetSimpleProperties();
|
||||
|
||||
var result = new List<Field>(properties.Count);
|
||||
|
||||
foreach (var propertyInfo in properties)
|
||||
{
|
||||
var fieldAttribute = propertyInfo.GetAttribute<FieldDefinitionAttribute>(false);
|
||||
|
||||
if (fieldAttribute != null)
|
||||
{
|
||||
|
||||
var field = new Field
|
||||
{
|
||||
Name = propertyInfo.Name,
|
||||
Label = fieldAttribute.Label,
|
||||
HelpText = fieldAttribute.HelpText,
|
||||
HelpLink = fieldAttribute.HelpLink,
|
||||
Order = fieldAttribute.Order,
|
||||
Advanced = fieldAttribute.Advanced,
|
||||
Type = fieldAttribute.Type.ToString().ToLowerInvariant()
|
||||
};
|
||||
|
||||
var value = propertyInfo.GetValue(model, null);
|
||||
|
||||
if (propertyInfo.PropertyType.HasAttribute<FlagsAttribute>())
|
||||
{
|
||||
int intVal = (int)value;
|
||||
value = Enum.GetValues(propertyInfo.PropertyType)
|
||||
.Cast<int>()
|
||||
.Where(f=> (f & intVal) == f)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
if (value != null)
|
||||
{
|
||||
field.Value = value;
|
||||
}
|
||||
|
||||
if (fieldAttribute.Type == FieldType.Select || fieldAttribute.Type == FieldType.Tag)
|
||||
{
|
||||
field.SelectOptions = GetSelectOptions(fieldAttribute.SelectOptions);
|
||||
}
|
||||
|
||||
result.Add(field);
|
||||
}
|
||||
}
|
||||
|
||||
return result.OrderBy(r => r.Order).ToList();
|
||||
}
|
||||
|
||||
public static object ReadFromSchema(List<Field> fields, Type targetType)
|
||||
{
|
||||
Ensure.That(targetType, () => targetType).IsNotNull();
|
||||
|
||||
var properties = targetType.GetSimpleProperties();
|
||||
|
||||
var target = Activator.CreateInstance(targetType);
|
||||
|
||||
foreach (var propertyInfo in properties)
|
||||
{
|
||||
var fieldAttribute = propertyInfo.GetAttribute<FieldDefinitionAttribute>(false);
|
||||
|
||||
if (fieldAttribute != null)
|
||||
{
|
||||
var field = fields.Find(f => f.Name == propertyInfo.Name);
|
||||
|
||||
if (propertyInfo.PropertyType == typeof(int))
|
||||
{
|
||||
var value = field.Value.ToString().ParseInt32();
|
||||
propertyInfo.SetValue(target, value ?? 0, null);
|
||||
}
|
||||
|
||||
else if (propertyInfo.PropertyType == typeof(long))
|
||||
{
|
||||
var value = field.Value.ToString().ParseInt64();
|
||||
propertyInfo.SetValue(target, value ?? 0, null);
|
||||
}
|
||||
|
||||
else if (propertyInfo.PropertyType == typeof(int?))
|
||||
{
|
||||
var value = field.Value.ToString().ParseInt32();
|
||||
propertyInfo.SetValue(target, value, null);
|
||||
}
|
||||
|
||||
else if (propertyInfo.PropertyType == typeof(Nullable<Int64>))
|
||||
{
|
||||
var value = field.Value.ToString().ParseInt64();
|
||||
propertyInfo.SetValue(target, value, null);
|
||||
}
|
||||
|
||||
else if (propertyInfo.PropertyType == typeof(IEnumerable<int>))
|
||||
{
|
||||
IEnumerable<int> value;
|
||||
|
||||
if (field.Value?.GetType() == typeof(JArray))
|
||||
{
|
||||
value = ((JArray)field.Value).Select(s => s.Value<int>());
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
value = field.Value?.ToString().Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(s => Convert.ToInt32(s));
|
||||
}
|
||||
|
||||
propertyInfo.SetValue(target, value, null);
|
||||
}
|
||||
|
||||
else if (propertyInfo.PropertyType == typeof(IEnumerable<string>))
|
||||
{
|
||||
IEnumerable<string> value;
|
||||
|
||||
if (field.Value.GetType() == typeof(JArray))
|
||||
{
|
||||
value = ((JArray)field.Value).Select(s => s.Value<string>());
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
value = field.Value.ToString().Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
}
|
||||
|
||||
propertyInfo.SetValue(target, value, null);
|
||||
}
|
||||
|
||||
else if (propertyInfo.PropertyType.HasAttribute<FlagsAttribute>())
|
||||
{
|
||||
int value = field.Value.ToString().Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(s => Convert.ToInt32(s)).Sum();
|
||||
propertyInfo.SetValue(target, value, null);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
propertyInfo.SetValue(target, field.Value, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return target;
|
||||
|
||||
}
|
||||
|
||||
public static T ReadFromSchema<T>(List<Field> fields)
|
||||
{
|
||||
return (T)ReadFromSchema(fields, typeof(T));
|
||||
}
|
||||
|
||||
private static List<SelectOption> GetSelectOptions(Type selectOptions)
|
||||
{
|
||||
if (selectOptions == null || selectOptions == typeof(Profile))
|
||||
{
|
||||
return new List<SelectOption>();
|
||||
}
|
||||
|
||||
if (selectOptions == typeof(Quality))
|
||||
{
|
||||
var qOptions = from Quality q in selectOptions.GetProperties(BindingFlags.Static | BindingFlags.Public)
|
||||
select new SelectOption {Name = q.Name, Value = q.Id};
|
||||
return qOptions.OrderBy(o => o.Value).ToList();
|
||||
}
|
||||
|
||||
var options = from Enum e in Enum.GetValues(selectOptions)
|
||||
select new SelectOption { Value = Convert.ToInt32(e), Name = e.ToString() };
|
||||
|
||||
if (selectOptions == typeof(NzbgetPriority))
|
||||
{
|
||||
return options.OrderBy(o => o.Value).ToList();
|
||||
}
|
||||
|
||||
return options.OrderBy(o => o.Name).ToList();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
namespace NzbDrone.Api.ClientSchema
|
||||
{
|
||||
public static class SchemaDeserializer
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -1,20 +1,22 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Api.Extensions;
|
||||
using NzbDrone.Api.Validation;
|
||||
using Radarr.Http.Extensions;
|
||||
using Radarr.Http.Validation;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Datastore.Events;
|
||||
using NzbDrone.Core.Messaging.Commands;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
using NzbDrone.Core.ProgressMessaging;
|
||||
using NzbDrone.SignalR;
|
||||
using Radarr.Http;
|
||||
using Radarr.Http.Mapping;
|
||||
|
||||
|
||||
namespace NzbDrone.Api.Commands
|
||||
{
|
||||
public class CommandModule : NzbDroneRestModuleWithSignalR<CommandResource, CommandModel>, IHandle<CommandUpdatedEvent>
|
||||
public class CommandModule : RadarrRestModuleWithSignalR<CommandResource, CommandModel>, IHandle<CommandUpdatedEvent>
|
||||
{
|
||||
private readonly IManageCommandQueue _commandQueueManager;
|
||||
private readonly IServiceFactory _serviceFactory;
|
||||
@ -73,4 +75,4 @@ public void Handle(CommandUpdatedEvent message)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using NzbDrone.Api.REST;
|
||||
using Radarr.Http.REST;
|
||||
using NzbDrone.Core.Messaging.Commands;
|
||||
|
||||
namespace NzbDrone.Api.Commands
|
||||
|
@ -1,4 +1,4 @@
|
||||
using FluentValidation;
|
||||
using FluentValidation;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Validation.Paths;
|
||||
|
||||
@ -6,19 +6,10 @@ namespace NzbDrone.Api.Config
|
||||
{
|
||||
public class DownloadClientConfigModule : NzbDroneConfigModule<DownloadClientConfigResource>
|
||||
{
|
||||
public DownloadClientConfigModule(IConfigService configService,
|
||||
RootFolderValidator rootFolderValidator,
|
||||
PathExistsValidator pathExistsValidator,
|
||||
MappedNetworkDriveValidator mappedNetworkDriveValidator)
|
||||
public DownloadClientConfigModule(IConfigService configService)
|
||||
: base(configService)
|
||||
{
|
||||
SharedValidator.RuleFor(c => c.DownloadedMoviesFolder)
|
||||
.Cascade(CascadeMode.StopOnFirstFailure)
|
||||
.IsValidPath()
|
||||
.SetValidator(rootFolderValidator)
|
||||
.SetValidator(mappedNetworkDriveValidator)
|
||||
.SetValidator(pathExistsValidator)
|
||||
.When(c => !string.IsNullOrWhiteSpace(c.DownloadedMoviesFolder));
|
||||
|
||||
}
|
||||
|
||||
protected override DownloadClientConfigResource ToResource(IConfigService model)
|
||||
@ -26,4 +17,4 @@ protected override DownloadClientConfigResource ToResource(IConfigService model)
|
||||
return DownloadClientConfigResourceMapper.ToResource(model);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,11 @@
|
||||
using NzbDrone.Api.REST;
|
||||
using Radarr.Http.REST;
|
||||
using NzbDrone.Core.Configuration;
|
||||
|
||||
namespace NzbDrone.Api.Config
|
||||
{
|
||||
public class DownloadClientConfigResource : RestResource
|
||||
{
|
||||
public string DownloadedMoviesFolder { get; set; }
|
||||
public string DownloadClientWorkingFolders { get; set; }
|
||||
public int DownloadedMoviesScanInterval { get; set; }
|
||||
|
||||
public bool EnableCompletedDownloadHandling { get; set; }
|
||||
public bool RemoveCompletedDownloads { get; set; }
|
||||
@ -23,9 +21,7 @@ public static DownloadClientConfigResource ToResource(IConfigService model)
|
||||
{
|
||||
return new DownloadClientConfigResource
|
||||
{
|
||||
DownloadedMoviesFolder = model.DownloadedMoviesFolder,
|
||||
DownloadClientWorkingFolders = model.DownloadClientWorkingFolders,
|
||||
DownloadedMoviesScanInterval = model.DownloadedMoviesScanInterval,
|
||||
|
||||
EnableCompletedDownloadHandling = model.EnableCompletedDownloadHandling,
|
||||
RemoveCompletedDownloads = model.RemoveCompletedDownloads,
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using FluentValidation;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
@ -8,10 +9,11 @@
|
||||
using NzbDrone.Core.Update;
|
||||
using NzbDrone.Core.Validation;
|
||||
using NzbDrone.Core.Validation.Paths;
|
||||
using Radarr.Http;
|
||||
|
||||
namespace NzbDrone.Api.Config
|
||||
{
|
||||
public class HostConfigModule : NzbDroneRestModule<HostConfigResource>
|
||||
public class HostConfigModule : RadarrRestModule<HostConfigResource>
|
||||
{
|
||||
private readonly IConfigFileProvider _configFileProvider;
|
||||
private readonly IConfigService _configService;
|
||||
@ -45,6 +47,10 @@ public HostConfigModule(IConfigFileProvider configFileProvider, IConfigService c
|
||||
|
||||
SharedValidator.RuleFor(c => c.Branch).NotEmpty().WithMessage("Branch name is required, 'master' is the default");
|
||||
SharedValidator.RuleFor(c => c.UpdateScriptPath).IsValidPath().When(c => c.UpdateMechanism == UpdateMechanism.Script);
|
||||
|
||||
SharedValidator.RuleFor(c => c.BackupFolder).IsValidPath().When(c => Path.IsPathRooted(c.BackupFolder));
|
||||
SharedValidator.RuleFor(c => c.BackupInterval).InclusiveBetween(1, 7);
|
||||
SharedValidator.RuleFor(c => c.BackupRetention).InclusiveBetween(1, 90);
|
||||
}
|
||||
|
||||
private HostConfigResource GetHostConfig()
|
||||
|
@ -1,4 +1,4 @@
|
||||
using NzbDrone.Api.REST;
|
||||
using Radarr.Http.REST;
|
||||
using NzbDrone.Core.Authentication;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Update;
|
||||
@ -33,6 +33,9 @@ public class HostConfigResource : RestResource
|
||||
public string ProxyPassword { get; set; }
|
||||
public string ProxyBypassFilter { get; set; }
|
||||
public bool ProxyBypassLocalAddresses { get; set; }
|
||||
public string BackupFolder { get; set; }
|
||||
public int BackupInterval { get; set; }
|
||||
public int BackupRetention { get; set; }
|
||||
}
|
||||
|
||||
public static class HostConfigResourceMapper
|
||||
@ -66,7 +69,10 @@ public static HostConfigResource ToResource(this IConfigFileProvider model, ICon
|
||||
ProxyUsername = configService.ProxyUsername,
|
||||
ProxyPassword = configService.ProxyPassword,
|
||||
ProxyBypassFilter = configService.ProxyBypassFilter,
|
||||
ProxyBypassLocalAddresses = configService.ProxyBypassLocalAddresses
|
||||
ProxyBypassLocalAddresses = configService.ProxyBypassLocalAddresses,
|
||||
BackupFolder = configService.BackupFolder,
|
||||
BackupInterval = configService.BackupInterval,
|
||||
BackupRetention = configService.BackupRetention
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
using FluentValidation;
|
||||
using NzbDrone.Api.Validation;
|
||||
using Radarr.Http.Validation;
|
||||
using NzbDrone.Core.Configuration;
|
||||
|
||||
namespace NzbDrone.Api.Config
|
||||
|
@ -1,4 +1,4 @@
|
||||
using NzbDrone.Api.REST;
|
||||
using Radarr.Http.REST;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Parser;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
using NzbDrone.Api.REST;
|
||||
using Radarr.Http.REST;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
|
||||
@ -33,10 +33,10 @@ public static MediaManagementConfigResource ToResource(IConfigService model)
|
||||
{
|
||||
return new MediaManagementConfigResource
|
||||
{
|
||||
AutoUnmonitorPreviouslyDownloadedEpisodes = model.AutoUnmonitorPreviouslyDownloadedEpisodes,
|
||||
AutoUnmonitorPreviouslyDownloadedEpisodes = model.AutoUnmonitorPreviouslyDownloadedMovies,
|
||||
RecycleBin = model.RecycleBin,
|
||||
AutoDownloadPropers = model.AutoDownloadPropers,
|
||||
CreateEmptySeriesFolders = model.CreateEmptySeriesFolders,
|
||||
CreateEmptySeriesFolders = model.CreateEmptyMovieFolders,
|
||||
FileDate = model.FileDate,
|
||||
AutoRenameFolders = model.AutoRenameFolders,
|
||||
PathsDefaultStatic = model.PathsDefaultStatic,
|
||||
|
@ -6,11 +6,13 @@
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Organizer;
|
||||
using Nancy.ModelBinding;
|
||||
using NzbDrone.Api.Extensions;
|
||||
using Radarr.Http.Extensions;
|
||||
using Radarr.Http;
|
||||
using Radarr.Http.Mapping;
|
||||
|
||||
namespace NzbDrone.Api.Config
|
||||
{
|
||||
public class NamingConfigModule : NzbDroneRestModule<NamingConfigResource>
|
||||
public class NamingConfigModule : RadarrRestModule<NamingConfigResource>
|
||||
{
|
||||
private readonly INamingConfigService _namingConfigService;
|
||||
private readonly IFilenameSampleService _filenameSampleService;
|
||||
|
@ -1,4 +1,4 @@
|
||||
using NzbDrone.Api.REST;
|
||||
using Radarr.Http.REST;
|
||||
using NzbDrone.Core.Organizer;
|
||||
|
||||
namespace NzbDrone.Api.Config
|
||||
|
@ -1,5 +1,5 @@
|
||||
using FluentValidation;
|
||||
using NzbDrone.Api.Validation;
|
||||
using FluentValidation;
|
||||
using Radarr.Http.Validation;
|
||||
using NzbDrone.Core.Configuration;
|
||||
|
||||
namespace NzbDrone.Api.Config
|
||||
@ -19,4 +19,4 @@ protected override NetImportConfigResource ToResource(IConfigService model)
|
||||
return NetImportConfigResourceMapper.ToResource(model);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
using NzbDrone.Api.REST;
|
||||
using Radarr.Http.REST;
|
||||
using NzbDrone.Core.Configuration;
|
||||
|
||||
namespace NzbDrone.Api.Config
|
||||
|
@ -1,11 +1,12 @@
|
||||
using System.Linq;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using NzbDrone.Api.REST;
|
||||
using Radarr.Http;
|
||||
using Radarr.Http.REST;
|
||||
using NzbDrone.Core.Configuration;
|
||||
|
||||
namespace NzbDrone.Api.Config
|
||||
{
|
||||
public abstract class NzbDroneConfigModule<TResource> : NzbDroneRestModule<TResource> where TResource : RestResource, new()
|
||||
public abstract class NzbDroneConfigModule<TResource> : RadarrRestModule<TResource> where TResource : RestResource, new()
|
||||
{
|
||||
private readonly IConfigService _configService;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
using NzbDrone.Api.REST;
|
||||
using Radarr.Http.REST;
|
||||
using NzbDrone.Core.Configuration;
|
||||
|
||||
namespace NzbDrone.Api.Config
|
||||
|
@ -1,9 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using NzbDrone.Core.DiskSpace;
|
||||
using Radarr.Http;
|
||||
|
||||
namespace NzbDrone.Api.DiskSpace
|
||||
{
|
||||
public class DiskSpaceModule :NzbDroneRestModule<DiskSpaceResource>
|
||||
public class DiskSpaceModule :RadarrRestModule<DiskSpaceResource>
|
||||
{
|
||||
private readonly IDiskSpaceService _diskSpaceService;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
using NzbDrone.Api.REST;
|
||||
using Radarr.Http.REST;
|
||||
|
||||
namespace NzbDrone.Api.DiskSpace
|
||||
{
|
||||
|
@ -1,13 +1,14 @@
|
||||
using System.Collections.Generic;
|
||||
using NzbDrone.Api.REST;
|
||||
using Radarr.Http.REST;
|
||||
using NzbDrone.Core.Extras.Files;
|
||||
using NzbDrone.Core.Extras.Metadata.Files;
|
||||
using NzbDrone.Core.Extras.Others;
|
||||
using NzbDrone.Core.Extras.Subtitles;
|
||||
using Radarr.Http;
|
||||
|
||||
namespace NzbDrone.Api.ExtraFiles
|
||||
{
|
||||
public class ExtraFileModule : NzbDroneRestModule<ExtraFileResource>
|
||||
public class ExtraFileModule : RadarrRestModule<ExtraFileResource>
|
||||
{
|
||||
private readonly IExtraFileService<SubtitleFile> _subtitleFileService;
|
||||
private readonly IExtraFileService<MetadataFile> _metadataFileService;
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Api.REST;
|
||||
using Radarr.Http.REST;
|
||||
using NzbDrone.Core.Extras.Files;
|
||||
using NzbDrone.Core.Extras.Metadata.Files;
|
||||
using NzbDrone.Core.Extras.Others;
|
||||
|
@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Nancy;
|
||||
using NzbDrone.Api.Extensions;
|
||||
using Radarr.Http.Extensions;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
@ -31,15 +31,10 @@ public FileSystemModule(IFileSystemLookupService fileSystemLookupService,
|
||||
private Response GetContents()
|
||||
{
|
||||
var pathQuery = Request.Query.path;
|
||||
var includeFilesQuery = Request.Query.includeFiles;
|
||||
bool includeFiles = false;
|
||||
var includeFiles = Request.GetBooleanQueryParameter("includeFiles");
|
||||
var allowFoldersWithoutTrailingSlashes = Request.GetBooleanQueryParameter("allowFoldersWithoutTrailingSlashes");
|
||||
|
||||
if (includeFilesQuery.HasValue)
|
||||
{
|
||||
includeFiles = Convert.ToBoolean(includeFilesQuery.Value);
|
||||
}
|
||||
|
||||
return _fileSystemLookupService.LookupContents((string)pathQuery.Value, includeFiles).AsResponse();
|
||||
return _fileSystemLookupService.LookupContents((string)pathQuery.Value, includeFiles, allowFoldersWithoutTrailingSlashes).AsResponse();
|
||||
}
|
||||
|
||||
private Response GetEntityType()
|
||||
@ -73,4 +68,4 @@ private Response GetMediaFiles()
|
||||
}).AsResponse();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,121 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using Nancy;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
using NzbDrone.Core.Analytics;
|
||||
using NzbDrone.Core.Configuration;
|
||||
|
||||
namespace NzbDrone.Api.Frontend.Mappers
|
||||
{
|
||||
public class IndexHtmlMapper : StaticResourceMapperBase
|
||||
{
|
||||
private readonly IDiskProvider _diskProvider;
|
||||
private readonly IConfigFileProvider _configFileProvider;
|
||||
private readonly IAnalyticsService _analyticsService;
|
||||
private readonly Func<ICacheBreakerProvider> _cacheBreakProviderFactory;
|
||||
private readonly string _indexPath;
|
||||
private static readonly Regex ReplaceRegex = new Regex(@"(?:(?<attribute>href|src|content)=\"")(?<path>.*?(?<extension>css|js|png|ico|ics|svg|json|xml))(?:\"")(?:\s(?<nohash>data-no-hash))?", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
|
||||
private static string API_KEY;
|
||||
private static string URL_BASE;
|
||||
private string _generatedContent
|
||||
;
|
||||
|
||||
public IndexHtmlMapper(IAppFolderInfo appFolderInfo,
|
||||
IDiskProvider diskProvider,
|
||||
IConfigFileProvider configFileProvider,
|
||||
IAnalyticsService analyticsService,
|
||||
Func<ICacheBreakerProvider> cacheBreakProviderFactory,
|
||||
Logger logger)
|
||||
: base(diskProvider, logger)
|
||||
{
|
||||
_diskProvider = diskProvider;
|
||||
_configFileProvider = configFileProvider;
|
||||
_analyticsService = analyticsService;
|
||||
_cacheBreakProviderFactory = cacheBreakProviderFactory;
|
||||
_indexPath = Path.Combine(appFolderInfo.StartUpFolder, _configFileProvider.UiFolder, "index.html");
|
||||
|
||||
API_KEY = configFileProvider.ApiKey;
|
||||
URL_BASE = configFileProvider.UrlBase;
|
||||
}
|
||||
|
||||
public override string Map(string resourceUrl)
|
||||
{
|
||||
return _indexPath;
|
||||
}
|
||||
|
||||
public override bool CanHandle(string resourceUrl)
|
||||
{
|
||||
resourceUrl = resourceUrl.ToLowerInvariant();
|
||||
|
||||
return !resourceUrl.StartsWith("/content") &&
|
||||
!resourceUrl.StartsWith("/mediacover") &&
|
||||
!resourceUrl.Contains(".") &&
|
||||
!resourceUrl.StartsWith("/login");
|
||||
}
|
||||
|
||||
public override Response GetResponse(string resourceUrl)
|
||||
{
|
||||
var response = base.GetResponse(resourceUrl);
|
||||
response.Headers["X-UA-Compatible"] = "IE=edge";
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
protected override Stream GetContentStream(string filePath)
|
||||
{
|
||||
var text = GetIndexText();
|
||||
|
||||
var stream = new MemoryStream();
|
||||
var writer = new StreamWriter(stream);
|
||||
writer.Write(text);
|
||||
writer.Flush();
|
||||
stream.Position = 0;
|
||||
return stream;
|
||||
}
|
||||
|
||||
private string GetIndexText()
|
||||
{
|
||||
if (RuntimeInfo.IsProduction && _generatedContent != null)
|
||||
{
|
||||
return _generatedContent;
|
||||
}
|
||||
|
||||
var text = _diskProvider.ReadAllText(_indexPath);
|
||||
|
||||
var cacheBreakProvider = _cacheBreakProviderFactory();
|
||||
|
||||
text = ReplaceRegex.Replace(text, match =>
|
||||
{
|
||||
string url;
|
||||
|
||||
if (match.Groups["nohash"].Success)
|
||||
{
|
||||
url = match.Groups["path"].Value;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
url = cacheBreakProvider.AddCacheBreakerToPath(match.Groups["path"].Value);
|
||||
}
|
||||
|
||||
return string.Format("{0}=\"{1}{2}\"", match.Groups["attribute"].Value, URL_BASE, url);
|
||||
});
|
||||
|
||||
text = text.Replace("API_ROOT", URL_BASE + "/api");
|
||||
text = text.Replace("API_KEY", API_KEY);
|
||||
text = text.Replace("APP_VERSION", BuildInfo.Version.ToString());
|
||||
text = text.Replace("APP_BRANCH", _configFileProvider.Branch.ToLower());
|
||||
text = text.Replace("APP_ANALYTICS", _analyticsService.IsEnabled.ToString().ToLowerInvariant());
|
||||
text = text.Replace("URL_BASE", URL_BASE);
|
||||
text = text.Replace("PRODUCTION", RuntimeInfo.IsProduction.ToString().ToLowerInvariant());
|
||||
|
||||
_generatedContent = text;
|
||||
|
||||
return _generatedContent;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,90 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using Nancy;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
using NzbDrone.Core.Configuration;
|
||||
|
||||
namespace NzbDrone.Api.Frontend.Mappers
|
||||
{
|
||||
public class LoginHtmlMapper : StaticResourceMapperBase
|
||||
{
|
||||
private readonly IDiskProvider _diskProvider;
|
||||
private readonly IConfigFileProvider _configFileProvider;
|
||||
private readonly Func<ICacheBreakerProvider> _cacheBreakProviderFactory;
|
||||
private readonly string _indexPath;
|
||||
private static readonly Regex ReplaceRegex = new Regex("(?<=(?:href|src|data-main)=\").*?(?=\")", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
|
||||
private static string URL_BASE;
|
||||
private string _generatedContent;
|
||||
|
||||
public LoginHtmlMapper(IAppFolderInfo appFolderInfo,
|
||||
IDiskProvider diskProvider,
|
||||
IConfigFileProvider configFileProvider,
|
||||
Func<ICacheBreakerProvider> cacheBreakProviderFactory,
|
||||
Logger logger)
|
||||
: base(diskProvider, logger)
|
||||
{
|
||||
_diskProvider = diskProvider;
|
||||
_configFileProvider = configFileProvider;
|
||||
_cacheBreakProviderFactory = cacheBreakProviderFactory;
|
||||
_indexPath = Path.Combine(appFolderInfo.StartUpFolder, _configFileProvider.UiFolder, "login.html");
|
||||
|
||||
URL_BASE = configFileProvider.UrlBase;
|
||||
}
|
||||
|
||||
public override string Map(string resourceUrl)
|
||||
{
|
||||
return _indexPath;
|
||||
}
|
||||
|
||||
public override bool CanHandle(string resourceUrl)
|
||||
{
|
||||
return resourceUrl.StartsWith("/login");
|
||||
}
|
||||
|
||||
public override Response GetResponse(string resourceUrl)
|
||||
{
|
||||
var response = base.GetResponse(resourceUrl);
|
||||
response.Headers["X-UA-Compatible"] = "IE=edge";
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
protected override Stream GetContentStream(string filePath)
|
||||
{
|
||||
var text = GetLoginText();
|
||||
|
||||
var stream = new MemoryStream();
|
||||
var writer = new StreamWriter(stream);
|
||||
writer.Write(text);
|
||||
writer.Flush();
|
||||
stream.Position = 0;
|
||||
return stream;
|
||||
}
|
||||
|
||||
private string GetLoginText()
|
||||
{
|
||||
if (RuntimeInfo.IsProduction && _generatedContent != null)
|
||||
{
|
||||
return _generatedContent;
|
||||
}
|
||||
|
||||
var text = _diskProvider.ReadAllText(_indexPath);
|
||||
|
||||
var cacheBreakProvider = _cacheBreakProviderFactory();
|
||||
|
||||
text = ReplaceRegex.Replace(text, match =>
|
||||
{
|
||||
var url = cacheBreakProvider.AddCacheBreakerToPath(match.Value);
|
||||
return URL_BASE + url;
|
||||
});
|
||||
|
||||
_generatedContent = text;
|
||||
|
||||
return _generatedContent;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +1,13 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using NzbDrone.Core.Datastore.Events;
|
||||
using NzbDrone.Core.HealthCheck;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
using NzbDrone.SignalR;
|
||||
using Radarr.Http;
|
||||
|
||||
namespace NzbDrone.Api.Health
|
||||
{
|
||||
public class HealthModule : NzbDroneRestModuleWithSignalR<HealthResource, HealthCheck>,
|
||||
public class HealthModule : RadarrRestModuleWithSignalR<HealthResource, HealthCheck>,
|
||||
IHandle<HealthCheckCompleteEvent>
|
||||
{
|
||||
private readonly IHealthCheckService _healthCheckService;
|
||||
@ -28,4 +29,4 @@ public void Handle(HealthCheckCompleteEvent message)
|
||||
BroadcastResourceChange(ModelAction.Sync);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Api.REST;
|
||||
using Radarr.Http.REST;
|
||||
using NzbDrone.Common.Http;
|
||||
using NzbDrone.Core.HealthCheck;
|
||||
|
||||
|
@ -1,15 +1,18 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Nancy;
|
||||
using NzbDrone.Api.Extensions;
|
||||
using Radarr.Http.Extensions;
|
||||
using NzbDrone.Api.Movies;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.DecisionEngine;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.History;
|
||||
using Radarr.Http;
|
||||
using Radarr.Http.REST;
|
||||
|
||||
namespace NzbDrone.Api.History
|
||||
{
|
||||
public class HistoryModule : NzbDroneRestModule<HistoryResource>
|
||||
public class HistoryModule : RadarrRestModule<HistoryResource>
|
||||
{
|
||||
private readonly IHistoryService _historyService;
|
||||
private readonly IQualityUpgradableSpecification _qualityUpgradableSpecification;
|
||||
@ -43,19 +46,19 @@ protected HistoryResource MapToResource(Core.History.History model)
|
||||
private PagingResource<HistoryResource> GetHistory(PagingResource<HistoryResource> pagingResource)
|
||||
{
|
||||
var movieId = Request.Query.MovieId;
|
||||
|
||||
var pagingSpec = pagingResource.MapToPagingSpec<HistoryResource, Core.History.History>("date", SortDirection.Descending);
|
||||
var filter = pagingResource.Filters.FirstOrDefault();
|
||||
|
||||
if (pagingResource.FilterKey == "eventType")
|
||||
if (filter != null && filter.Key == "eventType")
|
||||
{
|
||||
var filterValue = (HistoryEventType)Convert.ToInt32(pagingResource.FilterValue);
|
||||
pagingSpec.FilterExpression = v => v.EventType == filterValue;
|
||||
var filterValue = (HistoryEventType)Convert.ToInt32(filter.Value);
|
||||
pagingSpec.FilterExpressions.Add(v => v.EventType == filterValue);
|
||||
}
|
||||
|
||||
if (movieId.HasValue)
|
||||
{
|
||||
int i = (int)movieId;
|
||||
pagingSpec.FilterExpression = h => h.MovieId == i;
|
||||
pagingSpec.FilterExpressions.Add(h => h.MovieId == i);
|
||||
}
|
||||
|
||||
return ApplyToPage(_historyService.Paged, pagingSpec, MapToResource);
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NzbDrone.Api.REST;
|
||||
using Radarr.Http.REST;
|
||||
using NzbDrone.Api.Movies;
|
||||
using NzbDrone.Core.History;
|
||||
using NzbDrone.Core.Qualities;
|
||||
|
@ -10,7 +10,7 @@
|
||||
using NzbDrone.Core.Indexers;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using Nancy.ModelBinding;
|
||||
using NzbDrone.Api.Extensions;
|
||||
using Radarr.Http.Extensions;
|
||||
using NzbDrone.Common.Cache;
|
||||
using HttpStatusCode = System.Net.HttpStatusCode;
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using NzbDrone.Core.DecisionEngine;
|
||||
using Radarr.Http;
|
||||
|
||||
namespace NzbDrone.Api.Indexers
|
||||
{
|
||||
public abstract class ReleaseModuleBase : NzbDroneRestModule<ReleaseResource>
|
||||
public abstract class ReleaseModuleBase : RadarrRestModule<ReleaseResource>
|
||||
{
|
||||
protected virtual List<ReleaseResource> MapDecisions(IEnumerable<DownloadDecision> decisions)
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
using Nancy;
|
||||
using Nancy;
|
||||
using Nancy.ModelBinding;
|
||||
using FluentValidation;
|
||||
using NzbDrone.Core.DecisionEngine;
|
||||
@ -6,7 +6,8 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Api.Extensions;
|
||||
using Radarr.Http.Extensions;
|
||||
using Radarr.Http.Mapping;
|
||||
using NLog;
|
||||
|
||||
namespace NzbDrone.Api.Indexers
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using NzbDrone.Api.REST;
|
||||
using Radarr.Http.REST;
|
||||
using NzbDrone.Core.Parser;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using NzbDrone.Core.Indexers;
|
||||
|
@ -1,14 +1,15 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using NzbDrone.Common.Disk;
|
||||
using Nancy;
|
||||
using Nancy.Responses;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using Radarr.Http;
|
||||
|
||||
namespace NzbDrone.Api.Logs
|
||||
{
|
||||
public abstract class LogFileModuleBase : NzbDroneRestModule<LogFileResource>
|
||||
public abstract class LogFileModuleBase : RadarrRestModule<LogFileResource>
|
||||
{
|
||||
protected const string LOGFILE_ROUTE = @"/(?<filename>[-.a-zA-Z0-9]+?\.txt)";
|
||||
|
||||
@ -68,4 +69,4 @@ private Response GetLogFileResponse(string filename)
|
||||
|
||||
protected abstract string DownloadUrlRoot { get; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using NzbDrone.Api.REST;
|
||||
using Radarr.Http.REST;
|
||||
|
||||
namespace NzbDrone.Api.Logs
|
||||
{
|
||||
|
@ -1,8 +1,10 @@
|
||||
using NzbDrone.Core.Instrumentation;
|
||||
using System.Linq;
|
||||
using NzbDrone.Core.Instrumentation;
|
||||
using Radarr.Http;
|
||||
|
||||
namespace NzbDrone.Api.Logs
|
||||
{
|
||||
public class LogModule : NzbDroneRestModule<LogResource>
|
||||
public class LogModule : RadarrRestModule<LogResource>
|
||||
{
|
||||
private readonly ILogService _logService;
|
||||
|
||||
@ -21,27 +23,29 @@ private PagingResource<LogResource> GetLogs(PagingResource<LogResource> pagingRe
|
||||
pageSpec.SortKey = "id";
|
||||
}
|
||||
|
||||
if (pagingResource.FilterKey == "level")
|
||||
var filter = pagingResource.Filters.FirstOrDefault();
|
||||
|
||||
if (filter != null && filter.Key == "level")
|
||||
{
|
||||
switch (pagingResource.FilterValue)
|
||||
switch (filter.Value)
|
||||
{
|
||||
case "Fatal":
|
||||
pageSpec.FilterExpression = h => h.Level == "Fatal";
|
||||
pageSpec.FilterExpressions.Add(h => h.Level == "Fatal");
|
||||
break;
|
||||
case "Error":
|
||||
pageSpec.FilterExpression = h => h.Level == "Fatal" || h.Level == "Error";
|
||||
pageSpec.FilterExpressions.Add(h => h.Level == "Fatal" || h.Level == "Error");
|
||||
break;
|
||||
case "Warn":
|
||||
pageSpec.FilterExpression = h => h.Level == "Fatal" || h.Level == "Error" || h.Level == "Warn";
|
||||
pageSpec.FilterExpressions.Add(h => h.Level == "Fatal" || h.Level == "Error" || h.Level == "Warn");
|
||||
break;
|
||||
case "Info":
|
||||
pageSpec.FilterExpression = h => h.Level == "Fatal" || h.Level == "Error" || h.Level == "Warn" || h.Level == "Info";
|
||||
pageSpec.FilterExpressions.Add(h => h.Level == "Fatal" || h.Level == "Error" || h.Level == "Warn" || h.Level == "Info");
|
||||
break;
|
||||
case "Debug":
|
||||
pageSpec.FilterExpression = h => h.Level == "Fatal" || h.Level == "Error" || h.Level == "Warn" || h.Level == "Info" || h.Level == "Debug";
|
||||
pageSpec.FilterExpressions.Add(h => h.Level == "Fatal" || h.Level == "Error" || h.Level == "Warn" || h.Level == "Info" || h.Level == "Debug");
|
||||
break;
|
||||
case "Trace":
|
||||
pageSpec.FilterExpression = h => h.Level == "Fatal" || h.Level == "Error" || h.Level == "Warn" || h.Level == "Info" || h.Level == "Debug" || h.Level == "Trace";
|
||||
pageSpec.FilterExpressions.Add(h => h.Level == "Fatal" || h.Level == "Error" || h.Level == "Warn" || h.Level == "Info" || h.Level == "Debug" || h.Level == "Trace");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -49,4 +53,4 @@ private PagingResource<LogResource> GetLogs(PagingResource<LogResource> pagingRe
|
||||
return ApplyToPage(_logService.Paged, pageSpec, LogResourceMapper.ToResource);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using NzbDrone.Api.REST;
|
||||
using Radarr.Http.REST;
|
||||
|
||||
namespace NzbDrone.Api.Logs
|
||||
{
|
||||
|
@ -1,11 +1,13 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Core.MediaFiles.MovieImport.Manual;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using Radarr.Http;
|
||||
using Radarr.Http.Extensions;
|
||||
|
||||
namespace NzbDrone.Api.ManualImport
|
||||
{
|
||||
public class ManualImportModule : NzbDroneRestModule<ManualImportResource>
|
||||
public class ManualImportModule : RadarrRestModule<ManualImportResource>
|
||||
{
|
||||
private readonly IManualImportService _manualImportService;
|
||||
|
||||
@ -24,8 +26,9 @@ private List<ManualImportResource> GetMediaFiles()
|
||||
|
||||
var downloadIdQuery = Request.Query.downloadId;
|
||||
var downloadId = (string)downloadIdQuery.Value;
|
||||
var filterExistingFiles = Request.GetBooleanQueryParameter("filterExistingFiles", true);
|
||||
|
||||
return _manualImportService.GetMediaFiles(folder, downloadId).ToResource().Select(AddQualityWeight).ToList();
|
||||
return _manualImportService.GetMediaFiles(folder, downloadId, filterExistingFiles).ToResource().Select(AddQualityWeight).ToList();
|
||||
}
|
||||
|
||||
private ManualImportResource AddQualityWeight(ManualImportResource item)
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Api.Movies;
|
||||
using NzbDrone.Api.REST;
|
||||
using Radarr.Http.REST;
|
||||
using NzbDrone.Common.Crypto;
|
||||
using NzbDrone.Core.DecisionEngine;
|
||||
using NzbDrone.Core.Qualities;
|
||||
|
@ -1,7 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using NLog;
|
||||
using NzbDrone.Api.REST;
|
||||
using Radarr.Http;
|
||||
using Radarr.Http.REST;
|
||||
using NzbDrone.Core.Datastore.Events;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.MediaFiles.Events;
|
||||
@ -12,7 +13,7 @@
|
||||
|
||||
namespace NzbDrone.Api.MovieFiles
|
||||
{
|
||||
public class MovieFileModule : NzbDroneRestModuleWithSignalR<MovieFileResource, MovieFile>, IHandle<MovieFileAddedEvent>
|
||||
public class MovieFileModule : RadarrRestModuleWithSignalR<MovieFileResource, MovieFile>, IHandle<MovieFileAddedEvent>
|
||||
{
|
||||
private readonly IMediaFileService _mediaFileService;
|
||||
private readonly IRecycleBinProvider _recycleBinProvider;
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Api.REST;
|
||||
using Radarr.Http.REST;
|
||||
using NzbDrone.Api.Movies;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
|
@ -16,10 +16,11 @@
|
||||
using NzbDrone.Core.RootFolders;
|
||||
using NzbDrone.Core.Movies;
|
||||
using NzbDrone.Core.Movies.Events;
|
||||
using Radarr.Http;
|
||||
|
||||
namespace NzbDrone.Api.Movies
|
||||
{
|
||||
public class AlternativeTitleModule : NzbDroneRestModule<AlternativeTitleResource>
|
||||
public class AlternativeTitleModule : RadarrRestModule<AlternativeTitleResource>
|
||||
{
|
||||
private readonly IAlternativeTitleService _altTitleService;
|
||||
private readonly IMovieService _movieService;
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Api.REST;
|
||||
using Radarr.Http.REST;
|
||||
using NzbDrone.Core.MediaCover;
|
||||
using NzbDrone.Core.Movies;
|
||||
using NzbDrone.Core.Qualities;
|
||||
|
@ -17,10 +17,11 @@
|
||||
using NzbDrone.Core.RootFolders;
|
||||
using NzbDrone.Core.Movies;
|
||||
using NzbDrone.Core.Movies.Events;
|
||||
using Radarr.Http;
|
||||
|
||||
namespace NzbDrone.Api.Movies
|
||||
{
|
||||
public class AlternativeYearModule : NzbDroneRestModule<AlternativeYearResource>
|
||||
public class AlternativeYearModule : RadarrRestModule<AlternativeYearResource>
|
||||
{
|
||||
private readonly IMovieService _movieService;
|
||||
private readonly IRadarrAPIClient _radarrApi;
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Api.REST;
|
||||
using Radarr.Http.REST;
|
||||
using NzbDrone.Core.MediaCover;
|
||||
using NzbDrone.Core.Movies;
|
||||
using NzbDrone.Core.Qualities;
|
||||
|
@ -1,14 +1,15 @@
|
||||
using System.Collections.Generic;
|
||||
using Nancy;
|
||||
using NzbDrone.Api.Extensions;
|
||||
using NzbDrone.Core.MediaCover;
|
||||
using NzbDrone.Core.MetadataSource;
|
||||
using System.Linq;
|
||||
using NzbDrone.Core.NetImport;
|
||||
using Radarr.Http;
|
||||
using Radarr.Http.Extensions;
|
||||
|
||||
namespace NzbDrone.Api.Movies
|
||||
{
|
||||
public class FetchMovieListModule : NzbDroneRestModule<MovieResource>
|
||||
public class FetchMovieListModule : RadarrRestModule<MovieResource>
|
||||
{
|
||||
private readonly IFetchNetImport _fetchNetImport;
|
||||
private readonly ISearchForNewMovie _movieSearch;
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using Nancy;
|
||||
using NzbDrone.Api.Extensions;
|
||||
using Radarr.Http.Extensions;
|
||||
using NzbDrone.Core.MediaCover;
|
||||
using NzbDrone.Core.MetadataSource;
|
||||
using NzbDrone.Core.Parser;
|
||||
@ -15,6 +15,7 @@
|
||||
using NzbDrone.Common.Cache;
|
||||
using NzbDrone.Core.Movies;
|
||||
using NzbDrone.Core.Profiles;
|
||||
using Radarr.Http;
|
||||
|
||||
namespace NzbDrone.Api.Movies
|
||||
{
|
||||
@ -27,7 +28,7 @@ public int Compare(UnmappedFolder a, UnmappedFolder b)
|
||||
}
|
||||
}
|
||||
|
||||
public class MovieBulkImportModule : NzbDroneRestModule<MovieResource>
|
||||
public class MovieBulkImportModule : RadarrRestModule<MovieResource>
|
||||
{
|
||||
private readonly ISearchForNewMovie _searchProxy;
|
||||
private readonly IRootFolderService _rootFolderService;
|
||||
|
@ -1,17 +1,17 @@
|
||||
using System.Collections.Generic;
|
||||
using Nancy;
|
||||
using NzbDrone.Api.Extensions;
|
||||
using Radarr.Http.Extensions;
|
||||
using NzbDrone.Core.MediaCover;
|
||||
using NzbDrone.Core.MetadataSource;
|
||||
using System.Linq;
|
||||
using System;
|
||||
using NzbDrone.Api.REST;
|
||||
using Radarr.Http;
|
||||
using NzbDrone.Core.NetImport;
|
||||
using NzbDrone.Api.NetImport;
|
||||
|
||||
namespace NzbDrone.Api.Movies
|
||||
{
|
||||
public class MovieDiscoverModule : NzbDroneRestModule<MovieResource>
|
||||
public class MovieDiscoverModule : RadarrRestModule<MovieResource>
|
||||
{
|
||||
private readonly IDiscoverNewMovies _searchProxy;
|
||||
private readonly INetImportFactory _netImportFactory;
|
||||
|
@ -3,9 +3,10 @@
|
||||
using System.Linq;
|
||||
using Nancy;
|
||||
using Nancy.Responses;
|
||||
using NzbDrone.Api.Extensions;
|
||||
using NzbDrone.Api.REST;
|
||||
using Radarr.Http.Extensions;
|
||||
using Radarr.Http.REST;
|
||||
using NzbDrone.Core.Movies;
|
||||
using Radarr.Http.Mapping;
|
||||
|
||||
namespace NzbDrone.Api.Movies
|
||||
{
|
||||
|
@ -1,15 +1,16 @@
|
||||
using System.Collections.Generic;
|
||||
using Nancy;
|
||||
using NzbDrone.Api.Extensions;
|
||||
using Radarr.Http.Extensions;
|
||||
using NzbDrone.Core.MediaCover;
|
||||
using NzbDrone.Core.MetadataSource;
|
||||
using System.Linq;
|
||||
using System;
|
||||
using NzbDrone.Api.REST;
|
||||
using Radarr.Http;
|
||||
using Radarr.Http.REST;
|
||||
|
||||
namespace NzbDrone.Api.Movies
|
||||
{
|
||||
public class MovieLookupModule : NzbDroneRestModule<MovieResource>
|
||||
public class MovieLookupModule : RadarrRestModule<MovieResource>
|
||||
{
|
||||
private readonly ISearchForNewMovie _searchProxy;
|
||||
private readonly IProvideMovieInfo _movieInfo;
|
||||
|
@ -3,7 +3,7 @@
|
||||
using System.Linq;
|
||||
using FluentValidation;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Api.Extensions;
|
||||
using Radarr.Http.Extensions;
|
||||
using NzbDrone.Core.Datastore.Events;
|
||||
using NzbDrone.Core.MediaCover;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
@ -17,10 +17,11 @@
|
||||
using NzbDrone.Core.Datastore;
|
||||
using Microsoft.CSharp.RuntimeBinder;
|
||||
using Nancy;
|
||||
using Radarr.Http;
|
||||
|
||||
namespace NzbDrone.Api.Movies
|
||||
{
|
||||
public class MovieModule : NzbDroneRestModuleWithSignalR<MovieResource, Core.Movies.Movie>,
|
||||
public class MovieModule : RadarrRestModuleWithSignalR<MovieResource, Core.Movies.Movie>,
|
||||
IHandle<MovieImportedEvent>,
|
||||
IHandle<MovieFileDeletedEvent>,
|
||||
IHandle<MovieUpdatedEvent>,
|
||||
@ -41,8 +42,8 @@ public MovieModule(IBroadcastSignalRMessage signalRBroadcaster,
|
||||
RootFolderValidator rootFolderValidator,
|
||||
MoviePathValidator moviesPathValidator,
|
||||
MovieExistsValidator moviesExistsValidator,
|
||||
DroneFactoryValidator droneFactoryValidator,
|
||||
MovieAncestorValidator moviesAncestorValidator,
|
||||
SystemFolderValidator systemFolderValidator,
|
||||
ProfileExistsValidator profileExistsValidator
|
||||
)
|
||||
: base(signalRBroadcaster)
|
||||
@ -64,15 +65,15 @@ ProfileExistsValidator profileExistsValidator
|
||||
UpdateResource = UpdateMovie;
|
||||
DeleteResource = DeleteMovie;
|
||||
|
||||
Validation.RuleBuilderExtensions.ValidId(SharedValidator.RuleFor(s => s.ProfileId));
|
||||
SharedValidator.RuleFor(s => s.ProfileId).ValidId();
|
||||
|
||||
SharedValidator.RuleFor(s => s.Path)
|
||||
.Cascade(CascadeMode.StopOnFirstFailure)
|
||||
.IsValidPath()
|
||||
.SetValidator(rootFolderValidator)
|
||||
.SetValidator(moviesPathValidator)
|
||||
.SetValidator(droneFactoryValidator)
|
||||
.SetValidator(moviesAncestorValidator)
|
||||
.SetValidator(systemFolderValidator)
|
||||
.When(s => !s.Path.IsNullOrWhiteSpace());
|
||||
|
||||
SharedValidator.RuleFor(s => s.ProfileId).SetValidator(profileExistsValidator);
|
||||
@ -110,14 +111,14 @@ private MovieResource GetMovie(int id)
|
||||
|
||||
private PagingResource<MovieResource> GetMoviePaged(PagingResource<MovieResource> pagingResource)
|
||||
{
|
||||
var pagingSpec = pagingResource.MapToPagingSpec<MovieResource, Core.Movies.Movie>();
|
||||
var pagingSpec = pagingResource.MapToPagingSpec<MovieResource, Movie>();
|
||||
|
||||
pagingSpec.FilterExpression = _moviesService.ConstructFilterExpression(pagingResource.FilterKey, pagingResource.FilterValue, pagingResource.FilterType);
|
||||
pagingSpec.FilterExpressions.Add(_moviesService.ConstructFilterExpression(pagingResource.Filters.FirstOrDefault().Key, pagingResource.Filters.FirstOrDefault().Value));
|
||||
|
||||
return ApplyToPage(_moviesService.Paged, pagingSpec, MapToResource);
|
||||
}
|
||||
|
||||
protected MovieResource MapToResource(Core.Movies.Movie movies)
|
||||
protected MovieResource MapToResource(Movie movies)
|
||||
{
|
||||
if (movies == null) return null;
|
||||
|
||||
|
@ -6,10 +6,11 @@
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
using NzbDrone.Core.Movies;
|
||||
using NzbDrone.SignalR;
|
||||
using Radarr.Http;
|
||||
|
||||
namespace NzbDrone.Api.Movies
|
||||
{
|
||||
public abstract class MovieModuleWithSignalR : NzbDroneRestModuleWithSignalR<MovieResource, Core.Movies.Movie>,
|
||||
public abstract class MovieModuleWithSignalR : RadarrRestModuleWithSignalR<MovieResource, Core.Movies.Movie>,
|
||||
IHandle<MovieGrabbedEvent>,
|
||||
IHandle<MovieDownloadedEvent>
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Api.REST;
|
||||
using Radarr.Http.REST;
|
||||
using NzbDrone.Core.MediaCover;
|
||||
using NzbDrone.Core.Movies;
|
||||
using NzbDrone.Api.MovieFiles;
|
||||
|
@ -1,13 +1,14 @@
|
||||
using NzbDrone.Api.REST;
|
||||
using Radarr.Http.REST;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Radarr.Http;
|
||||
|
||||
namespace NzbDrone.Api.Movies
|
||||
{
|
||||
public class RenameMovieModule : NzbDroneRestModule<RenameMovieResource>
|
||||
public class RenameMovieModule : RadarrRestModule<RenameMovieResource>
|
||||
{
|
||||
private readonly IRenameMovieFileService _renameMovieFileService;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
using NzbDrone.Api.REST;
|
||||
using Radarr.Http.REST;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
|
@ -1,13 +1,14 @@
|
||||
using System.Collections.Generic;
|
||||
using FluentValidation;
|
||||
using NzbDrone.Api.ClientSchema;
|
||||
using Radarr.Http.ClientSchema;
|
||||
using NzbDrone.Core.NetImport;
|
||||
using NzbDrone.Core.NetImport.ImportExclusions;
|
||||
using NzbDrone.Core.Validation.Paths;
|
||||
using Radarr.Http;
|
||||
|
||||
namespace NzbDrone.Api.NetImport
|
||||
{
|
||||
public class ImportExclusionsModule : NzbDroneRestModule<ImportExclusionsResource>
|
||||
public class ImportExclusionsModule : RadarrRestModule<ImportExclusionsResource>
|
||||
{
|
||||
private readonly IImportExclusionsService _exclusionService;
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
using System.Linq;
|
||||
using Nancy;
|
||||
using Nancy.Extensions;
|
||||
using NzbDrone.Api.Extensions;
|
||||
using Radarr.Http.Extensions;
|
||||
using NzbDrone.Api.Movies;
|
||||
using NzbDrone.Core.MetadataSource;
|
||||
using NzbDrone.Core.Movies;
|
||||
|
@ -1,5 +1,5 @@
|
||||
using FluentValidation;
|
||||
using NzbDrone.Api.ClientSchema;
|
||||
using FluentValidation;
|
||||
using Radarr.Http.ClientSchema;
|
||||
using NzbDrone.Core.NetImport;
|
||||
using NzbDrone.Core.Validation.Paths;
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>NzbDrone.Api</RootNamespace>
|
||||
<AssemblyName>NzbDrone.Api</AssemblyName>
|
||||
<AssemblyName>Radarr.Api</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
|
||||
@ -91,31 +91,15 @@
|
||||
<Compile Include="..\NzbDrone.Common\Properties\SharedAssemblyInfo.cs">
|
||||
<Link>Properties\SharedAssemblyInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="Authentication\AuthenticationService.cs" />
|
||||
<Compile Include="Authentication\EnableAuthInNancy.cs" />
|
||||
<Compile Include="Authentication\AuthenticationModule.cs" />
|
||||
<Compile Include="Authentication\LoginResource.cs" />
|
||||
<Compile Include="Authentication\NzbDroneUser.cs" />
|
||||
<Compile Include="Blacklist\BlacklistModule.cs" />
|
||||
<Compile Include="Blacklist\BlacklistResource.cs" />
|
||||
<Compile Include="Calendar\CalendarFeedModule.cs" />
|
||||
<Compile Include="Calendar\CalendarModule.cs" />
|
||||
<Compile Include="ClientSchema\Field.cs" />
|
||||
<Compile Include="ClientSchema\FieldDefinitionAttribute.cs" />
|
||||
<Compile Include="ClientSchema\SchemaBuilder.cs" />
|
||||
<Compile Include="ClientSchema\SchemaDeserializer.cs" />
|
||||
<Compile Include="ClientSchema\SelectOption.cs" />
|
||||
<Compile Include="Commands\CommandModule.cs" />
|
||||
<Compile Include="Commands\CommandResource.cs" />
|
||||
<Compile Include="Config\NetImportConfigModule.cs" />
|
||||
<Compile Include="Config\NetImportConfigResource.cs" />
|
||||
<Compile Include="Extensions\AccessControlHeaders.cs" />
|
||||
<Compile Include="Extensions\Pipelines\CorsPipeline.cs" />
|
||||
<Compile Include="Extensions\Pipelines\UrlBasePipeline.cs" />
|
||||
<Compile Include="Extensions\Pipelines\RequestLoggingPipeline.cs" />
|
||||
<Compile Include="ExtraFiles\ExtraFileResource.cs" />
|
||||
<Compile Include="Frontend\Mappers\LoginHtmlMapper.cs" />
|
||||
<Compile Include="Frontend\Mappers\RobotsTxtMapper.cs" />
|
||||
<Compile Include="Indexers\ReleaseModuleBase.cs" />
|
||||
<Compile Include="Indexers\ReleasePushModule.cs" />
|
||||
<Compile Include="ExtraFiles\ExtraFileModule.cs" />
|
||||
@ -164,31 +148,6 @@
|
||||
<Compile Include="DiskSpace\DiskSpaceResource.cs" />
|
||||
<Compile Include="DownloadClient\DownloadClientModule.cs" />
|
||||
<Compile Include="DownloadClient\DownloadClientResource.cs" />
|
||||
<Compile Include="ErrorManagement\ApiException.cs" />
|
||||
<Compile Include="ErrorManagement\ErrorHandler.cs" />
|
||||
<Compile Include="ErrorManagement\ErrorModel.cs" />
|
||||
<Compile Include="ErrorManagement\NzbDroneErrorPipeline.cs" />
|
||||
<Compile Include="Exceptions\InvalidApiKeyException.cs" />
|
||||
<Compile Include="Extensions\NancyJsonSerializer.cs" />
|
||||
<Compile Include="Extensions\Pipelines\CacheHeaderPipeline.cs" />
|
||||
<Compile Include="Extensions\Pipelines\GZipPipeline.cs" />
|
||||
<Compile Include="Extensions\Pipelines\IfModifiedPipeline.cs" />
|
||||
<Compile Include="Extensions\Pipelines\IRegisterNancyPipeline.cs" />
|
||||
<Compile Include="Extensions\Pipelines\NzbDroneVersionPipeline.cs" />
|
||||
<Compile Include="Extensions\ReqResExtensions.cs" />
|
||||
<Compile Include="Extensions\RequestExtensions.cs" />
|
||||
<Compile Include="Frontend\CacheableSpecification.cs" />
|
||||
<Compile Include="Frontend\Mappers\BackupFileMapper.cs" />
|
||||
<Compile Include="Frontend\Mappers\CacheBreakerProvider.cs" />
|
||||
<Compile Include="Frontend\Mappers\FaviconMapper.cs" />
|
||||
<Compile Include="Frontend\Mappers\IMapHttpRequestsToDisk.cs" />
|
||||
<Compile Include="Frontend\Mappers\IndexHtmlMapper.cs" />
|
||||
<Compile Include="Frontend\Mappers\LogFileMapper.cs" />
|
||||
<Compile Include="Frontend\Mappers\MediaCoverMapper.cs" />
|
||||
<Compile Include="Frontend\Mappers\StaticResourceMapper.cs" />
|
||||
<Compile Include="Frontend\Mappers\StaticResourceMapperBase.cs" />
|
||||
<Compile Include="Frontend\Mappers\UpdateLogFileMapper.cs" />
|
||||
<Compile Include="Frontend\StaticResourceModule.cs" />
|
||||
<Compile Include="Health\HealthModule.cs" />
|
||||
<Compile Include="Health\HealthResource.cs" />
|
||||
<Compile Include="History\HistoryModule.cs" />
|
||||
@ -206,14 +165,10 @@
|
||||
<Compile Include="MediaCovers\MediaCoverModule.cs" />
|
||||
<Compile Include="Metadata\MetadataModule.cs" />
|
||||
<Compile Include="Metadata\MetadataResource.cs" />
|
||||
<Compile Include="NancyBootstrapper.cs" />
|
||||
<Compile Include="Notifications\NotificationModule.cs" />
|
||||
<Compile Include="Notifications\NotificationResource.cs" />
|
||||
<Compile Include="NzbDroneApiModule.cs" />
|
||||
<Compile Include="NzbDroneFeedModule.cs" />
|
||||
<Compile Include="NzbDroneRestModule.cs" />
|
||||
<Compile Include="NzbDroneRestModuleWithSignalR.cs" />
|
||||
<Compile Include="PagingResource.cs" />
|
||||
<Compile Include="Profiles\Languages\LanguageModule.cs" />
|
||||
<Compile Include="Profiles\Languages\LanguageResource.cs" />
|
||||
<Compile Include="Profiles\LegacyProfileModule.cs" />
|
||||
@ -228,24 +183,15 @@
|
||||
<Compile Include="Qualities\QualityDefinitionResource.cs" />
|
||||
<Compile Include="Queue\QueueModule.cs" />
|
||||
<Compile Include="Queue\QueueResource.cs" />
|
||||
<Compile Include="ResourceChangeMessage.cs" />
|
||||
<Compile Include="Restrictions\RestrictionModule.cs" />
|
||||
<Compile Include="Restrictions\RestrictionResource.cs" />
|
||||
<Compile Include="REST\NotFoundException.cs" />
|
||||
<Compile Include="REST\BadRequestException.cs" />
|
||||
<Compile Include="REST\MethodNotAllowedException.cs" />
|
||||
<Compile Include="REST\ResourceValidator.cs" />
|
||||
<Compile Include="REST\RestModule.cs" />
|
||||
<Compile Include="REST\RestResource.cs" />
|
||||
<Compile Include="RootFolders\RootFolderModule.cs" />
|
||||
<Compile Include="RootFolders\RootFolderResource.cs" />
|
||||
<Compile Include="Movies\AlternativeTitleResource.cs" />
|
||||
<Compile Include="MovieFiles\MovieFileResource.cs" />
|
||||
<Compile Include="Movies\FetchMovieListModule.cs" />
|
||||
<Compile Include="Movies\MovieLookupModule.cs" />
|
||||
<Compile Include="Series\SeriesModule.cs" />
|
||||
<Compile Include="Movies\MovieResource.cs" />
|
||||
<Compile Include="Series\SeriesResource.cs" />
|
||||
<Compile Include="System\Backup\BackupModule.cs" />
|
||||
<Compile Include="System\Backup\BackupResource.cs" />
|
||||
<Compile Include="System\Tasks\TaskModule.cs" />
|
||||
@ -253,13 +199,8 @@
|
||||
<Compile Include="System\SystemModule.cs" />
|
||||
<Compile Include="Tags\TagModule.cs" />
|
||||
<Compile Include="Tags\TagResource.cs" />
|
||||
<Compile Include="TinyIoCNancyBootstrapper.cs" />
|
||||
<Compile Include="Update\UpdateModule.cs" />
|
||||
<Compile Include="Update\UpdateResource.cs" />
|
||||
<Compile Include="Validation\NetImportSyncIntervalValidator.cs" />
|
||||
<Compile Include="Validation\RssSyncIntervalValidator.cs" />
|
||||
<Compile Include="Validation\EmptyCollectionValidator.cs" />
|
||||
<Compile Include="Validation\RuleBuilderExtensions.cs" />
|
||||
<Compile Include="Wanted\LegacyMissingModule.cs" />
|
||||
<Compile Include="Wanted\MovieCutoffModule.cs" />
|
||||
<Compile Include="Wanted\MovieMissingModule.cs" />
|
||||
@ -290,6 +231,10 @@
|
||||
<Project>{7C2CC69F-5CA0-4E5C-85CB-983F9F6C3B36}</Project>
|
||||
<Name>NzbDrone.SignalR</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Radarr.Http\Radarr.Http.csproj">
|
||||
<Project>{c5953dab-89db-46d9-a401-d620f54b776e}</Project>
|
||||
<Name>Radarr.Http</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
|
@ -1,66 +0,0 @@
|
||||
using NzbDrone.Api.REST;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.Datastore.Events;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
using NzbDrone.SignalR;
|
||||
|
||||
namespace NzbDrone.Api
|
||||
{
|
||||
public abstract class NzbDroneRestModuleWithSignalR<TResource, TModel> : NzbDroneRestModule<TResource>, IHandle<ModelEvent<TModel>>
|
||||
where TResource : RestResource, new()
|
||||
where TModel : ModelBase, new()
|
||||
{
|
||||
private readonly IBroadcastSignalRMessage _signalRBroadcaster;
|
||||
|
||||
protected NzbDroneRestModuleWithSignalR(IBroadcastSignalRMessage signalRBroadcaster)
|
||||
{
|
||||
_signalRBroadcaster = signalRBroadcaster;
|
||||
}
|
||||
|
||||
protected NzbDroneRestModuleWithSignalR(IBroadcastSignalRMessage signalRBroadcaster, string resource)
|
||||
: base(resource)
|
||||
{
|
||||
_signalRBroadcaster = signalRBroadcaster;
|
||||
}
|
||||
|
||||
public void Handle(ModelEvent<TModel> message)
|
||||
{
|
||||
if (message.Action == ModelAction.Deleted || message.Action == ModelAction.Sync)
|
||||
{
|
||||
BroadcastResourceChange(message.Action);
|
||||
}
|
||||
|
||||
BroadcastResourceChange(message.Action, message.Model.Id);
|
||||
}
|
||||
|
||||
protected void BroadcastResourceChange(ModelAction action, int id)
|
||||
{
|
||||
var resource = GetResourceById(id);
|
||||
BroadcastResourceChange(action, resource);
|
||||
}
|
||||
|
||||
|
||||
protected void BroadcastResourceChange(ModelAction action, TResource resource)
|
||||
{
|
||||
var signalRMessage = new SignalRMessage
|
||||
{
|
||||
Name = Resource,
|
||||
Body = new ResourceChangeMessage<TResource>(resource, action)
|
||||
};
|
||||
|
||||
_signalRBroadcaster.BroadcastMessage(signalRMessage);
|
||||
}
|
||||
|
||||
|
||||
protected void BroadcastResourceChange(ModelAction action)
|
||||
{
|
||||
var signalRMessage = new SignalRMessage
|
||||
{
|
||||
Name = Resource,
|
||||
Body = new ResourceChangeMessage<TResource>(action)
|
||||
};
|
||||
|
||||
_signalRBroadcaster.BroadcastMessage(signalRMessage);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
using NzbDrone.Api.Movies;
|
||||
using NzbDrone.Core.Parser;
|
||||
using Radarr.Http;
|
||||
|
||||
namespace NzbDrone.Api.Parse
|
||||
{
|
||||
public class ParseModule : NzbDroneRestModule<ParseResource>
|
||||
public class ParseModule : RadarrRestModule<ParseResource>
|
||||
{
|
||||
private readonly IParsingService _parsingService;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using NzbDrone.Api.Movies;
|
||||
using NzbDrone.Api.REST;
|
||||
using Radarr.Http.REST;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
|
||||
namespace NzbDrone.Api.Parse
|
||||
|
@ -1,13 +1,14 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using FluentValidation;
|
||||
using FluentValidation.Results;
|
||||
using NzbDrone.Api.REST;
|
||||
using NzbDrone.Api.Validation;
|
||||
using Radarr.Http.REST;
|
||||
using Radarr.Http.Validation;
|
||||
using NzbDrone.Core.Profiles.Delay;
|
||||
using Radarr.Http;
|
||||
|
||||
namespace NzbDrone.Api.Profiles.Delay
|
||||
{
|
||||
public class DelayProfileModule : NzbDroneRestModule<DelayProfileResource>
|
||||
public class DelayProfileModule : RadarrRestModule<DelayProfileResource>
|
||||
{
|
||||
private readonly IDelayProfileService _delayProfileService;
|
||||
|
||||
@ -72,4 +73,4 @@ private List<DelayProfileResource> GetAll()
|
||||
return _delayProfileService.All().ToResource();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Api.REST;
|
||||
using Radarr.Http.REST;
|
||||
using NzbDrone.Core.Indexers;
|
||||
using NzbDrone.Core.Profiles.Delay;
|
||||
|
||||
|
@ -1,11 +1,12 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Core.Parser;
|
||||
using Radarr.Http;
|
||||
|
||||
namespace NzbDrone.Api.Profiles.Languages
|
||||
{
|
||||
public class LanguageModule : NzbDroneRestModule<LanguageResource>
|
||||
public class LanguageModule : RadarrRestModule<LanguageResource>
|
||||
{
|
||||
public LanguageModule()
|
||||
{
|
||||
@ -36,4 +37,4 @@ private List<LanguageResource> GetAll()
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
using Newtonsoft.Json;
|
||||
using NzbDrone.Api.REST;
|
||||
using Radarr.Http.REST;
|
||||
|
||||
namespace NzbDrone.Api.Profiles.Languages
|
||||
{
|
||||
|
@ -1,14 +1,16 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FluentValidation;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.CustomFormats;
|
||||
using NzbDrone.Core.Profiles;
|
||||
using NzbDrone.Core.Validation;
|
||||
using Radarr.Http;
|
||||
using Radarr.Http.Mapping;
|
||||
|
||||
namespace NzbDrone.Api.Profiles
|
||||
{
|
||||
public class ProfileModule : NzbDroneRestModule<ProfileResource>
|
||||
public class ProfileModule : RadarrRestModule<ProfileResource>
|
||||
{
|
||||
private readonly IProfileService _profileService;
|
||||
private readonly ICustomFormatService _formatService;
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Api.Qualities;
|
||||
using NzbDrone.Api.REST;
|
||||
using NzbDrone.Api.Qualities;
|
||||
using Radarr.Http.REST;
|
||||
using NzbDrone.Core.Parser;
|
||||
using NzbDrone.Core.Profiles;
|
||||
using NzbDrone.Core.Qualities;
|
||||
|
@ -1,13 +1,15 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Core.CustomFormats;
|
||||
using NzbDrone.Core.Parser;
|
||||
using NzbDrone.Core.CustomFormats;
|
||||
using NzbDrone.Core.Parser;
|
||||
using NzbDrone.Core.Profiles;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using Radarr.Http;
|
||||
using Radarr.Http.Mapping;
|
||||
|
||||
namespace NzbDrone.Api.Profiles
|
||||
{
|
||||
public class ProfileSchemaModule : NzbDroneRestModule<ProfileResource>
|
||||
public class ProfileSchemaModule : RadarrRestModule<ProfileResource>
|
||||
{
|
||||
private readonly IQualityDefinitionService _qualityDefinitionService;
|
||||
private readonly ICustomFormatService _formatService;
|
||||
|
@ -2,9 +2,9 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[assembly: AssemblyTitle("NzbDrone.Api")]
|
||||
[assembly: AssemblyTitle("Radarr.Api")]
|
||||
|
||||
[assembly: Guid("4c0922d7-979e-4ff7-b44b-b8ac2100eeb5")]
|
||||
|
||||
|
||||
[assembly: InternalsVisibleTo("NzbDrone.Core")]
|
||||
[assembly: InternalsVisibleTo("Radarr.Core")]
|
||||
|
@ -1,18 +1,20 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FluentValidation;
|
||||
using FluentValidation.Results;
|
||||
using Nancy;
|
||||
using NzbDrone.Api.ClientSchema;
|
||||
using NzbDrone.Api.Extensions;
|
||||
using Radarr.Http.Extensions;
|
||||
using NzbDrone.Common.Reflection;
|
||||
using NzbDrone.Core.ThingiProvider;
|
||||
using NzbDrone.Core.Validation;
|
||||
using Newtonsoft.Json;
|
||||
using Radarr.Http;
|
||||
using Radarr.Http.ClientSchema;
|
||||
using Radarr.Http.Mapping;
|
||||
|
||||
namespace NzbDrone.Api
|
||||
{
|
||||
public abstract class ProviderModuleBase<TProviderResource, TProvider, TProviderDefinition> : NzbDroneRestModule<TProviderResource>
|
||||
public abstract class ProviderModuleBase<TProviderResource, TProvider, TProviderDefinition> : RadarrRestModule<TProviderResource>
|
||||
where TProviderDefinition : ProviderDefinition, new()
|
||||
where TProvider : IProvider
|
||||
where TProviderResource : ProviderResource, new()
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using NzbDrone.Api.ClientSchema;
|
||||
using NzbDrone.Api.REST;
|
||||
using System.Collections.Generic;
|
||||
using Radarr.Http.ClientSchema;
|
||||
using Radarr.Http.REST;
|
||||
using NzbDrone.Core.ThingiProvider;
|
||||
|
||||
namespace NzbDrone.Api
|
||||
@ -17,4 +17,4 @@ public class ProviderResource : RestResource
|
||||
|
||||
public List<ProviderResource> Presets { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,16 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FluentValidation;
|
||||
using Nancy;
|
||||
using NzbDrone.Api.Extensions;
|
||||
using NzbDrone.Api.Validation;
|
||||
using Radarr.Http.Extensions;
|
||||
using Radarr.Http.Validation;
|
||||
using NzbDrone.Core.CustomFormats;
|
||||
using NzbDrone.Core.Parser;
|
||||
using Radarr.Http;
|
||||
|
||||
namespace NzbDrone.Api.Qualities
|
||||
{
|
||||
public class CustomFormatModule : NzbDroneRestModule<CustomFormatResource>
|
||||
public class CustomFormatModule : RadarrRestModule<CustomFormatResource>
|
||||
{
|
||||
private readonly ICustomFormatService _formatService;
|
||||
private readonly IParsingService _parsingService;
|
||||
@ -22,7 +23,7 @@ public CustomFormatModule(ICustomFormatService formatService, IParsingService pa
|
||||
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).AreValidFormatTags();
|
||||
SharedValidator.RuleFor(c => c.FormatTags).SetValidator(new FormatTagValidator());
|
||||
SharedValidator.RuleFor(c => c.FormatTags).Must((v, c) =>
|
||||
{
|
||||
var allFormats = _formatService.All();
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Api.REST;
|
||||
using Radarr.Http.REST;
|
||||
using NzbDrone.Core.CustomFormats;
|
||||
|
||||
namespace NzbDrone.Api.Qualities
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Api.REST;
|
||||
using Radarr.Http.REST;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.CustomFormats;
|
||||
using NzbDrone.Core.Qualities;
|
||||
|
@ -1,13 +1,14 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NzbDrone.Api.REST;
|
||||
using Radarr.Http.REST;
|
||||
using NzbDrone.Core.Parser;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using Radarr.Http;
|
||||
|
||||
namespace NzbDrone.Api.Qualities
|
||||
{
|
||||
public class QualityDefinitionModule : NzbDroneRestModule<QualityDefinitionResource>
|
||||
public class QualityDefinitionModule : RadarrRestModule<QualityDefinitionResource>
|
||||
{
|
||||
private readonly IQualityDefinitionService _qualityDefinitionService;
|
||||
private readonly IParsingService _parsingService;
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Api.REST;
|
||||
using Radarr.Http.REST;
|
||||
using NzbDrone.Core.Qualities;
|
||||
|
||||
namespace NzbDrone.Api.Qualities
|
||||
|
@ -1,16 +1,17 @@
|
||||
using System;
|
||||
using System;
|
||||
using Nancy;
|
||||
using Nancy.Responses;
|
||||
using NzbDrone.Api.Extensions;
|
||||
using NzbDrone.Api.REST;
|
||||
using Radarr.Http.Extensions;
|
||||
using Radarr.Http.REST;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.Download.Pending;
|
||||
using NzbDrone.Core.Download.TrackedDownloads;
|
||||
using NzbDrone.Core.Queue;
|
||||
using Radarr.Http;
|
||||
|
||||
namespace NzbDrone.Api.Queue
|
||||
{
|
||||
public class QueueActionModule : NzbDroneRestModule<QueueResource>
|
||||
public class QueueActionModule : RadarrRestModule<QueueResource>
|
||||
{
|
||||
private readonly IQueueService _queueService;
|
||||
private readonly ITrackedDownloadService _trackedDownloadService;
|
||||
|
@ -1,14 +1,15 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Core.Datastore.Events;
|
||||
using NzbDrone.Core.Download.Pending;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
using NzbDrone.Core.Queue;
|
||||
using NzbDrone.SignalR;
|
||||
using Radarr.Http;
|
||||
|
||||
namespace NzbDrone.Api.Queue
|
||||
{
|
||||
public class QueueModule : NzbDroneRestModuleWithSignalR<QueueResource, Core.Queue.Queue>,
|
||||
public class QueueModule : RadarrRestModuleWithSignalR<QueueResource, Core.Queue.Queue>,
|
||||
IHandle<QueueUpdatedEvent>, IHandle<PendingReleasesUpdatedEvent>
|
||||
{
|
||||
private readonly IQueueService _queueService;
|
||||
@ -45,4 +46,4 @@ public void Handle(PendingReleasesUpdatedEvent message)
|
||||
BroadcastResourceChange(ModelAction.Sync);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NzbDrone.Api.REST;
|
||||
using Radarr.Http.REST;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using NzbDrone.Api.Movies;
|
||||
using NzbDrone.Core.Download.TrackedDownloads;
|
||||
|
@ -1,11 +1,12 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using FluentValidation;
|
||||
using NzbDrone.Core.RemotePathMappings;
|
||||
using NzbDrone.Core.Validation.Paths;
|
||||
using Radarr.Http;
|
||||
|
||||
namespace NzbDrone.Api.RemotePathMappings
|
||||
{
|
||||
public class RemotePathMappingModule : NzbDroneRestModule<RemotePathMappingResource>
|
||||
public class RemotePathMappingModule : RadarrRestModule<RemotePathMappingResource>
|
||||
{
|
||||
private readonly IRemotePathMappingService _remotePathMappingService;
|
||||
|
||||
@ -64,4 +65,4 @@ private void UpdateMapping(RemotePathMappingResource resource)
|
||||
_remotePathMappingService.Update(mapping);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Api.REST;
|
||||
using Radarr.Http.REST;
|
||||
using NzbDrone.Core.RemotePathMappings;
|
||||
|
||||
namespace NzbDrone.Api.RemotePathMappings
|
||||
|
@ -1,11 +1,12 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using FluentValidation.Results;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Restrictions;
|
||||
using Radarr.Http;
|
||||
|
||||
namespace NzbDrone.Api.Restrictions
|
||||
namespace Radarr.Http.RESTrictions
|
||||
{
|
||||
public class RestrictionModule : NzbDroneRestModule<RestrictionResource>
|
||||
public class RestrictionModule : RadarrRestModule<RestrictionResource>
|
||||
{
|
||||
private readonly IRestrictionService _restrictionService;
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Api.REST;
|
||||
using Radarr.Http.REST;
|
||||
using NzbDrone.Core.Restrictions;
|
||||
|
||||
namespace NzbDrone.Api.Restrictions
|
||||
namespace Radarr.Http.RESTrictions
|
||||
{
|
||||
public class RestrictionResource : RestResource
|
||||
{
|
||||
|
@ -1,12 +1,14 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using FluentValidation;
|
||||
using NzbDrone.Core.RootFolders;
|
||||
using NzbDrone.Core.Validation.Paths;
|
||||
using NzbDrone.SignalR;
|
||||
using Radarr.Http;
|
||||
using Radarr.Http.Mapping;
|
||||
|
||||
namespace NzbDrone.Api.RootFolders
|
||||
{
|
||||
public class RootFolderModule : NzbDroneRestModuleWithSignalR<RootFolderResource, RootFolder>
|
||||
public class RootFolderModule : RadarrRestModuleWithSignalR<RootFolderResource, RootFolder>
|
||||
{
|
||||
private readonly IRootFolderService _rootFolderService;
|
||||
|
||||
@ -14,9 +16,9 @@ public RootFolderModule(IRootFolderService rootFolderService,
|
||||
IBroadcastSignalRMessage signalRBroadcaster,
|
||||
RootFolderValidator rootFolderValidator,
|
||||
PathExistsValidator pathExistsValidator,
|
||||
DroneFactoryValidator droneFactoryValidator,
|
||||
MappedNetworkDriveValidator mappedNetworkDriveValidator,
|
||||
StartupFolderValidator startupFolderValidator,
|
||||
SystemFolderValidator systemFolderValidator,
|
||||
FolderWritableValidator folderWritableValidator)
|
||||
: base(signalRBroadcaster)
|
||||
{
|
||||
@ -31,10 +33,10 @@ public RootFolderModule(IRootFolderService rootFolderService,
|
||||
.Cascade(CascadeMode.StopOnFirstFailure)
|
||||
.IsValidPath()
|
||||
.SetValidator(rootFolderValidator)
|
||||
.SetValidator(droneFactoryValidator)
|
||||
.SetValidator(mappedNetworkDriveValidator)
|
||||
.SetValidator(startupFolderValidator)
|
||||
.SetValidator(pathExistsValidator)
|
||||
.SetValidator(systemFolderValidator)
|
||||
.SetValidator(folderWritableValidator);
|
||||
}
|
||||
|
||||
@ -60,4 +62,4 @@ private void DeleteFolder(int id)
|
||||
_rootFolderService.Remove(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Api.REST;
|
||||
using Radarr.Http.REST;
|
||||
using NzbDrone.Core.RootFolders;
|
||||
|
||||
namespace NzbDrone.Api.RootFolders
|
||||
|
@ -1,47 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NzbDrone.SignalR;
|
||||
|
||||
namespace NzbDrone.Api.Series
|
||||
{
|
||||
[Obsolete("SeriesModule is Obsolete, Remove with new UI")]
|
||||
public class SeriesModule : NzbDroneRestModuleWithSignalR<SeriesResource, Core.Movies.Movie>
|
||||
|
||||
{
|
||||
public SeriesModule(IBroadcastSignalRMessage signalRBroadcaster
|
||||
)
|
||||
: base(signalRBroadcaster)
|
||||
{
|
||||
GetResourceAll = AllSeries;
|
||||
GetResourceById = GetSeries;
|
||||
CreateResource = AddSeries;
|
||||
UpdateResource = UpdateSeries;
|
||||
DeleteResource = DeleteSeries;
|
||||
}
|
||||
|
||||
private SeriesResource GetSeries(int id)
|
||||
{
|
||||
return new SeriesResource();
|
||||
}
|
||||
|
||||
private List<SeriesResource> AllSeries()
|
||||
{
|
||||
return new List<SeriesResource>();
|
||||
}
|
||||
|
||||
private int AddSeries(SeriesResource seriesResource)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
private void UpdateSeries(SeriesResource seriesResource)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private void DeleteSeries(int id)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NzbDrone.Api.REST;
|
||||
|
||||
namespace NzbDrone.Api.Series
|
||||
{
|
||||
[Obsolete("SeriesResource is Obsolete, Remove with new UI")]
|
||||
public class SeriesResource : RestResource
|
||||
{
|
||||
public SeriesResource()
|
||||
{
|
||||
Title = "Series Endpoint Obsolete";
|
||||
}
|
||||
|
||||
//View Only
|
||||
public string Title { get; set; }
|
||||
}
|
||||
|
||||
}
|
@ -1,11 +1,12 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using NzbDrone.Core.Backup;
|
||||
using Radarr.Http;
|
||||
|
||||
namespace NzbDrone.Api.System.Backup
|
||||
{
|
||||
public class BackupModule : NzbDroneRestModule<BackupResource>
|
||||
public class BackupModule : RadarrRestModule<BackupResource>
|
||||
{
|
||||
private readonly IBackupService _backupService;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using NzbDrone.Api.REST;
|
||||
using System;
|
||||
using Radarr.Http.REST;
|
||||
using NzbDrone.Core.Backup;
|
||||
|
||||
namespace NzbDrone.Api.System.Backup
|
||||
|
@ -1,6 +1,6 @@
|
||||
using Nancy;
|
||||
using Nancy.Routing;
|
||||
using NzbDrone.Api.Extensions;
|
||||
using Radarr.Http.Extensions;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Configuration;
|
||||
|
@ -5,10 +5,11 @@
|
||||
using NzbDrone.Core.Jobs;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
using NzbDrone.SignalR;
|
||||
using Radarr.Http;
|
||||
|
||||
namespace NzbDrone.Api.System.Tasks
|
||||
{
|
||||
public class TaskModule : NzbDroneRestModuleWithSignalR<TaskResource, ScheduledTask>, IHandle<CommandExecutedEvent>
|
||||
public class TaskModule : RadarrRestModuleWithSignalR<TaskResource, ScheduledTask>, IHandle<CommandExecutedEvent>
|
||||
{
|
||||
private readonly ITaskManager _taskManager;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using NzbDrone.Api.REST;
|
||||
using System;
|
||||
using Radarr.Http.REST;
|
||||
|
||||
namespace NzbDrone.Api.System.Tasks
|
||||
{
|
||||
|
@ -1,12 +1,13 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using NzbDrone.Core.Datastore.Events;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
using NzbDrone.Core.Tags;
|
||||
using NzbDrone.SignalR;
|
||||
using Radarr.Http;
|
||||
|
||||
namespace NzbDrone.Api.Tags
|
||||
{
|
||||
public class TagModule : NzbDroneRestModuleWithSignalR<TagResource, Tag>, IHandle<TagsUpdatedEvent>
|
||||
public class TagModule : RadarrRestModuleWithSignalR<TagResource, Tag>, IHandle<TagsUpdatedEvent>
|
||||
{
|
||||
private readonly ITagService _tagService;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Api.REST;
|
||||
using Radarr.Http.REST;
|
||||
using NzbDrone.Core.Tags;
|
||||
|
||||
namespace NzbDrone.Api.Tags
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user