Reformat and apply Stylecop rules

This commit is contained in:
ta264 2019-12-22 22:08:53 +00:00 committed by Qstick
parent d4fa9b7345
commit f02fa629cc
1186 changed files with 7105 additions and 5616 deletions

View File

@ -9,6 +9,35 @@ insert_final_newline = true
indent_style = space indent_style = space
indent_size = 4 indent_size = 4
# Sort using and Import directives with System.* appearing first
dotnet_sort_system_directives_first = true
# Avoid "this." and "Me." if not necessary
dotnet_style_qualification_for_field = false:refactoring
dotnet_style_qualification_for_property = false:refactoring
dotnet_style_qualification_for_method = false:refactoring
dotnet_style_qualification_for_event = false:refactoring
# Indentation preferences
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents = true
csharp_indent_case_contents_when_block = true
csharp_indent_switch_labels = true
csharp_indent_labels = flush_left
dotnet_style_qualification_for_field = false:suggestion
dotnet_style_qualification_for_property = false:suggestion
dotnet_style_qualification_for_method = false:suggestion
dotnet_style_qualification_for_event = false:suggestion
dotnet_naming_style.instance_field_style.capitalization = camel_case
dotnet_naming_style.instance_field_style.required_prefix = _
# Prefer "var" everywhere
csharp_style_var_for_built_in_types = true:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
csharp_style_var_elsewhere = true:suggestion
[*.{js,html,js,hbs,less,css}] [*.{js,html,js,hbs,less,css}]
charset = utf-8 charset = utf-8
trim_trailing_whitespace = true trim_trailing_whitespace = true

1
.gitignore vendored
View File

@ -85,7 +85,6 @@ TestResults
[Tt]est[Rr]esult* [Tt]est[Rr]esult*
*.Cache *.Cache
ClientBin ClientBin
[Ss]tyle[Cc]op.*
~$* ~$*
*.dbmdl *.dbmdl
Generated_Code #added for RIA/Silverlight projects Generated_Code #added for RIA/Silverlight projects

View File

@ -2,7 +2,7 @@
<!-- Common to all Radarr Projects --> <!-- Common to all Radarr Projects -->
<PropertyGroup> <PropertyGroup>
<CodeAnalysisRuleSet>$(SolutionDir)Stylecop.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>$(SolutionDir)Stylecop.ruleset</CodeAnalysisRuleSet>
<!-- <TreatWarningsAsErrors>true</TreatWarningsAsErrors> --> <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch> <TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
@ -94,7 +94,7 @@
</ItemGroup> </ItemGroup>
<!-- Set up stylecop --> <!-- Set up stylecop -->
<ItemGroup Condition="'$(RadarrProject)'=='true' and '$(RadarrOutputType)'!='Test'"> <ItemGroup Condition="'$(RadarrProject)'=='true'">
<!-- StyleCop analysis --> <!-- StyleCop analysis -->
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118"> <PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>

View File

@ -50,4 +50,3 @@ namespace Marr.Data.Converters
#endregion #endregion
} }
} }

View File

@ -105,7 +105,8 @@ namespace MonoTorrent
int infohashOffset = 0; int infohashOffset = 0;
byte[] hash = new byte[20]; byte[] hash = new byte[20];
var temp = new byte[8]; var temp = new byte[8];
for (int i = 0; i < hash.Length; ) { for (int i = 0; i < hash.Length;)
{
for (int j = 0; j < 8; j++) for (int j = 0; j < 8; j++)
if (!base32DecodeTable.TryGetValue(infoHash[infohashOffset++], out temp[j])) if (!base32DecodeTable.TryGetValue(infoHash[infohashOffset++], out temp[j]))
throw new ArgumentException("infoHash", "Value is not a valid base32 encoded string"); throw new ArgumentException("infoHash", "Value is not a valid base32 encoded string");

View File

@ -7,19 +7,23 @@ namespace MonoTorrent
{ {
public class MagnetLink public class MagnetLink
{ {
public RawTrackerTier AnnounceUrls { public RawTrackerTier AnnounceUrls
{
get; private set; get; private set;
} }
public InfoHash InfoHash { public InfoHash InfoHash
{
get; private set; get; private set;
} }
public string Name { public string Name
{
get; private set; get; private set;
} }
public List<string> Webseeds { public List<string> Webseeds
{
get; private set; get; private set;
} }

View File

@ -7,12 +7,14 @@ namespace MonoTorrent
{ {
public class RawTrackerTier : IList<string> public class RawTrackerTier : IList<string>
{ {
public string this[int index] { public string this[int index]
{
get { return ((BEncodedString)Tier[index]).Text; } get { return ((BEncodedString)Tier[index]).Text; }
set { Tier[index] = new BEncodedString(value); } set { Tier[index] = new BEncodedString(value); }
} }
internal BEncodedList Tier { internal BEncodedList Tier
{
get; set; get; set;
} }
@ -74,11 +76,13 @@ namespace MonoTorrent
return Tier.Remove((BEncodedString)item); return Tier.Remove((BEncodedString)item);
} }
public int Count { public int Count
{
get { return Tier.Count; } get { return Tier.Count; }
} }
public bool IsReadOnly { public bool IsReadOnly
{
get { return Tier.IsReadOnly; } get { return Tier.IsReadOnly; }
} }

View File

@ -7,7 +7,8 @@ namespace MonoTorrent
{ {
public class RawTrackerTiers : IList<RawTrackerTier> public class RawTrackerTiers : IList<RawTrackerTier>
{ {
BEncodedList Tiers { BEncodedList Tiers
{
get; set; get; set;
} }
@ -23,7 +24,8 @@ namespace MonoTorrent
public int IndexOf(RawTrackerTier item) public int IndexOf(RawTrackerTier item)
{ {
if (item != null) { if (item != null)
{
for (int i = 0; i < Tiers.Count; i++) for (int i = 0; i < Tiers.Count; i++)
if (item.Tier == Tiers[i]) if (item.Tier == Tiers[i])
return i; return i;
@ -41,7 +43,8 @@ namespace MonoTorrent
Tiers.RemoveAt(index); Tiers.RemoveAt(index);
} }
public RawTrackerTier this[int index] { public RawTrackerTier this[int index]
{
get { return new RawTrackerTier((BEncodedList)Tiers[index]); } get { return new RawTrackerTier((BEncodedList)Tiers[index]); }
set { Tiers[index] = value.Tier; } set { Tiers[index] = value.Tier; }
} }
@ -82,11 +85,13 @@ namespace MonoTorrent
return index != -1; return index != -1;
} }
public int Count { public int Count
{
get { return Tiers.Count; } get { return Tiers.Count; }
} }
public bool IsReadOnly { public bool IsReadOnly
{
get { return Tiers.IsReadOnly; } get { return Tiers.IsReadOnly; }
} }

View File

@ -36,7 +36,8 @@ namespace MonoTorrent
if (e == null) if (e == null)
return; return;
ThreadPool.QueueUserWorkItem(delegate { ThreadPool.QueueUserWorkItem(delegate
{
if (e != null) if (e != null)
e(o, args); e(o, args);
}); });

View File

@ -42,21 +42,30 @@ namespace MonoTorrent
int xchar; int xchar;
char ch; char ch;
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++)
{
ch = s[i]; ch = s[i];
if (ch == '%' && i + 2 < len && s [i + 1] != '%') { if (ch == '%' && i + 2 < len && s[i + 1] != '%')
if (s [i + 1] == 'u' && i + 5 < len) { {
if (s[i + 1] == 'u' && i + 5 < len)
{
// unicode hex sequence // unicode hex sequence
xchar = GetChar(s, i + 2, 4); xchar = GetChar(s, i + 2, 4);
if (xchar != -1) { if (xchar != -1)
{
WriteCharBytes(bytes, (char)xchar, e); WriteCharBytes(bytes, (char)xchar, e);
i += 5; i += 5;
} else }
else
WriteCharBytes(bytes, '%', e); WriteCharBytes(bytes, '%', e);
} else if ((xchar = GetChar (s, i + 1, 2)) != -1) { }
else if ((xchar = GetChar(s, i + 1, 2)) != -1)
{
WriteCharBytes(bytes, (char)xchar, e); WriteCharBytes(bytes, (char)xchar, e);
i += 2; i += 2;
} else { }
else
{
WriteCharBytes(bytes, '%', e); WriteCharBytes(bytes, '%', e);
} }
continue; continue;
@ -71,20 +80,25 @@ namespace MonoTorrent
return bytes.ToArray(); return bytes.ToArray();
} }
static void UrlEncodeChar (char c, Stream result, bool isUnicode) { static void UrlEncodeChar(char c, Stream result, bool isUnicode)
if (c > ' ' && NotEncoded (c)) { {
if (c > ' ' && NotEncoded(c))
{
result.WriteByte((byte)c); result.WriteByte((byte)c);
return; return;
} }
if (c==' ') { if (c == ' ')
{
result.WriteByte((byte)'+'); result.WriteByte((byte)'+');
return; return;
} }
if ((c < '0') || if ((c < '0') ||
(c < 'A' && c > '9') || (c < 'A' && c > '9') ||
(c > 'Z' && c < 'a') || (c > 'Z' && c < 'a') ||
(c > 'z')) { (c > 'z'))
if (isUnicode && c > 127) { {
if (isUnicode && c > 127)
{
result.WriteByte((byte)'%'); result.WriteByte((byte)'%');
result.WriteByte((byte)'u'); result.WriteByte((byte)'u');
result.WriteByte((byte)'0'); result.WriteByte((byte)'0');
@ -98,7 +112,8 @@ namespace MonoTorrent
idx = ((int)c) & 0x0F; idx = ((int)c) & 0x0F;
result.WriteByte((byte)hexChars[idx]); result.WriteByte((byte)hexChars[idx]);
} }
else { else
{
result.WriteByte((byte)c); result.WriteByte((byte)c);
} }
} }
@ -107,7 +122,8 @@ namespace MonoTorrent
{ {
int val = 0; int val = 0;
int end = length + offset; int end = length + offset;
for (int i = offset; i < end; i++) { for (int i = offset; i < end; i++)
{
char c = str[i]; char c = str[i];
if (c > 127) if (c > 127)
return -1; return -1;
@ -143,10 +159,12 @@ namespace MonoTorrent
static void WriteCharBytes(List<byte> buf, char ch, Encoding e) static void WriteCharBytes(List<byte> buf, char ch, Encoding e)
{ {
if (ch > 255) { if (ch > 255)
{
foreach (byte b in e.GetBytes(new char[] { ch })) foreach (byte b in e.GetBytes(new char[] { ch }))
buf.Add(b); buf.Add(b);
} else }
else
buf.Add((byte)ch); buf.Add((byte)ch);
} }
} }

View File

@ -1,8 +1,8 @@
using FluentAssertions; using FluentAssertions;
using NUnit.Framework; using NUnit.Framework;
using Radarr.Http.ClientSchema;
using NzbDrone.Core.Annotations; using NzbDrone.Core.Annotations;
using NzbDrone.Test.Common; using NzbDrone.Test.Common;
using Radarr.Http.ClientSchema;
namespace NzbDrone.Api.Test.ClientSchemaTests namespace NzbDrone.Api.Test.ClientSchemaTests
{ {
@ -16,7 +16,6 @@ namespace NzbDrone.Api.Test.ClientSchemaTests
schema.Should().HaveCount(2); schema.Should().HaveCount(2);
} }
[Test] [Test]
public void schema_should_have_proper_fields() public void schema_should_have_proper_fields()
{ {
@ -31,10 +30,8 @@ namespace NzbDrone.Api.Test.ClientSchemaTests
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 == 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 == 0 && c.Name == "firstName" && c.Label == "First Name" && c.HelpText == "Your First Name" && (string)c.Value == "Bob");
} }
} }
public class TestModel public class TestModel
{ {
[FieldDefinition(0, Label = "First Name", HelpText = "Your First Name")] [FieldDefinition(0, Label = "First Name", HelpText = "Your First Name")]

View File

@ -1,9 +1,9 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using NzbDrone.Api.Movies; using NzbDrone.Api.Movies;
using Radarr.Http.REST;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Indexers; using NzbDrone.Core.Indexers;
using NzbDrone.Core.Qualities;
using Radarr.Http.REST;
namespace NzbDrone.Api.Blacklist namespace NzbDrone.Api.Blacklist
{ {
@ -25,7 +25,10 @@ namespace NzbDrone.Api.Blacklist
{ {
public static BlacklistResource MapToResource(this Core.Blacklisting.Blacklist model) public static BlacklistResource MapToResource(this Core.Blacklisting.Blacklist model)
{ {
if (model == null) return null; if (model == null)
{
return null;
}
return new BlacklistResource return new BlacklistResource
{ {

View File

@ -1,4 +1,3 @@
using Nancy;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -6,10 +5,11 @@ using Ical.Net;
using Ical.Net.CalendarComponents; using Ical.Net.CalendarComponents;
using Ical.Net.DataTypes; using Ical.Net.DataTypes;
using Ical.Net.Serialization; using Ical.Net.Serialization;
using NzbDrone.Core.Movies; using Nancy;
using Nancy.Responses; using Nancy.Responses;
using NzbDrone.Core.Tags;
using NzbDrone.Common.Extensions; using NzbDrone.Common.Extensions;
using NzbDrone.Core.Movies;
using NzbDrone.Core.Tags;
namespace NzbDrone.Api.Calendar namespace NzbDrone.Api.Calendar
{ {
@ -36,6 +36,7 @@ namespace NzbDrone.Api.Calendar
var start = DateTime.Today.AddDays(-pastDays); var start = DateTime.Today.AddDays(-pastDays);
var end = DateTime.Today.AddDays(futureDays); var end = DateTime.Today.AddDays(futureDays);
var unmonitored = false; var unmonitored = false;
//var premiersOnly = false; //var premiersOnly = false;
var tags = new List<int>(); var tags = new List<int>();
@ -45,11 +46,19 @@ namespace NzbDrone.Api.Calendar
var queryPastDays = Request.Query.PastDays; var queryPastDays = Request.Query.PastDays;
var queryFutureDays = Request.Query.FutureDays; var queryFutureDays = Request.Query.FutureDays;
var queryUnmonitored = Request.Query.Unmonitored; var queryUnmonitored = Request.Query.Unmonitored;
// var queryPremiersOnly = Request.Query.PremiersOnly; // var queryPremiersOnly = Request.Query.PremiersOnly;
var queryTags = Request.Query.Tags; var queryTags = Request.Query.Tags;
if (queryStart.HasValue) start = DateTime.Parse(queryStart.Value); if (queryStart.HasValue)
if (queryEnd.HasValue) end = DateTime.Parse(queryEnd.Value); {
start = DateTime.Parse(queryStart.Value);
}
if (queryEnd.HasValue)
{
end = DateTime.Parse(queryEnd.Value);
}
if (queryPastDays.HasValue) if (queryPastDays.HasValue)
{ {
@ -72,7 +81,6 @@ namespace NzbDrone.Api.Calendar
//{ //{
// premiersOnly = bool.Parse(queryPremiersOnly.Value); // premiersOnly = bool.Parse(queryPremiersOnly.Value);
//} //}
if (queryTags.HasValue) if (queryTags.HasValue)
{ {
var tagInput = (string)queryTags.Value.ToString(); var tagInput = (string)queryTags.Value.ToString();
@ -98,7 +106,6 @@ namespace NzbDrone.Api.Calendar
CreateEvent(calendar, movie, true); CreateEvent(calendar, movie, true);
CreateEvent(calendar, movie, false); CreateEvent(calendar, movie, false);
} }
var serializer = (IStringSerializer)new SerializerFactory().Build(calendar.GetType(), new SerializationContext()); var serializer = (IStringSerializer)new SerializerFactory().Build(calendar.GetType(), new SerializationContext());

View File

@ -20,7 +20,6 @@ namespace NzbDrone.Api.Calendar
IMapCoversToLocal coverMapper) IMapCoversToLocal coverMapper)
: base(signalR, "calendar") : base(signalR, "calendar")
{ {
_moviesService = moviesService; _moviesService = moviesService;
_coverMapper = coverMapper; _coverMapper = coverMapper;
@ -37,9 +36,20 @@ namespace NzbDrone.Api.Calendar
var queryEnd = Request.Query.End; var queryEnd = Request.Query.End;
var queryIncludeUnmonitored = Request.Query.Unmonitored; var queryIncludeUnmonitored = Request.Query.Unmonitored;
if (queryStart.HasValue) start = DateTime.Parse(queryStart.Value); if (queryStart.HasValue)
if (queryEnd.HasValue) end = DateTime.Parse(queryEnd.Value); {
if (queryIncludeUnmonitored.HasValue) includeUnmonitored = Convert.ToBoolean(queryIncludeUnmonitored.Value); start = DateTime.Parse(queryStart.Value);
}
if (queryEnd.HasValue)
{
end = DateTime.Parse(queryEnd.Value);
}
if (queryIncludeUnmonitored.HasValue)
{
includeUnmonitored = Convert.ToBoolean(queryIncludeUnmonitored.Value);
}
var resources = _moviesService.GetMoviesBetweenDates(start, end, includeUnmonitored).Select(MapToResource); var resources = _moviesService.GetMoviesBetweenDates(start, end, includeUnmonitored).Select(MapToResource);
@ -48,7 +58,10 @@ namespace NzbDrone.Api.Calendar
protected MovieResource MapToResource(Movie movie) protected MovieResource MapToResource(Movie movie)
{ {
if (movie == null) return null; if (movie == null)
{
return null;
}
var resource = movie.ToResource(); var resource = movie.ToResource();

View File

@ -2,8 +2,6 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using NLog; using NLog;
using Radarr.Http.Extensions;
using Radarr.Http.Validation;
using NzbDrone.Common; using NzbDrone.Common;
using NzbDrone.Core.Datastore.Events; using NzbDrone.Core.Datastore.Events;
using NzbDrone.Core.Messaging.Commands; using NzbDrone.Core.Messaging.Commands;
@ -11,7 +9,8 @@ using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.ProgressMessaging; using NzbDrone.Core.ProgressMessaging;
using NzbDrone.SignalR; using NzbDrone.SignalR;
using Radarr.Http; using Radarr.Http;
using Radarr.Http.Extensions;
using Radarr.Http.Validation;
namespace NzbDrone.Api.Commands namespace NzbDrone.Api.Commands
{ {

View File

@ -2,8 +2,8 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Newtonsoft.Json; using Newtonsoft.Json;
using Radarr.Http.REST;
using NzbDrone.Core.Messaging.Commands; using NzbDrone.Core.Messaging.Commands;
using Radarr.Http.REST;
namespace NzbDrone.Api.Commands namespace NzbDrone.Api.Commands
{ {
@ -27,30 +27,21 @@ namespace NzbDrone.Api.Commands
//Legacy //Legacy
public CommandStatus State public CommandStatus State
{ {
get get { return Status; }
{
return Status;
}
set { } set { }
} }
public bool Manual public bool Manual
{ {
get get { return Trigger == CommandTrigger.Manual; }
{
return Trigger == CommandTrigger.Manual;
}
set { } set { }
} }
public DateTime StartedOn public DateTime StartedOn
{ {
get get { return Queued; }
{
return Queued;
}
set { } set { }
} }
@ -59,37 +50,51 @@ namespace NzbDrone.Api.Commands
{ {
get get
{ {
if (Started.HasValue)
if (Started.HasValue) return Started.Value; {
return Started.Value;
}
return Ended; return Ended;
} }
set { } set
{
}
} }
public bool SendUpdatesToClient public bool SendUpdatesToClient
{ {
get get
{ {
if (Body != null) return (Body as Command).SendUpdatesToClient; if (Body != null)
{
return (Body as Command).SendUpdatesToClient;
}
return false; return false;
} }
set { } set
{
}
} }
public bool UpdateScheduledTask public bool UpdateScheduledTask
{ {
get get
{ {
if (Body != null) return (Body as Command).UpdateScheduledTask; if (Body != null)
{
return (Body as Command).UpdateScheduledTask;
}
return false; return false;
} }
set { } set
{
}
} }
public DateTime? LastExecutionTime { get; set; } public DateTime? LastExecutionTime { get; set; }
@ -99,7 +104,10 @@ namespace NzbDrone.Api.Commands
{ {
public static CommandResource ToResource(this CommandModel model) public static CommandResource ToResource(this CommandModel model)
{ {
if (model == null) return null; if (model == null)
{
return null;
}
return new CommandResource return new CommandResource
{ {

View File

@ -7,7 +7,6 @@ namespace NzbDrone.Api.Config
public DownloadClientConfigModule(IConfigService configService) public DownloadClientConfigModule(IConfigService configService)
: base(configService) : base(configService)
{ {
} }
protected override DownloadClientConfigResource ToResource(IConfigService model) protected override DownloadClientConfigResource ToResource(IConfigService model)

View File

@ -1,5 +1,5 @@
using Radarr.Http.REST;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using Radarr.Http.REST;
namespace NzbDrone.Api.Config namespace NzbDrone.Api.Config
{ {

View File

@ -1,8 +1,8 @@
using Radarr.Http.REST; using NzbDrone.Common.Http.Proxy;
using NzbDrone.Core.Authentication; using NzbDrone.Core.Authentication;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.Update; using NzbDrone.Core.Update;
using NzbDrone.Common.Http.Proxy; using Radarr.Http.REST;
namespace NzbDrone.Api.Config namespace NzbDrone.Api.Config
{ {
@ -54,6 +54,7 @@ namespace NzbDrone.Api.Config
LaunchBrowser = model.LaunchBrowser, LaunchBrowser = model.LaunchBrowser,
AuthenticationMethod = model.AuthenticationMethod, AuthenticationMethod = model.AuthenticationMethod,
AnalyticsEnabled = model.AnalyticsEnabled, AnalyticsEnabled = model.AnalyticsEnabled,
//Username //Username
//Password //Password
LogLevel = model.LogLevel, LogLevel = model.LogLevel,

View File

@ -1,12 +1,11 @@
using FluentValidation; using FluentValidation;
using Radarr.Http.Validation;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using Radarr.Http.Validation;
namespace NzbDrone.Api.Config namespace NzbDrone.Api.Config
{ {
public class IndexerConfigModule : NzbDroneConfigModule<IndexerConfigResource> public class IndexerConfigModule : NzbDroneConfigModule<IndexerConfigResource>
{ {
public IndexerConfigModule(IConfigService configService) public IndexerConfigModule(IConfigService configService)
: base(configService) : base(configService)
{ {

View File

@ -1,6 +1,6 @@
using Radarr.Http.REST;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.Parser; using NzbDrone.Core.Parser;
using Radarr.Http.REST;
namespace NzbDrone.Api.Config namespace NzbDrone.Api.Config
{ {

View File

@ -1,6 +1,6 @@
using Radarr.Http.REST;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.MediaFiles; using NzbDrone.Core.MediaFiles;
using Radarr.Http.REST;
namespace NzbDrone.Api.Config namespace NzbDrone.Api.Config
{ {

View File

@ -2,9 +2,9 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using FluentValidation; using FluentValidation;
using FluentValidation.Results; using FluentValidation.Results;
using Nancy.ModelBinding;
using NzbDrone.Common.Extensions; using NzbDrone.Common.Extensions;
using NzbDrone.Core.Organizer; using NzbDrone.Core.Organizer;
using Nancy.ModelBinding;
using Radarr.Http; using Radarr.Http;
namespace NzbDrone.Api.Config namespace NzbDrone.Api.Config
@ -87,11 +87,9 @@ namespace NzbDrone.Api.Config
var movieSampleResult = _filenameSampleService.GetMovieSample(nameSpec); var movieSampleResult = _filenameSampleService.GetMovieSample(nameSpec);
//var standardMovieValidationResult = _filenameValidationService.ValidateMovieFilename(movieSampleResult); For now, let's hope the user is not stupid enough :/ //var standardMovieValidationResult = _filenameValidationService.ValidateMovieFilename(movieSampleResult); For now, let's hope the user is not stupid enough :/
var validationFailures = new List<ValidationFailure>(); var validationFailures = new List<ValidationFailure>();
//validationFailures.AddIfNotNull(standardMovieValidationResult); //validationFailures.AddIfNotNull(standardMovieValidationResult);
if (validationFailures.Any()) if (validationFailures.Any())
{ {
throw new ValidationException(validationFailures.DistinctBy(v => v.PropertyName).ToArray()); throw new ValidationException(validationFailures.DistinctBy(v => v.PropertyName).ToArray());

View File

@ -1,5 +1,5 @@
using Radarr.Http.REST;
using NzbDrone.Core.Organizer; using NzbDrone.Core.Organizer;
using Radarr.Http.REST;
namespace NzbDrone.Api.Config namespace NzbDrone.Api.Config
{ {
@ -33,6 +33,7 @@ namespace NzbDrone.Api.Config
MultiEpisodeStyle = model.MultiEpisodeStyle, MultiEpisodeStyle = model.MultiEpisodeStyle,
StandardMovieFormat = model.StandardMovieFormat, StandardMovieFormat = model.StandardMovieFormat,
MovieFolderFormat = model.MovieFolderFormat MovieFolderFormat = model.MovieFolderFormat
//IncludeSeriesTitle //IncludeSeriesTitle
//IncludeEpisodeTitle //IncludeEpisodeTitle
//IncludeQuality //IncludeQuality

View File

@ -1,11 +1,10 @@
using Radarr.Http.Validation;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using Radarr.Http.Validation;
namespace NzbDrone.Api.Config namespace NzbDrone.Api.Config
{ {
public class NetImportConfigModule : NzbDroneConfigModule<NetImportConfigResource> public class NetImportConfigModule : NzbDroneConfigModule<NetImportConfigResource>
{ {
public NetImportConfigModule(IConfigService configService) public NetImportConfigModule(IConfigService configService)
: base(configService) : base(configService)
{ {

View File

@ -1,5 +1,5 @@
using Radarr.Http.REST; using NzbDrone.Core.Configuration;
using NzbDrone.Core.Configuration; using Radarr.Http.REST;
namespace NzbDrone.Api.Config namespace NzbDrone.Api.Config
{ {

View File

@ -1,12 +1,13 @@
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using NzbDrone.Core.Configuration;
using Radarr.Http; using Radarr.Http;
using Radarr.Http.REST; using Radarr.Http.REST;
using NzbDrone.Core.Configuration;
namespace NzbDrone.Api.Config namespace NzbDrone.Api.Config
{ {
public abstract class NzbDroneConfigModule<TResource> : RadarrRestModule<TResource> where TResource : RestResource, new() public abstract class NzbDroneConfigModule<TResource> : RadarrRestModule<TResource>
where TResource : RestResource, new()
{ {
private readonly IConfigService _configService; private readonly IConfigService _configService;
@ -15,8 +16,8 @@ namespace NzbDrone.Api.Config
{ {
} }
protected NzbDroneConfigModule(string resource, IConfigService configService) : protected NzbDroneConfigModule(string resource, IConfigService configService)
base("config/" + resource.Trim('/')) : base("config/" + resource.Trim('/'))
{ {
_configService = configService; _configService = configService;

View File

@ -7,7 +7,6 @@ namespace NzbDrone.Api.Config
public UiConfigModule(IConfigService configService) public UiConfigModule(IConfigService configService)
: base(configService) : base(configService)
{ {
} }
protected override UiConfigResource ToResource(IConfigService model) protected override UiConfigResource ToResource(IConfigService model)

View File

@ -1,5 +1,5 @@
using Radarr.Http.REST; using NzbDrone.Core.Configuration;
using NzbDrone.Core.Configuration; using Radarr.Http.REST;
namespace NzbDrone.Api.Config namespace NzbDrone.Api.Config
{ {

View File

@ -15,7 +15,6 @@ namespace NzbDrone.Api.DiskSpace
GetResourceAll = GetFreeSpace; GetResourceAll = GetFreeSpace;
} }
public List<DiskSpaceResource> GetFreeSpace() public List<DiskSpaceResource> GetFreeSpace()
{ {
return _diskSpaceService.GetFreeSpace().ConvertAll(DiskSpaceResourceMapper.MapToResource); return _diskSpaceService.GetFreeSpace().ConvertAll(DiskSpaceResourceMapper.MapToResource);

View File

@ -14,7 +14,10 @@ namespace NzbDrone.Api.DiskSpace
{ {
public static DiskSpaceResource MapToResource(this Core.DiskSpace.DiskSpace model) public static DiskSpaceResource MapToResource(this Core.DiskSpace.DiskSpace model)
{ {
if (model == null) return null; if (model == null)
{
return null;
}
return new DiskSpaceResource return new DiskSpaceResource
{ {

View File

@ -29,7 +29,11 @@ namespace NzbDrone.Api.DownloadClient
protected override void Validate(DownloadClientDefinition definition, bool includeWarnings) protected override void Validate(DownloadClientDefinition definition, bool includeWarnings)
{ {
if (!definition.Enable) return; if (!definition.Enable)
{
return;
}
base.Validate(definition, includeWarnings); base.Validate(definition, includeWarnings);
} }
} }

View File

@ -1,10 +1,10 @@
using System.Collections.Generic; using System.Collections.Generic;
using Radarr.Http.REST;
using NzbDrone.Core.Extras.Files; using NzbDrone.Core.Extras.Files;
using NzbDrone.Core.Extras.Metadata.Files; using NzbDrone.Core.Extras.Metadata.Files;
using NzbDrone.Core.Extras.Others; using NzbDrone.Core.Extras.Others;
using NzbDrone.Core.Extras.Subtitles; using NzbDrone.Core.Extras.Subtitles;
using Radarr.Http; using Radarr.Http;
using Radarr.Http.REST;
namespace NzbDrone.Api.ExtraFiles namespace NzbDrone.Api.ExtraFiles
{ {

View File

@ -1,10 +1,10 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Radarr.Http.REST;
using NzbDrone.Core.Extras.Files; using NzbDrone.Core.Extras.Files;
using NzbDrone.Core.Extras.Metadata.Files; using NzbDrone.Core.Extras.Metadata.Files;
using NzbDrone.Core.Extras.Others; using NzbDrone.Core.Extras.Others;
using NzbDrone.Core.Extras.Subtitles; using NzbDrone.Core.Extras.Subtitles;
using Radarr.Http.REST;
namespace NzbDrone.Api.ExtraFiles namespace NzbDrone.Api.ExtraFiles
{ {
@ -21,7 +21,10 @@ namespace NzbDrone.Api.ExtraFiles
{ {
public static ExtraFileResource ToResource(this MetadataFile model) public static ExtraFileResource ToResource(this MetadataFile model)
{ {
if (model == null) return null; if (model == null)
{
return null;
}
return new ExtraFileResource return new ExtraFileResource
{ {
@ -36,7 +39,10 @@ namespace NzbDrone.Api.ExtraFiles
public static ExtraFileResource ToResource(this SubtitleFile model) public static ExtraFileResource ToResource(this SubtitleFile model)
{ {
if (model == null) return null; if (model == null)
{
return null;
}
return new ExtraFileResource return new ExtraFileResource
{ {
@ -51,7 +57,10 @@ namespace NzbDrone.Api.ExtraFiles
public static ExtraFileResource ToResource(this OtherExtraFile model) public static ExtraFileResource ToResource(this OtherExtraFile model)
{ {
if (model == null) return null; if (model == null)
{
return null;
}
return new ExtraFileResource return new ExtraFileResource
{ {
@ -78,6 +87,5 @@ namespace NzbDrone.Api.ExtraFiles
{ {
return movies.Select(ToResource).ToList(); return movies.Select(ToResource).ToList();
} }
} }
} }

View File

@ -1,10 +1,10 @@
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using Nancy; using Nancy;
using Radarr.Http.Extensions;
using NzbDrone.Common.Disk; using NzbDrone.Common.Disk;
using NzbDrone.Common.Extensions; using NzbDrone.Common.Extensions;
using NzbDrone.Core.MediaFiles; using NzbDrone.Core.MediaFiles;
using Radarr.Http.Extensions;
namespace NzbDrone.Api.FileSystem namespace NzbDrone.Api.FileSystem
{ {
@ -60,7 +60,8 @@ namespace NzbDrone.Api.FileSystem
return new string[0]; return new string[0];
} }
return _diskScanService.GetVideoFiles(path).Select(f => new { return _diskScanService.GetVideoFiles(path).Select(f => new
{
Path = f, Path = f,
RelativePath = path.GetRelativePath(f), RelativePath = path.GetRelativePath(f),
Name = Path.GetFileName(f) Name = Path.GetFileName(f)

View File

@ -1,8 +1,8 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Radarr.Http.REST;
using NzbDrone.Common.Http; using NzbDrone.Common.Http;
using NzbDrone.Core.HealthCheck; using NzbDrone.Core.HealthCheck;
using Radarr.Http.REST;
namespace NzbDrone.Api.Health namespace NzbDrone.Api.Health
{ {
@ -17,7 +17,10 @@ namespace NzbDrone.Api.Health
{ {
public static HealthResource ToResource(this HealthCheck model) public static HealthResource ToResource(this HealthCheck model)
{ {
if (model == null) return null; if (model == null)
{
return null;
}
return new HealthResource return new HealthResource
{ {

View File

@ -3,10 +3,10 @@ using System.Linq;
using Nancy; using Nancy;
using NzbDrone.Api.Movies; using NzbDrone.Api.Movies;
using NzbDrone.Core.Datastore; using NzbDrone.Core.Datastore;
using NzbDrone.Core.DecisionEngine.Specifications;
using NzbDrone.Core.Download; using NzbDrone.Core.Download;
using NzbDrone.Core.History; using NzbDrone.Core.History;
using Radarr.Http; using Radarr.Http;
using NzbDrone.Core.DecisionEngine.Specifications;
namespace NzbDrone.Api.History namespace NzbDrone.Api.History
{ {

View File

@ -1,10 +1,9 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Radarr.Http.REST;
using NzbDrone.Api.Movies; using NzbDrone.Api.Movies;
using NzbDrone.Core.History; using NzbDrone.Core.History;
using NzbDrone.Core.Qualities; using NzbDrone.Core.Qualities;
using Radarr.Http.REST;
namespace NzbDrone.Api.History namespace NzbDrone.Api.History
{ {
@ -27,7 +26,10 @@ namespace NzbDrone.Api.History
{ {
public static HistoryResource ToResource(this Core.History.History model) public static HistoryResource ToResource(this Core.History.History model)
{ {
if (model == null) return null; if (model == null)
{
return null;
}
return new HistoryResource return new HistoryResource
{ {
@ -35,6 +37,7 @@ namespace NzbDrone.Api.History
MovieId = model.MovieId, MovieId = model.MovieId,
SourceTitle = model.SourceTitle, SourceTitle = model.SourceTitle,
Quality = model.Quality, Quality = model.Quality,
//QualityCutoffNotMet //QualityCutoffNotMet
Date = model.Date, Date = model.Date,
DownloadId = model.DownloadId, DownloadId = model.DownloadId,

View File

@ -31,7 +31,11 @@ namespace NzbDrone.Api.Indexers
protected override void Validate(IndexerDefinition definition, bool includeWarnings) protected override void Validate(IndexerDefinition definition, bool includeWarnings)
{ {
if (!definition.Enable) return; if (!definition.Enable)
{
return;
}
base.Validate(definition, includeWarnings); base.Validate(definition, includeWarnings);
} }
} }

View File

@ -2,15 +2,15 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using FluentValidation; using FluentValidation;
using Nancy; using Nancy;
using Nancy.ModelBinding;
using NLog; using NLog;
using NzbDrone.Common.Cache;
using NzbDrone.Core.DecisionEngine; using NzbDrone.Core.DecisionEngine;
using NzbDrone.Core.Download; using NzbDrone.Core.Download;
using NzbDrone.Core.Exceptions; using NzbDrone.Core.Exceptions;
using NzbDrone.Core.IndexerSearch;
using NzbDrone.Core.Indexers; using NzbDrone.Core.Indexers;
using NzbDrone.Core.IndexerSearch;
using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Parser.Model;
using Nancy.ModelBinding;
using NzbDrone.Common.Cache;
using HttpStatusCode = System.Net.HttpStatusCode; using HttpStatusCode = System.Net.HttpStatusCode;
namespace NzbDrone.Api.Indexers namespace NzbDrone.Api.Indexers
@ -60,6 +60,7 @@ namespace NzbDrone.Api.Indexers
return new NotFoundResponse(); return new NotFoundResponse();
} }
try try
{ {
_downloadService.DownloadReport(remoteMovie); _downloadService.DownloadReport(remoteMovie);
@ -115,7 +116,6 @@ namespace NzbDrone.Api.Indexers
protected override ReleaseResource MapDecision(DownloadDecision decision, int initialWeight) protected override ReleaseResource MapDecision(DownloadDecision decision, int initialWeight)
{ {
_remoteMovieCache.Set(decision.RemoteMovie.Release.Guid, decision.RemoteMovie, TimeSpan.FromMinutes(30)); _remoteMovieCache.Set(decision.RemoteMovie.Release.Guid, decision.RemoteMovie, TimeSpan.FromMinutes(30));
return base.MapDecision(decision, initialWeight); return base.MapDecision(decision, initialWeight);

View File

@ -1,17 +1,17 @@
using FluentValidation;
using NzbDrone.Core.DecisionEngine;
using NzbDrone.Core.Download;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using NzbDrone.Core.Parser.Model; using FluentValidation;
using NLog; using NLog;
using NzbDrone.Common.Extensions; using NzbDrone.Common.Extensions;
using NzbDrone.Core.Datastore; using NzbDrone.Core.Datastore;
using NzbDrone.Core.DecisionEngine;
using NzbDrone.Core.Download;
using NzbDrone.Core.Indexers; using NzbDrone.Core.Indexers;
using NzbDrone.Core.Parser.Model;
namespace NzbDrone.Api.Indexers namespace NzbDrone.Api.Indexers
{ {
class ReleasePushModule : ReleaseModuleBase public class ReleasePushModule : ReleaseModuleBase
{ {
private readonly IMakeDownloadDecision _downloadDecisionMaker; private readonly IMakeDownloadDecision _downloadDecisionMaker;
private readonly IProcessDownloadDecisions _downloadDecisionProcessor; private readonly IProcessDownloadDecisions _downloadDecisionProcessor;

View File

@ -1,14 +1,14 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json; using Newtonsoft.Json;
using Radarr.Http.REST; using NzbDrone.Core.DecisionEngine;
using NzbDrone.Core.Indexers;
using NzbDrone.Core.Languages; using NzbDrone.Core.Languages;
using NzbDrone.Core.Parser; using NzbDrone.Core.Parser;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Indexers;
using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.DecisionEngine; using NzbDrone.Core.Qualities;
using System.Linq; using Radarr.Http.REST;
namespace NzbDrone.Api.Indexers namespace NzbDrone.Api.Indexers
{ {
@ -56,7 +56,6 @@ namespace NzbDrone.Api.Indexers
public int? Leechers { get; set; } public int? Leechers { get; set; }
public DownloadProtocol Protocol { get; set; } public DownloadProtocol Protocol { get; set; }
// TODO: Remove in v3 // TODO: Remove in v3
// Used to support the original Release Push implementation // Used to support the original Release Push implementation
// JsonIgnore so we don't serialize it, but can still parse it // JsonIgnore so we don't serialize it, but can still parse it
@ -122,8 +121,8 @@ namespace NzbDrone.Api.Indexers
DownloadUrl = releaseInfo.DownloadUrl, DownloadUrl = releaseInfo.DownloadUrl,
InfoUrl = releaseInfo.InfoUrl, InfoUrl = releaseInfo.InfoUrl,
MappingResult = mappingResult, MappingResult = mappingResult,
//ReleaseWeight
//ReleaseWeight
SuspectedMovieId = movieId, SuspectedMovieId = movieId,
MagnetUrl = torrentInfo.MagnetUrl, MagnetUrl = torrentInfo.MagnetUrl,
@ -136,7 +135,6 @@ namespace NzbDrone.Api.Indexers
//Special = parsedMovieInfo.Special, //Special = parsedMovieInfo.Special,
}; };
} }
public static ReleaseInfo ToModel(this ReleaseResource resource) public static ReleaseInfo ToModel(this ReleaseResource resource)

View File

@ -60,7 +60,9 @@ namespace NzbDrone.Api.Logs
var filePath = GetLogFilePath(filename); var filePath = GetLogFilePath(filename);
if (!_diskProvider.FileExists(filePath)) if (!_diskProvider.FileExists(filePath))
{
return new NotFoundResponse(); return new NotFoundResponse();
}
var data = _diskProvider.ReadAllText(filePath); var data = _diskProvider.ReadAllText(filePath);

View File

@ -17,7 +17,10 @@ namespace NzbDrone.Api.Logs
{ {
public static LogResource ToResource(this Core.Instrumentation.Log model) public static LogResource ToResource(this Core.Instrumentation.Log model)
{ {
if (model == null) return null; if (model == null)
{
return null;
}
return new LogResource return new LogResource
{ {

View File

@ -25,7 +25,10 @@ namespace NzbDrone.Api.Logs
protected override IEnumerable<string> GetLogFiles() protected override IEnumerable<string> GetLogFiles()
{ {
if (!_diskProvider.FolderExists(_appFolderInfo.GetUpdateLogFolder())) return Enumerable.Empty<string>(); if (!_diskProvider.FolderExists(_appFolderInfo.GetUpdateLogFolder()))
{
return Enumerable.Empty<string>();
}
return _diskProvider.GetFiles(_appFolderInfo.GetUpdateLogFolder(), SearchOption.TopDirectoryOnly) return _diskProvider.GetFiles(_appFolderInfo.GetUpdateLogFolder(), SearchOption.TopDirectoryOnly)
.Where(f => Regex.IsMatch(Path.GetFileName(f), LOGFILE_ROUTE.TrimStart('/'), RegexOptions.IgnoreCase)) .Where(f => Regex.IsMatch(Path.GetFileName(f), LOGFILE_ROUTE.TrimStart('/'), RegexOptions.IgnoreCase))

View File

@ -1,10 +1,10 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using NzbDrone.Api.Movies; using NzbDrone.Api.Movies;
using Radarr.Http.REST;
using NzbDrone.Common.Crypto; using NzbDrone.Common.Crypto;
using NzbDrone.Core.DecisionEngine; using NzbDrone.Core.DecisionEngine;
using NzbDrone.Core.Qualities; using NzbDrone.Core.Qualities;
using Radarr.Http.REST;
namespace NzbDrone.Api.ManualImport namespace NzbDrone.Api.ManualImport
{ {
@ -25,7 +25,10 @@ namespace NzbDrone.Api.ManualImport
{ {
public static ManualImportResource ToResource(this Core.MediaFiles.MovieImport.Manual.ManualImportItem model) public static ManualImportResource ToResource(this Core.MediaFiles.MovieImport.Manual.ManualImportItem model)
{ {
if (model == null) return null; if (model == null)
{
return null;
}
return new ManualImportResource return new ManualImportResource
{ {
@ -37,6 +40,7 @@ namespace NzbDrone.Api.ManualImport
Size = model.Size, Size = model.Size,
Movie = model.Movie.ToResource(), Movie = model.Movie.ToResource(),
Quality = model.Quality, Quality = model.Quality,
//QualityWeight //QualityWeight
DownloadId = model.DownloadId, DownloadId = model.DownloadId,
Rejections = model.Rejections Rejections = model.Rejections

View File

@ -10,14 +10,14 @@ namespace NzbDrone.Api.MediaCovers
{ {
public class MediaCoverModule : NzbDroneApiModule public class MediaCoverModule : NzbDroneApiModule
{ {
private const string MEDIA_COVER_ROUTE = @"/(?<movieId>\d+)/(?<filename>(.+)\.(jpg|png|gif))";
private static readonly Regex RegexResizedImage = new Regex(@"-\d+\.jpg$", RegexOptions.Compiled | RegexOptions.IgnoreCase); private static readonly Regex RegexResizedImage = new Regex(@"-\d+\.jpg$", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private const string MEDIA_COVER_ROUTE = @"/(?<seriesId>\d+)/(?<filename>(.+)\.(jpg|png|gif))";
private readonly IAppFolderInfo _appFolderInfo; private readonly IAppFolderInfo _appFolderInfo;
private readonly IDiskProvider _diskProvider; private readonly IDiskProvider _diskProvider;
public MediaCoverModule(IAppFolderInfo appFolderInfo, IDiskProvider diskProvider) : base("MediaCover") public MediaCoverModule(IAppFolderInfo appFolderInfo, IDiskProvider diskProvider)
: base("MediaCover")
{ {
_appFolderInfo = appFolderInfo; _appFolderInfo = appFolderInfo;
_diskProvider = diskProvider; _diskProvider = diskProvider;
@ -38,6 +38,7 @@ namespace NzbDrone.Api.MediaCovers
{ {
return new NotFoundResponse(); return new NotFoundResponse();
} }
filePath = basefilePath; filePath = basefilePath;
} }

View File

@ -25,7 +25,11 @@ namespace NzbDrone.Api.Metadata
protected override void Validate(MetadataDefinition definition, bool includeWarnings) protected override void Validate(MetadataDefinition definition, bool includeWarnings)
{ {
if (!definition.Enable) return; if (!definition.Enable)
{
return;
}
base.Validate(definition, includeWarnings); base.Validate(definition, includeWarnings);
} }
} }

View File

@ -1,13 +1,13 @@
using System.IO; using System.IO;
using NLog; using NLog;
using Radarr.Http;
using NzbDrone.Core.Datastore.Events; using NzbDrone.Core.Datastore.Events;
using NzbDrone.Core.DecisionEngine.Specifications;
using NzbDrone.Core.MediaFiles; using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.MediaFiles.Events; using NzbDrone.Core.MediaFiles.Events;
using NzbDrone.Core.Messaging.Events; using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Movies; using NzbDrone.Core.Movies;
using NzbDrone.SignalR; using NzbDrone.SignalR;
using NzbDrone.Core.DecisionEngine.Specifications; using Radarr.Http;
namespace NzbDrone.Api.MovieFiles namespace NzbDrone.Api.MovieFiles
{ {
@ -44,7 +44,6 @@ namespace NzbDrone.Api.MovieFiles
return movie.ToResource(); return movie.ToResource();
} }
private void SetQuality(MovieFileResource movieFileResource) private void SetQuality(MovieFileResource movieFileResource)
{ {
var movieFile = _mediaFileService.GetMovie(movieFileResource.Id); var movieFile = _mediaFileService.GetMovie(movieFileResource.Id);

View File

@ -1,10 +1,10 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Radarr.Http.REST;
using NzbDrone.Api.Movies; using NzbDrone.Api.Movies;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.MediaFiles; using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.Qualities;
using Radarr.Http.REST;
namespace NzbDrone.Api.MovieFiles namespace NzbDrone.Api.MovieFiles
{ {
@ -12,13 +12,11 @@ namespace NzbDrone.Api.MovieFiles
{ {
public MovieFileResource() public MovieFileResource()
{ {
} }
//Todo: Sorters should be done completely on the client //Todo: Sorters should be done completely on the client
//Todo: Is there an easy way to keep IgnoreArticlesWhenSorting in sync between, Series, History, Missing? //Todo: Is there an easy way to keep IgnoreArticlesWhenSorting in sync between, Series, History, Missing?
//Todo: We should get the entire Profile instead of ID and Name separately //Todo: We should get the entire Profile instead of ID and Name separately
public int MovieId { get; set; } public int MovieId { get; set; }
public string RelativePath { get; set; } public string RelativePath { get; set; }
public string Path { get; set; } public string Path { get; set; }
@ -38,7 +36,10 @@ namespace NzbDrone.Api.MovieFiles
{ {
public static MovieFileResource ToResource(this MovieFile model) public static MovieFileResource ToResource(this MovieFile model)
{ {
if (model == null) return null; if (model == null)
{
return null;
}
MovieResource movie = null; MovieResource movie = null;
@ -69,11 +70,13 @@ namespace NzbDrone.Api.MovieFiles
public static MovieFile ToModel(this MovieFileResource resource) public static MovieFile ToModel(this MovieFileResource resource)
{ {
if (resource == null) return null; if (resource == null)
{
return null;
}
return new MovieFile return new MovieFile
{ {
}; };
} }

View File

@ -1,7 +1,7 @@
using NzbDrone.Core.Messaging.Events; using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.MetadataSource.RadarrAPI; using NzbDrone.Core.MetadataSource.RadarrAPI;
using NzbDrone.Core.Movies.AlternativeTitles;
using NzbDrone.Core.Movies; using NzbDrone.Core.Movies;
using NzbDrone.Core.Movies.AlternativeTitles;
using NzbDrone.Core.Movies.Events; using NzbDrone.Core.Movies.Events;
using Radarr.Http; using Radarr.Http;

View File

@ -1,8 +1,8 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Radarr.Http.REST;
using NzbDrone.Core.Movies.AlternativeTitles;
using NzbDrone.Core.Languages; using NzbDrone.Core.Languages;
using NzbDrone.Core.Movies.AlternativeTitles;
using Radarr.Http.REST;
namespace NzbDrone.Api.Movies namespace NzbDrone.Api.Movies
{ {
@ -10,13 +10,11 @@ namespace NzbDrone.Api.Movies
{ {
public AlternativeTitleResource() public AlternativeTitleResource()
{ {
} }
//Todo: Sorters should be done completely on the client //Todo: Sorters should be done completely on the client
//Todo: Is there an easy way to keep IgnoreArticlesWhenSorting in sync between, Series, History, Missing? //Todo: Is there an easy way to keep IgnoreArticlesWhenSorting in sync between, Series, History, Missing?
//Todo: We should get the entire Profile instead of ID and Name separately //Todo: We should get the entire Profile instead of ID and Name separately
public SourceType SourceType { get; set; } public SourceType SourceType { get; set; }
public int MovieId { get; set; } public int MovieId { get; set; }
public string Title { get; set; } public string Title { get; set; }
@ -33,7 +31,10 @@ namespace NzbDrone.Api.Movies
{ {
public static AlternativeTitleResource ToResource(this AlternativeTitle model) public static AlternativeTitleResource ToResource(this AlternativeTitle model)
{ {
if (model == null) return null; if (model == null)
{
return null;
}
return new AlternativeTitleResource return new AlternativeTitleResource
{ {
@ -50,7 +51,10 @@ namespace NzbDrone.Api.Movies
public static AlternativeTitle ToModel(this AlternativeTitleResource resource) public static AlternativeTitle ToModel(this AlternativeTitleResource resource)
{ {
if (resource == null) return null; if (resource == null)
{
return null;
}
return new AlternativeTitle return new AlternativeTitle
{ {

View File

@ -6,13 +6,11 @@ namespace NzbDrone.Api.Movies
{ {
public AlternativeYearResource() public AlternativeYearResource()
{ {
} }
//Todo: Sorters should be done completely on the client //Todo: Sorters should be done completely on the client
//Todo: Is there an easy way to keep IgnoreArticlesWhenSorting in sync between, Series, History, Missing? //Todo: Is there an easy way to keep IgnoreArticlesWhenSorting in sync between, Series, History, Missing?
//Todo: We should get the entire Profile instead of ID and Name separately //Todo: We should get the entire Profile instead of ID and Name separately
public int MovieId { get; set; } public int MovieId { get; set; }
public int Year { get; set; } public int Year { get; set; }

View File

@ -1,8 +1,8 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using Nancy; using Nancy;
using NzbDrone.Core.MediaCover; using NzbDrone.Core.MediaCover;
using NzbDrone.Core.MetadataSource; using NzbDrone.Core.MetadataSource;
using System.Linq;
using NzbDrone.Core.NetImport; using NzbDrone.Core.NetImport;
using Radarr.Http; using Radarr.Http;
@ -21,7 +21,6 @@ namespace NzbDrone.Api.Movies
Get("/", x => Search()); Get("/", x => Search());
} }
private object Search() private object Search()
{ {
var results = _fetchNetImport.FetchAndFilter((int)Request.Query.listId, false); var results = _fetchNetImport.FetchAndFilter((int)Request.Query.listId, false);
@ -41,7 +40,6 @@ namespace NzbDrone.Api.Movies
return MapToResource(results); return MapToResource(results);
} }
private static IEnumerable<MovieResource> MapToResource(IEnumerable<Core.Movies.Movie> movies) private static IEnumerable<MovieResource> MapToResource(IEnumerable<Core.Movies.Movie> movies)
{ {
foreach (var currentSeries in movies) foreach (var currentSeries in movies)

View File

@ -1,23 +1,22 @@
using System.Collections.Generic;
using Nancy;
using NzbDrone.Core.MediaCover;
using NzbDrone.Core.MetadataSource;
using NzbDrone.Core.Parser;
using System.Linq;
using System; using System;
using System.Collections.Generic;
using System.Linq;
using Nancy;
using NzbDrone.Common.Cache;
using NzbDrone.Common.Extensions; using NzbDrone.Common.Extensions;
using NzbDrone.Core.Datastore; using NzbDrone.Core.Datastore;
using NzbDrone.Core.MediaCover;
using NzbDrone.Core.MediaFiles; using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.MediaFiles.MovieImport; using NzbDrone.Core.MediaFiles.MovieImport;
using NzbDrone.Core.RootFolders; using NzbDrone.Core.MetadataSource;
using NzbDrone.Common.Cache;
using NzbDrone.Core.Movies; using NzbDrone.Core.Movies;
using NzbDrone.Core.Parser;
using NzbDrone.Core.Profiles; using NzbDrone.Core.Profiles;
using NzbDrone.Core.RootFolders;
using Radarr.Http; using Radarr.Http;
namespace NzbDrone.Api.Movies namespace NzbDrone.Api.Movies
{ {
public class UnmappedComparer : IComparer<UnmappedFolder> public class UnmappedComparer : IComparer<UnmappedFolder>
{ {
public int Compare(UnmappedFolder a, UnmappedFolder b) public int Compare(UnmappedFolder a, UnmappedFolder b)
@ -37,10 +36,14 @@ namespace NzbDrone.Api.Movies
private readonly IProfileService _profileService; private readonly IProfileService _profileService;
private readonly IMovieService _movieService; private readonly IMovieService _movieService;
public MovieBulkImportModule(ISearchForNewMovie searchProxy, IRootFolderService rootFolderService, public MovieBulkImportModule(ISearchForNewMovie searchProxy,
IRootFolderService rootFolderService,
IMakeImportDecision importDecisionMaker, IMakeImportDecision importDecisionMaker,
IDiskScanService diskScanService, ICacheManager cacheManager, IDiskScanService diskScanService,
IParsingService parsingService, IProfileService profileService, IMovieService movieService) ICacheManager cacheManager,
IParsingService parsingService,
IProfileService profileService,
IMovieService movieService)
: base("/movies/bulkimport") : base("/movies/bulkimport")
{ {
_searchProxy = searchProxy; _searchProxy = searchProxy;
@ -54,7 +57,6 @@ namespace NzbDrone.Api.Movies
Get("/", x => Search()); Get("/", x => Search());
} }
private object Search() private object Search()
{ {
if (Request.Query.Id == 0) if (Request.Query.Id == 0)
@ -167,7 +169,6 @@ namespace NzbDrone.Api.Movies
}; };
} }
private static IEnumerable<MovieResource> MapToResource(IEnumerable<Core.Movies.Movie> movies) private static IEnumerable<MovieResource> MapToResource(IEnumerable<Core.Movies.Movie> movies)
{ {
foreach (var currentMovie in movies) foreach (var currentMovie in movies)

View File

@ -1,10 +1,10 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using NzbDrone.Api.NetImport;
using NzbDrone.Core.MediaCover; using NzbDrone.Core.MediaCover;
using NzbDrone.Core.MetadataSource; using NzbDrone.Core.MetadataSource;
using System.Linq;
using Radarr.Http;
using NzbDrone.Core.NetImport; using NzbDrone.Core.NetImport;
using NzbDrone.Api.NetImport; using Radarr.Http;
namespace NzbDrone.Api.Movies namespace NzbDrone.Api.Movies
{ {
@ -32,7 +32,8 @@ namespace NzbDrone.Api.Movies
{ {
var lists = _netImportFactory.Discoverable(); var lists = _netImportFactory.Discoverable();
return lists.Select(definition => { return lists.Select(definition =>
{
var resource = new NetImportResource(); var resource = new NetImportResource();
resource.Id = definition.Definition.Id; resource.Id = definition.Definition.Id;

View File

@ -2,8 +2,8 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Nancy; using Nancy;
using Radarr.Http.Extensions;
using NzbDrone.Core.Movies; using NzbDrone.Core.Movies;
using Radarr.Http.Extensions;
namespace NzbDrone.Api.Movies namespace NzbDrone.Api.Movies
{ {
@ -15,19 +15,19 @@ namespace NzbDrone.Api.Movies
: base("/movie/editor") : base("/movie/editor")
{ {
_movieService = movieService; _movieService = movieService;
Put("/", Movie => SaveAll()); Put("/", movie => SaveAll());
Put("/delete", Movie => DeleteSelected()); Put("/delete", movie => DeleteSelected());
} }
private object SaveAll() private object SaveAll()
{ {
var resources = Request.Body.FromJson<List<MovieResource>>(); var resources = Request.Body.FromJson<List<MovieResource>>();
var Movie = resources.Select(MovieResource => MovieResource.ToModel(_movieService.GetMovie(MovieResource.Id))).ToList(); var movie = resources.Select(movieResource => movieResource.ToModel(_movieService.GetMovie(movieResource.Id))).ToList();
return ResponseWithCode(_movieService.UpdateMovie(Movie) return ResponseWithCode(_movieService.UpdateMovie(movie)
.ToResource() .ToResource(),
, HttpStatusCode.Accepted); HttpStatusCode.Accepted);
} }
private object DeleteSelected() private object DeleteSelected()
@ -41,10 +41,12 @@ namespace NzbDrone.Api.Movies
{ {
deleteFiles = Convert.ToBoolean(deleteFilesQuery.Value); deleteFiles = Convert.ToBoolean(deleteFilesQuery.Value);
} }
if (addExclusionQuery.HasValue) if (addExclusionQuery.HasValue)
{ {
addExclusion = Convert.ToBoolean(addExclusionQuery.Value); addExclusion = Convert.ToBoolean(addExclusionQuery.Value);
} }
var ids = Request.Body.FromJson<List<int>>(); var ids = Request.Body.FromJson<List<int>>();
foreach (var id in ids) foreach (var id in ids)

View File

@ -1,9 +1,9 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using Nancy; using Nancy;
using NzbDrone.Core.MediaCover; using NzbDrone.Core.MediaCover;
using NzbDrone.Core.MetadataSource; using NzbDrone.Core.MetadataSource;
using System.Linq;
using System;
using Radarr.Http; using Radarr.Http;
using Radarr.Http.REST; using Radarr.Http.REST;
@ -27,7 +27,7 @@ namespace NzbDrone.Api.Movies
private object SearchByTmdbId() private object SearchByTmdbId()
{ {
int tmdbId = -1; int tmdbId = -1;
if(Int32.TryParse(Request.Query.tmdbId, out tmdbId)) if (int.TryParse(Request.Query.tmdbId, out tmdbId))
{ {
var result = _movieInfo.GetMovieInfo(tmdbId, null, true); var result = _movieInfo.GetMovieInfo(tmdbId, null, true);
return result.ToResource(); return result.ToResource();

View File

@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using FluentValidation; using FluentValidation;
using Nancy;
using NzbDrone.Common.Extensions; using NzbDrone.Common.Extensions;
using NzbDrone.Core.Datastore.Events; using NzbDrone.Core.Datastore.Events;
using NzbDrone.Core.MediaCover; using NzbDrone.Core.MediaCover;
@ -9,10 +10,9 @@ using NzbDrone.Core.MediaFiles.Events;
using NzbDrone.Core.Messaging.Events; using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Movies; using NzbDrone.Core.Movies;
using NzbDrone.Core.Movies.Events; using NzbDrone.Core.Movies.Events;
using NzbDrone.Core.Validation.Paths;
using NzbDrone.Core.Validation; using NzbDrone.Core.Validation;
using NzbDrone.Core.Validation.Paths;
using NzbDrone.SignalR; using NzbDrone.SignalR;
using Nancy;
using Radarr.Http; using Radarr.Http;
namespace NzbDrone.Api.Movies namespace NzbDrone.Api.Movies
@ -25,13 +25,12 @@ namespace NzbDrone.Api.Movies
IHandle<MovieDeletedEvent>, IHandle<MovieDeletedEvent>,
IHandle<MovieRenamedEvent>, IHandle<MovieRenamedEvent>,
IHandle<MediaCoversUpdatedEvent> IHandle<MediaCoversUpdatedEvent>
{ {
private const string TITLE_SLUG_ROUTE = "/titleslug/(?<slug>[^/]+)";
protected readonly IMovieService _moviesService; protected readonly IMovieService _moviesService;
private readonly IMapCoversToLocal _coverMapper; private readonly IMapCoversToLocal _coverMapper;
private const string TITLE_SLUG_ROUTE = "/titleslug/(?<slug>[^/]+)";
public MovieModule(IBroadcastSignalRMessage signalRBroadcaster, public MovieModule(IBroadcastSignalRMessage signalRBroadcaster,
IMovieService moviesService, IMovieService moviesService,
IMapCoversToLocal coverMapper, IMapCoversToLocal coverMapper,
@ -40,8 +39,7 @@ namespace NzbDrone.Api.Movies
MovieExistsValidator moviesExistsValidator, MovieExistsValidator moviesExistsValidator,
MovieAncestorValidator moviesAncestorValidator, MovieAncestorValidator moviesAncestorValidator,
SystemFolderValidator systemFolderValidator, SystemFolderValidator systemFolderValidator,
ProfileExistsValidator profileExistsValidator ProfileExistsValidator profileExistsValidator)
)
: base(signalRBroadcaster) : base(signalRBroadcaster)
{ {
_moviesService = moviesService; _moviesService = moviesService;
@ -84,7 +82,10 @@ namespace NzbDrone.Api.Movies
protected MovieResource MapToResource(Movie movies) protected MovieResource MapToResource(Movie movies)
{ {
if (movies == null) return null; if (movies == null)
{
return null;
}
var resource = movies.ToResource(); var resource = movies.ToResource();
MapCoversToLocal(resource); MapCoversToLocal(resource);
@ -128,6 +129,7 @@ namespace NzbDrone.Api.Movies
{ {
deleteFiles = Convert.ToBoolean(deleteFilesQuery.Value); deleteFiles = Convert.ToBoolean(deleteFilesQuery.Value);
} }
if (addExclusionQuery.HasValue) if (addExclusionQuery.HasValue)
{ {
addExclusion = Convert.ToBoolean(addExclusionQuery.Value); addExclusion = Convert.ToBoolean(addExclusionQuery.Value);
@ -151,7 +153,10 @@ namespace NzbDrone.Api.Movies
public void Handle(MovieFileDeletedEvent message) public void Handle(MovieFileDeletedEvent message)
{ {
if (message.Reason == DeleteMediaFileReason.Upgrade) return; if (message.Reason == DeleteMediaFileReason.Upgrade)
{
return;
}
BroadcastResourceChange(ModelAction.Updated, message.MovieFile.MovieId); BroadcastResourceChange(ModelAction.Updated, message.MovieFile.MovieId);
} }

View File

@ -65,7 +65,6 @@ namespace NzbDrone.Api.Movies
//add a grabbed field in MovieResource? //add a grabbed field in MovieResource?
//resource.Grabbed = true; //resource.Grabbed = true;
BroadcastResourceChange(ModelAction.Updated, resource); BroadcastResourceChange(ModelAction.Updated, resource);
} }

View File

@ -1,10 +1,10 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Radarr.Http.REST; using NzbDrone.Api.MovieFiles;
using NzbDrone.Core.MediaCover; using NzbDrone.Core.MediaCover;
using NzbDrone.Core.Movies; using NzbDrone.Core.Movies;
using NzbDrone.Api.MovieFiles; using Radarr.Http.REST;
namespace NzbDrone.Api.Movies namespace NzbDrone.Api.Movies
{ {
@ -64,6 +64,7 @@ namespace NzbDrone.Api.Movies
public DateTime Added { get; set; } public DateTime Added { get; set; }
public AddMovieOptions AddOptions { get; set; } public AddMovieOptions AddOptions { get; set; }
public Ratings Ratings { get; set; } public Ratings Ratings { get; set; }
//public List<string> AlternativeTitles { get; set; } //public List<string> AlternativeTitles { get; set; }
public MovieFileResource MovieFile { get; set; } public MovieFileResource MovieFile { get; set; }
@ -90,15 +91,15 @@ namespace NzbDrone.Api.Movies
{ {
public static MovieResource ToResource(this Core.Movies.Movie model) public static MovieResource ToResource(this Core.Movies.Movie model)
{ {
if (model == null) return null; if (model == null)
{
return null;
}
long size = model.MovieFile?.Size ?? 0; long size = model.MovieFile?.Size ?? 0;
bool downloaded = model.MovieFile != null; bool downloaded = model.MovieFile != null;
MovieFileResource movieFile = model.MovieFile?.ToResource(); MovieFileResource movieFile = model.MovieFile?.ToResource();
/*if(model.MovieFile != null) /*if(model.MovieFile != null)
{ {
model.MovieFile.LazyLoad(); model.MovieFile.LazyLoad();
@ -112,12 +113,12 @@ namespace NzbDrone.Api.Movies
}*/ }*/
//model.AlternativeTitles.LazyLoad(); //model.AlternativeTitles.LazyLoad();
return new MovieResource return new MovieResource
{ {
Id = model.Id, Id = model.Id,
TmdbId = model.TmdbId, TmdbId = model.TmdbId,
Title = model.Title, Title = model.Title,
//AlternateTitles //AlternateTitles
SortTitle = model.SortTitle, SortTitle = model.SortTitle,
InCinemas = model.InCinemas, InCinemas = model.InCinemas,
@ -125,12 +126,14 @@ namespace NzbDrone.Api.Movies
PhysicalReleaseNote = model.PhysicalReleaseNote, PhysicalReleaseNote = model.PhysicalReleaseNote,
HasFile = model.HasFile, HasFile = model.HasFile,
Downloaded = downloaded, Downloaded = downloaded,
//TotalEpisodeCount //TotalEpisodeCount
//EpisodeCount //EpisodeCount
//EpisodeFileCount //EpisodeFileCount
SizeOnDisk = size, SizeOnDisk = size,
Status = model.Status, Status = model.Status,
Overview = model.Overview, Overview = model.Overview,
//NextAiring //NextAiring
//PreviousAiring //PreviousAiring
Images = model.Images, Images = model.Images,
@ -150,7 +153,6 @@ namespace NzbDrone.Api.Movies
FolderName = model.FolderName(), FolderName = model.FolderName(),
//SizeOnDisk = size, //SizeOnDisk = size,
Runtime = model.Runtime, Runtime = model.Runtime,
LastInfoSync = model.LastInfoSync, LastInfoSync = model.LastInfoSync,
CleanTitle = model.CleanTitle, CleanTitle = model.CleanTitle,
@ -173,7 +175,10 @@ namespace NzbDrone.Api.Movies
public static Core.Movies.Movie ToModel(this MovieResource resource) public static Core.Movies.Movie ToModel(this MovieResource resource)
{ {
if (resource == null) return null; if (resource == null)
{
return null;
}
return new Core.Movies.Movie return new Core.Movies.Movie
{ {
@ -181,16 +186,19 @@ namespace NzbDrone.Api.Movies
TmdbId = resource.TmdbId, TmdbId = resource.TmdbId,
Title = resource.Title, Title = resource.Title,
//AlternateTitles //AlternateTitles
SortTitle = resource.SortTitle, SortTitle = resource.SortTitle,
InCinemas = resource.InCinemas, InCinemas = resource.InCinemas,
PhysicalRelease = resource.PhysicalRelease, PhysicalRelease = resource.PhysicalRelease,
PhysicalReleaseNote = resource.PhysicalReleaseNote, PhysicalReleaseNote = resource.PhysicalReleaseNote,
//TotalEpisodeCount //TotalEpisodeCount
//EpisodeCount //EpisodeCount
//EpisodeFileCount //EpisodeFileCount
//SizeOnDisk //SizeOnDisk
Overview = resource.Overview, Overview = resource.Overview,
//NextAiring //NextAiring
//PreviousAiring //PreviousAiring
Images = resource.Images, Images = resource.Images,
@ -218,6 +226,7 @@ namespace NzbDrone.Api.Movies
Tags = resource.Tags, Tags = resource.Tags,
Added = resource.Added, Added = resource.Added,
AddOptions = resource.AddOptions, AddOptions = resource.AddOptions,
//AlternativeTitles = resource.AlternativeTitles, //AlternativeTitles = resource.AlternativeTitles,
Ratings = resource.Ratings, Ratings = resource.Ratings,
YouTubeTrailerId = resource.YouTubeTrailerId, YouTubeTrailerId = resource.YouTubeTrailerId,

View File

@ -1,7 +1,7 @@
using Radarr.Http.REST;
using NzbDrone.Core.MediaFiles;
using System.Collections.Generic; using System.Collections.Generic;
using NzbDrone.Core.MediaFiles;
using Radarr.Http; using Radarr.Http;
using Radarr.Http.REST;
namespace NzbDrone.Api.Movies namespace NzbDrone.Api.Movies
{ {
@ -28,6 +28,5 @@ namespace NzbDrone.Api.Movies
return _renameMovieFileService.GetRenamePreviews(movieId).ToResource(); return _renameMovieFileService.GetRenamePreviews(movieId).ToResource();
} }
} }
} }

View File

@ -1,6 +1,6 @@
using Radarr.Http.REST;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Radarr.Http.REST;
namespace NzbDrone.Api.Movies namespace NzbDrone.Api.Movies
{ {
@ -16,7 +16,10 @@ namespace NzbDrone.Api.Movies
{ {
public static RenameMovieResource ToResource(this Core.MediaFiles.RenameMovieFilePreview model) public static RenameMovieResource ToResource(this Core.MediaFiles.RenameMovieFilePreview model)
{ {
if (model == null) return null; if (model == null)
{
return null;
}
return new RenameMovieResource return new RenameMovieResource
{ {

View File

@ -9,7 +9,8 @@ namespace NzbDrone.Api.NetImport
{ {
private readonly IImportExclusionsService _exclusionService; private readonly IImportExclusionsService _exclusionService;
public ImportExclusionsModule(NetImportFactory netImportFactory, IImportExclusionsService exclusionService) : base("exclusions") public ImportExclusionsModule(NetImportFactory netImportFactory, IImportExclusionsService exclusionService)
: base("exclusions")
{ {
_exclusionService = exclusionService; _exclusionService = exclusionService;
GetResourceAll = GetAll; GetResourceAll = GetAll;

View File

@ -15,7 +15,10 @@ namespace NzbDrone.Api.NetImport
{ {
public static ImportExclusionsResource ToResource(this Core.NetImport.ImportExclusions.ImportExclusion model) public static ImportExclusionsResource ToResource(this Core.NetImport.ImportExclusions.ImportExclusion model)
{ {
if (model == null) return null; if (model == null)
{
return null;
}
return new ImportExclusionsResource return new ImportExclusionsResource
{ {

View File

@ -2,10 +2,10 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using Nancy; using Nancy;
using Nancy.Extensions; using Nancy.Extensions;
using Radarr.Http.Extensions;
using NzbDrone.Api.Movies; using NzbDrone.Api.Movies;
using NzbDrone.Core.MetadataSource; using NzbDrone.Core.MetadataSource;
using NzbDrone.Core.Movies; using NzbDrone.Core.Movies;
using Radarr.Http.Extensions;
namespace NzbDrone.Api.NetImport namespace NzbDrone.Api.NetImport
{ {
@ -19,16 +19,16 @@ namespace NzbDrone.Api.NetImport
{ {
_movieService = movieService; _movieService = movieService;
_movieSearch = movieSearch; _movieSearch = movieSearch;
Put("/", Movie => SaveAll()); Put("/", movie => SaveAll());
} }
private object SaveAll() private object SaveAll()
{ {
var resources = Request.Body.FromJson<List<MovieResource>>(); var resources = Request.Body.FromJson<List<MovieResource>>();
var Movies = resources.Select(MovieResource => _movieSearch.MapMovieToTmdbMovie(MovieResource.ToModel())).Where(m => m != null).DistinctBy(m => m.TmdbId).ToList(); var movies = resources.Select(movieResource => _movieSearch.MapMovieToTmdbMovie(movieResource.ToModel())).Where(m => m != null).DistinctBy(m => m.TmdbId).ToList();
return ResponseWithCode(_movieService.AddMovies(Movies).ToResource(), HttpStatusCode.Accepted); return ResponseWithCode(_movieService.AddMovies(movies).ToResource(), HttpStatusCode.Accepted);
} }
} }
} }

View File

@ -6,7 +6,8 @@ namespace NzbDrone.Api.NetImport
{ {
public class NetImportModule : ProviderModuleBase<NetImportResource, INetImport, NetImportDefinition> public class NetImportModule : ProviderModuleBase<NetImportResource, INetImport, NetImportDefinition>
{ {
public NetImportModule(NetImportFactory netImportFactory) : base(netImportFactory, "netimport") public NetImportModule(NetImportFactory netImportFactory)
: base(netImportFactory, "netimport")
{ {
PostValidator.RuleFor(c => c.RootFolderPath).IsValidPath(); PostValidator.RuleFor(c => c.RootFolderPath).IsValidPath();
PostValidator.RuleFor(c => c.MinimumAvailability).NotNull(); PostValidator.RuleFor(c => c.MinimumAvailability).NotNull();
@ -41,7 +42,11 @@ namespace NzbDrone.Api.NetImport
protected override void Validate(NetImportDefinition definition, bool includeWarnings) protected override void Validate(NetImportDefinition definition, bool includeWarnings)
{ {
if (!definition.Enable) return; if (!definition.Enable)
{
return;
}
base.Validate(definition, includeWarnings); base.Validate(definition, includeWarnings);
} }
} }

View File

@ -41,7 +41,11 @@ namespace NzbDrone.Api.Notifications
protected override void Validate(NotificationDefinition definition, bool includeWarnings) protected override void Validate(NotificationDefinition definition, bool includeWarnings)
{ {
if (!definition.OnGrab && !definition.OnDownload) return; if (!definition.OnGrab && !definition.OnDownload)
{
return;
}
base.Validate(definition, includeWarnings); base.Validate(definition, includeWarnings);
} }
} }

View File

@ -21,7 +21,6 @@ namespace NzbDrone.Api.Parse
var title = Request.Query.Title.Value as string; var title = Request.Query.Title.Value as string;
var parsedMovieInfo = _parsingService.ParseMovieInfo(title, new List<object>()); var parsedMovieInfo = _parsingService.ParseMovieInfo(title, new List<object>());
if (parsedMovieInfo == null) if (parsedMovieInfo == null)
{ {
return null; return null;

View File

@ -1,6 +1,6 @@
using NzbDrone.Api.Movies; using NzbDrone.Api.Movies;
using Radarr.Http.REST;
using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Parser.Model;
using Radarr.Http.REST;
namespace NzbDrone.Api.Parse namespace NzbDrone.Api.Parse
{ {

View File

@ -1,9 +1,9 @@
using System.Collections.Generic; using System.Collections.Generic;
using FluentValidation; using FluentValidation;
using Radarr.Http.REST;
using Radarr.Http.Validation;
using NzbDrone.Core.Profiles.Delay; using NzbDrone.Core.Profiles.Delay;
using Radarr.Http; using Radarr.Http;
using Radarr.Http.REST;
using Radarr.Http.Validation;
namespace NzbDrone.Api.Profiles.Delay namespace NzbDrone.Api.Profiles.Delay
{ {

View File

@ -1,8 +1,8 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Radarr.Http.REST;
using NzbDrone.Core.Indexers; using NzbDrone.Core.Indexers;
using NzbDrone.Core.Profiles.Delay; using NzbDrone.Core.Profiles.Delay;
using Radarr.Http.REST;
namespace NzbDrone.Api.Profiles.Delay namespace NzbDrone.Api.Profiles.Delay
{ {
@ -21,7 +21,10 @@ namespace NzbDrone.Api.Profiles.Delay
{ {
public static DelayProfileResource ToResource(this DelayProfile model) public static DelayProfileResource ToResource(this DelayProfile model)
{ {
if (model == null) return null; if (model == null)
{
return null;
}
return new DelayProfileResource return new DelayProfileResource
{ {
@ -39,7 +42,10 @@ namespace NzbDrone.Api.Profiles.Delay
public static DelayProfile ToModel(this DelayProfileResource resource) public static DelayProfile ToModel(this DelayProfileResource resource)
{ {
if (resource == null) return null; if (resource == null)
{
return null;
}
return new DelayProfile return new DelayProfile
{ {

View File

@ -3,7 +3,7 @@ using Nancy;
namespace NzbDrone.Api.Profiles namespace NzbDrone.Api.Profiles
{ {
class LegacyProfileModule : NzbDroneApiModule public class LegacyProfileModule : NzbDroneApiModule
{ {
public LegacyProfileModule() public LegacyProfileModule()
: base("qualityprofile") : base("qualityprofile")

View File

@ -1,11 +1,11 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using NzbDrone.Common.Extensions;
using NzbDrone.Api.Qualities; using NzbDrone.Api.Qualities;
using Radarr.Http.REST; using NzbDrone.Common.Extensions;
using NzbDrone.Core.Languages; using NzbDrone.Core.Languages;
using NzbDrone.Core.Profiles; using NzbDrone.Core.Profiles;
using NzbDrone.Core.Qualities; using NzbDrone.Core.Qualities;
using Radarr.Http.REST;
namespace NzbDrone.Api.Profiles namespace NzbDrone.Api.Profiles
{ {
@ -36,13 +36,22 @@ namespace NzbDrone.Api.Profiles
{ {
public static ProfileResource ToResource(this Profile model) public static ProfileResource ToResource(this Profile model)
{ {
if (model == null) return null; if (model == null)
{
return null;
}
var cutoffItem = model.Items.First(q => var cutoffItem = model.Items.First(q =>
{ {
if (q.Id == model.Cutoff) return true; if (q.Id == model.Cutoff)
{
return true;
}
if (q.Quality == null) return false; if (q.Quality == null)
{
return false;
}
return q.Quality.Id == model.Cutoff; return q.Quality.Id == model.Cutoff;
}); });
@ -53,9 +62,15 @@ namespace NzbDrone.Api.Profiles
var formatCutoffItem = model.FormatItems.First(q => var formatCutoffItem = model.FormatItems.First(q =>
{ {
if (q.Id == model.FormatCutoff) return true; if (q.Id == model.FormatCutoff)
{
return true;
}
if (q.Format == null) return false; if (q.Format == null)
{
return false;
}
return q.Format.Id == model.FormatCutoff; return q.Format.Id == model.FormatCutoff;
}); });
@ -93,7 +108,10 @@ namespace NzbDrone.Api.Profiles
public static ProfileQualityItemResource ToResource(this ProfileQualityItem model) public static ProfileQualityItemResource ToResource(this ProfileQualityItem model)
{ {
if (model == null) return null; if (model == null)
{
return null;
}
return new ProfileQualityItemResource return new ProfileQualityItemResource
{ {
@ -113,7 +131,10 @@ namespace NzbDrone.Api.Profiles
public static Profile ToModel(this ProfileResource resource) public static Profile ToModel(this ProfileResource resource)
{ {
if (resource == null) return null; if (resource == null)
{
return null;
}
return new Profile return new Profile
{ {
@ -131,7 +152,10 @@ namespace NzbDrone.Api.Profiles
public static ProfileQualityItem ToModel(this ProfileQualityItemResource resource) public static ProfileQualityItem ToModel(this ProfileQualityItemResource resource)
{ {
if (resource == null) return null; if (resource == null)
{
return null;
}
return new ProfileQualityItem return new ProfileQualityItem
{ {

View File

@ -31,7 +31,8 @@ namespace NzbDrone.Api.Profiles
var formatItems = _formatService.All().Select(v => new ProfileFormatItem var formatItems = _formatService.All().Select(v => new ProfileFormatItem
{ {
Format = v, Allowed = true Format = v,
Allowed = true
}).ToList(); }).ToList();
formatItems.Insert(0, new ProfileFormatItem formatItems.Insert(0, new ProfileFormatItem

View File

@ -20,7 +20,6 @@ namespace NzbDrone.Api.Profiles
public AllowedValidator() public AllowedValidator()
: base("Must contain at least one allowed quality") : base("Must contain at least one allowed quality")
{ {
} }
protected override bool IsValid(PropertyValidatorContext context) protected override bool IsValid(PropertyValidatorContext context)

View File

@ -3,10 +3,10 @@ using System.Linq;
using FluentValidation; using FluentValidation;
using FluentValidation.Results; using FluentValidation.Results;
using Nancy; using Nancy;
using Newtonsoft.Json;
using NzbDrone.Common.Reflection; using NzbDrone.Common.Reflection;
using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.ThingiProvider;
using NzbDrone.Core.Validation; using NzbDrone.Core.Validation;
using Newtonsoft.Json;
using Radarr.Http; using Radarr.Http;
using Radarr.Http.ClientSchema; using Radarr.Http.ClientSchema;
@ -181,7 +181,6 @@ namespace NzbDrone.Api
return "{}"; return "{}";
} }
private object RequestAction(string action, TProviderResource providerResource) private object RequestAction(string action, TProviderResource providerResource)
{ {
var providerDefinition = GetDefinition(providerResource, true, false); var providerDefinition = GetDefinition(providerResource, true, false);

View File

@ -1,7 +1,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using NzbDrone.Core.ThingiProvider;
using Radarr.Http.ClientSchema; using Radarr.Http.ClientSchema;
using Radarr.Http.REST; using Radarr.Http.REST;
using NzbDrone.Core.ThingiProvider;
namespace NzbDrone.Api namespace NzbDrone.Api
{ {

View File

@ -31,7 +31,7 @@ namespace NzbDrone.Api.Qualities
var allNewTags = c.Select(t => t.ToLower()); var allNewTags = c.Select(t => t.ToLower());
var enumerable = allTags.ToList(); var enumerable = allTags.ToList();
var newTags = allNewTags.ToList(); var newTags = allNewTags.ToList();
return (enumerable.All(newTags.Contains) && f.Id != v.Id && enumerable.Count() == newTags.Count()); return enumerable.All(newTags.Contains) && f.Id != v.Id && enumerable.Count() == newTags.Count();
}); });
}) })
.WithMessage("Should be unique."); .WithMessage("Should be unique.");
@ -100,6 +100,7 @@ namespace NzbDrone.Api.Qualities
{ {
return null; return null;
} }
return new CustomFormatTestResource return new CustomFormatTestResource
{ {
Matches = _parsingService.MatchFormatTags(parsed).ToResource(), Matches = _parsingService.MatchFormatTags(parsed).ToResource(),
@ -121,6 +122,7 @@ namespace NzbDrone.Api.Qualities
{ {
return null; return null;
} }
return new CustomFormatTestResource return new CustomFormatTestResource
{ {
Matches = _parsingService.MatchFormatTags(parsed).ToResource(), Matches = _parsingService.MatchFormatTags(parsed).ToResource(),

View File

@ -1,7 +1,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Radarr.Http.REST;
using NzbDrone.Core.CustomFormats; using NzbDrone.Core.CustomFormats;
using Radarr.Http.REST;
namespace NzbDrone.Api.Qualities namespace NzbDrone.Api.Qualities
{ {

View File

@ -1,8 +1,8 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Radarr.Http.REST;
using NzbDrone.Common.Extensions; using NzbDrone.Common.Extensions;
using NzbDrone.Core.CustomFormats; using NzbDrone.Core.CustomFormats;
using Radarr.Http.REST;
namespace NzbDrone.Api.Qualities namespace NzbDrone.Api.Qualities
{ {
@ -29,7 +29,10 @@ namespace NzbDrone.Api.Qualities
{ {
public static FormatTagMatchResultResource ToResource(this FormatTagMatchResult model) public static FormatTagMatchResultResource ToResource(this FormatTagMatchResult model)
{ {
if (model == null) return null; if (model == null)
{
return null;
}
return new FormatTagMatchResultResource return new FormatTagMatchResultResource
{ {

View File

@ -7,7 +7,8 @@ namespace NzbDrone.Api.Qualities
{ {
public class FormatTagValidator : PropertyValidator public class FormatTagValidator : PropertyValidator
{ {
public FormatTagValidator() : base("{ValidationMessage}") public FormatTagValidator()
: base("{ValidationMessage}")
{ {
} }
@ -23,7 +24,10 @@ namespace NzbDrone.Api.Qualities
var invalidTags = tags.Where(t => !FormatTag.QualityTagRegex.IsMatch(t)); var invalidTags = tags.Where(t => !FormatTag.QualityTagRegex.IsMatch(t));
if (invalidTags.Count() == 0) return true; if (invalidTags.Count() == 0)
{
return true;
}
var formatMessage = var formatMessage =
$"Format Tags ({string.Join(", ", invalidTags)}) are in an invalid format! Check the Wiki to learn how they should look."; $"Format Tags ({string.Join(", ", invalidTags)}) are in an invalid format! Check the Wiki to learn how they should look.";

View File

@ -1,8 +1,8 @@
using System.Collections.Generic; using System.Collections.Generic;
using Radarr.Http.REST;
using NzbDrone.Core.Parser; using NzbDrone.Core.Parser;
using NzbDrone.Core.Qualities; using NzbDrone.Core.Qualities;
using Radarr.Http; using Radarr.Http;
using Radarr.Http.REST;
namespace NzbDrone.Api.Qualities namespace NzbDrone.Api.Qualities
{ {

View File

@ -1,7 +1,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Radarr.Http.REST;
using NzbDrone.Core.Qualities; using NzbDrone.Core.Qualities;
using Radarr.Http.REST;
namespace NzbDrone.Api.Qualities namespace NzbDrone.Api.Qualities
{ {
@ -21,7 +21,10 @@ namespace NzbDrone.Api.Qualities
{ {
public static QualityDefinitionResource ToResource(this QualityDefinition model) public static QualityDefinitionResource ToResource(this QualityDefinition model)
{ {
if (model == null) return null; if (model == null)
{
return null;
}
return new QualityDefinitionResource return new QualityDefinitionResource
{ {
@ -40,7 +43,10 @@ namespace NzbDrone.Api.Qualities
public static QualityDefinition ToModel(this QualityDefinitionResource resource) public static QualityDefinition ToModel(this QualityDefinitionResource resource)
{ {
if (resource == null) return null; if (resource == null)
{
return null;
}
return new QualityDefinition return new QualityDefinition
{ {

View File

@ -1,12 +1,12 @@
using System; using System;
using Nancy; using Nancy;
using Radarr.Http.Extensions;
using Radarr.Http.REST;
using NzbDrone.Core.Download; using NzbDrone.Core.Download;
using NzbDrone.Core.Download.Pending; using NzbDrone.Core.Download.Pending;
using NzbDrone.Core.Download.TrackedDownloads; using NzbDrone.Core.Download.TrackedDownloads;
using NzbDrone.Core.Queue; using NzbDrone.Core.Queue;
using Radarr.Http; using Radarr.Http;
using Radarr.Http.Extensions;
using Radarr.Http.REST;
namespace NzbDrone.Api.Queue namespace NzbDrone.Api.Queue
{ {

View File

@ -1,11 +1,11 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Radarr.Http.REST; using System.Linq;
using NzbDrone.Core.Qualities;
using NzbDrone.Api.Movies; using NzbDrone.Api.Movies;
using NzbDrone.Core.Download.TrackedDownloads; using NzbDrone.Core.Download.TrackedDownloads;
using NzbDrone.Core.Indexers; using NzbDrone.Core.Indexers;
using System.Linq; using NzbDrone.Core.Qualities;
using Radarr.Http.REST;
namespace NzbDrone.Api.Queue namespace NzbDrone.Api.Queue
{ {
@ -29,7 +29,10 @@ namespace NzbDrone.Api.Queue
{ {
public static QueueResource ToResource(this Core.Queue.Queue model) public static QueueResource ToResource(this Core.Queue.Queue model)
{ {
if (model == null) return null; if (model == null)
{
return null;
}
return new QueueResource return new QueueResource
{ {

View File

@ -1,7 +1,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Radarr.Http.REST;
using NzbDrone.Core.RemotePathMappings; using NzbDrone.Core.RemotePathMappings;
using Radarr.Http.REST;
namespace NzbDrone.Api.RemotePathMappings namespace NzbDrone.Api.RemotePathMappings
{ {
@ -16,7 +16,10 @@ namespace NzbDrone.Api.RemotePathMappings
{ {
public static RemotePathMappingResource ToResource(this RemotePathMapping model) public static RemotePathMappingResource ToResource(this RemotePathMapping model)
{ {
if (model == null) return null; if (model == null)
{
return null;
}
return new RemotePathMappingResource return new RemotePathMappingResource
{ {
@ -30,7 +33,10 @@ namespace NzbDrone.Api.RemotePathMappings
public static RemotePathMapping ToModel(this RemotePathMappingResource resource) public static RemotePathMapping ToModel(this RemotePathMappingResource resource)
{ {
if (resource == null) return null; if (resource == null)
{
return null;
}
return new RemotePathMapping return new RemotePathMapping
{ {

View File

@ -9,7 +9,6 @@ namespace Radarr.Http.RESTrictions
{ {
private readonly IRestrictionService _restrictionService; private readonly IRestrictionService _restrictionService;
public RestrictionModule(IRestrictionService restrictionService) public RestrictionModule(IRestrictionService restrictionService)
{ {
_restrictionService = restrictionService; _restrictionService = restrictionService;

View File

@ -1,7 +1,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Radarr.Http.REST;
using NzbDrone.Core.Restrictions; using NzbDrone.Core.Restrictions;
using Radarr.Http.REST;
namespace Radarr.Http.RESTrictions namespace Radarr.Http.RESTrictions
{ {
@ -22,7 +22,10 @@ namespace Radarr.Http.RESTrictions
{ {
public static RestrictionResource ToResource(this Restriction model) public static RestrictionResource ToResource(this Restriction model)
{ {
if (model == null) return null; if (model == null)
{
return null;
}
return new RestrictionResource return new RestrictionResource
{ {
@ -37,7 +40,10 @@ namespace Radarr.Http.RESTrictions
public static Restriction ToModel(this RestrictionResource resource) public static Restriction ToModel(this RestrictionResource resource)
{ {
if (resource == null) return null; if (resource == null)
{
return null;
}
return new Restriction return new Restriction
{ {

View File

@ -18,8 +18,7 @@ namespace NzbDrone.Api.RootFolders
MappedNetworkDriveValidator mappedNetworkDriveValidator, MappedNetworkDriveValidator mappedNetworkDriveValidator,
StartupFolderValidator startupFolderValidator, StartupFolderValidator startupFolderValidator,
SystemFolderValidator systemFolderValidator, SystemFolderValidator systemFolderValidator,
FolderWritableValidator folderWritableValidator FolderWritableValidator folderWritableValidator)
)
: base(signalRBroadcaster) : base(signalRBroadcaster)
{ {
_rootFolderService = rootFolderService; _rootFolderService = rootFolderService;

View File

@ -1,7 +1,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Radarr.Http.REST;
using NzbDrone.Core.RootFolders; using NzbDrone.Core.RootFolders;
using Radarr.Http.REST;
namespace NzbDrone.Api.RootFolders namespace NzbDrone.Api.RootFolders
{ {
@ -18,7 +18,10 @@ namespace NzbDrone.Api.RootFolders
{ {
public static RootFolderResource ToResource(this RootFolder model) public static RootFolderResource ToResource(this RootFolder model)
{ {
if (model == null) return null; if (model == null)
{
return null;
}
return new RootFolderResource return new RootFolderResource
{ {
@ -33,7 +36,10 @@ namespace NzbDrone.Api.RootFolders
public static RootFolder ToModel(this RootFolderResource resource) public static RootFolder ToModel(this RootFolderResource resource)
{ {
if (resource == null) return null; if (resource == null)
{
return null;
}
return new RootFolder return new RootFolder
{ {

View File

@ -9,7 +9,8 @@ namespace NzbDrone.Api.System.Backup
{ {
private readonly IBackupService _backupService; private readonly IBackupService _backupService;
public BackupModule(IBackupService backupService) : base("system/backup") public BackupModule(IBackupService backupService)
: base("system/backup")
{ {
_backupService = backupService; _backupService = backupService;
GetResourceAll = GetBackupFiles; GetResourceAll = GetBackupFiles;

View File

@ -1,6 +1,6 @@
using System; using System;
using Radarr.Http.REST;
using NzbDrone.Core.Backup; using NzbDrone.Core.Backup;
using Radarr.Http.REST;
namespace NzbDrone.Api.System.Backup namespace NzbDrone.Api.System.Backup
{ {

View File

@ -25,7 +25,8 @@ namespace NzbDrone.Api.System
IRouteCacheProvider routeCacheProvider, IRouteCacheProvider routeCacheProvider,
IConfigFileProvider configFileProvider, IConfigFileProvider configFileProvider,
IMainDatabase database, IMainDatabase database,
ILifecycleService lifecycleService) : base("system") ILifecycleService lifecycleService)
: base("system")
{ {
_appFolderInfo = appFolderInfo; _appFolderInfo = appFolderInfo;
_runtimeInfo = runtimeInfo; _runtimeInfo = runtimeInfo;

View File

@ -1,7 +1,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Radarr.Http.REST;
using NzbDrone.Core.Tags; using NzbDrone.Core.Tags;
using Radarr.Http.REST;
namespace NzbDrone.Api.Tags namespace NzbDrone.Api.Tags
{ {
@ -14,7 +14,10 @@ namespace NzbDrone.Api.Tags
{ {
public static TagResource ToResource(this Tag model) public static TagResource ToResource(this Tag model)
{ {
if (model == null) return null; if (model == null)
{
return null;
}
return new TagResource return new TagResource
{ {
@ -26,7 +29,10 @@ namespace NzbDrone.Api.Tags
public static Tag ToModel(this TagResource resource) public static Tag ToModel(this TagResource resource)
{ {
if (resource == null) return null; if (resource == null)
{
return null;
}
return new Tag return new Tag
{ {

View File

@ -2,8 +2,8 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Newtonsoft.Json; using Newtonsoft.Json;
using Radarr.Http.REST;
using NzbDrone.Core.Update; using NzbDrone.Core.Update;
using Radarr.Http.REST;
namespace NzbDrone.Api.Update namespace NzbDrone.Api.Update
{ {
@ -27,7 +27,10 @@ namespace NzbDrone.Api.Update
{ {
public static UpdateResource ToResource(this UpdatePackage model) public static UpdateResource ToResource(this UpdatePackage model)
{ {
if (model == null) return null; if (model == null)
{
return null;
}
return new UpdateResource return new UpdateResource
{ {
@ -37,6 +40,7 @@ namespace NzbDrone.Api.Update
ReleaseDate = model.ReleaseDate, ReleaseDate = model.ReleaseDate,
FileName = model.FileName, FileName = model.FileName,
Url = model.Url, Url = model.Url,
//Installed //Installed
//Installable //Installable
//Latest //Latest

View File

@ -3,9 +3,10 @@ using Nancy;
namespace NzbDrone.Api.Wanted namespace NzbDrone.Api.Wanted
{ {
class LegacyMissingModule : NzbDroneApiModule public class LegacyMissingModule : NzbDroneApiModule
{ {
public LegacyMissingModule() : base("missing") public LegacyMissingModule()
: base("missing")
{ {
Get("/", x => Get("/", x =>
{ {

View File

@ -1,10 +1,10 @@
using System.Linq; using System.Linq;
using NzbDrone.Api.Movies; using NzbDrone.Api.Movies;
using NzbDrone.Core.Movies;
using NzbDrone.Core.Datastore; using NzbDrone.Core.Datastore;
using NzbDrone.Core.DecisionEngine.Specifications;
using NzbDrone.Core.Movies;
using NzbDrone.SignalR; using NzbDrone.SignalR;
using Radarr.Http; using Radarr.Http;
using NzbDrone.Core.DecisionEngine.Specifications;
namespace NzbDrone.Api.Wanted namespace NzbDrone.Api.Wanted
{ {

View File

@ -1,14 +1,14 @@
using System.Linq; using System.Linq;
using NzbDrone.Api.Movies; using NzbDrone.Api.Movies;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.DecisionEngine.Specifications; using NzbDrone.Core.DecisionEngine.Specifications;
using NzbDrone.Core.Movies; using NzbDrone.Core.Movies;
using NzbDrone.Core.Datastore;
using NzbDrone.SignalR; using NzbDrone.SignalR;
using Radarr.Http; using Radarr.Http;
namespace NzbDrone.Api.Wanted namespace NzbDrone.Api.Wanted
{ {
class MovieMissingModule : MovieModuleWithSignalR public class MovieMissingModule : MovieModuleWithSignalR
{ {
public MovieMissingModule(IMovieService movieService, public MovieMissingModule(IMovieService movieService,
IUpgradableSpecification qualityUpgradableSpecification, IUpgradableSpecification qualityUpgradableSpecification,

View File

@ -37,6 +37,7 @@ namespace NzbDrone.Automation.Test
var options = new FirefoxOptions(); var options = new FirefoxOptions();
options.AddArguments("--headless"); options.AddArguments("--headless");
FirefoxDriverService service = FirefoxDriverService.CreateDefaultService(); FirefoxDriverService service = FirefoxDriverService.CreateDefaultService();
// service.Host = "::1"; // Workaround netcore/selenium bug https://github.com/SeleniumHQ/selenium/issues/7840 // service.Host = "::1"; // Workaround netcore/selenium bug https://github.com/SeleniumHQ/selenium/issues/7840
driver = new FirefoxDriver(service, options, new System.TimeSpan(0, 3, 0)); driver = new FirefoxDriver(service, options, new System.TimeSpan(0, 3, 0));

Some files were not shown because too many files have changed in this diff Show More