Merge branch 'develop' of https://github.com/lidarr/Lidarr into develop

pull/315/head
Qstick 6 years ago
commit 98653fafbf

@ -1,4 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using FluentValidation.Results; using FluentValidation.Results;
using NzbDrone.Common.Extensions; using NzbDrone.Common.Extensions;
using NzbDrone.Core.Restrictions; using NzbDrone.Core.Restrictions;
@ -15,11 +15,11 @@ namespace Lidarr.Api.V1.Restrictions
{ {
_restrictionService = restrictionService; _restrictionService = restrictionService;
GetResourceById = Get; GetResourceById = GetRestriction;
GetResourceAll = GetAll; GetResourceAll = GetAll;
CreateResource = Create; CreateResource = Create;
UpdateResource = Update; UpdateResource = Update;
DeleteResource = Delete; DeleteResource = DeleteRestriction;
SharedValidator.Custom(restriction => SharedValidator.Custom(restriction =>
{ {
@ -32,7 +32,7 @@ namespace Lidarr.Api.V1.Restrictions
}); });
} }
private RestrictionResource Get(int id) private RestrictionResource GetRestriction(int id)
{ {
return _restrictionService.Get(id).ToResource(); return _restrictionService.Get(id).ToResource();
} }
@ -52,7 +52,7 @@ namespace Lidarr.Api.V1.Restrictions
_restrictionService.Update(resource.ToModel()); _restrictionService.Update(resource.ToModel());
} }
private void Delete(int id) private void DeleteRestriction(int id)
{ {
_restrictionService.Delete(id); _restrictionService.Delete(id);
} }

@ -1,4 +1,4 @@
using NzbDrone.Core.Tags; using NzbDrone.Core.Tags;
using Lidarr.Http; using Lidarr.Http;
namespace Lidarr.Api.V1.Tags namespace Lidarr.Api.V1.Tags
@ -12,10 +12,10 @@ namespace Lidarr.Api.V1.Tags
{ {
_tagService = tagService; _tagService = tagService;
GetResourceById = Get; GetResourceById = GetTagDetails;
} }
private TagDetailsResource Get(int id) private TagDetailsResource GetTagDetails(int id)
{ {
return _tagService.Details(id).ToResource(); return _tagService.Details(id).ToResource();
} }

@ -1,4 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using NzbDrone.Core.Datastore.Events; using NzbDrone.Core.Datastore.Events;
using NzbDrone.Core.Messaging.Events; using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Tags; using NzbDrone.Core.Tags;
@ -17,14 +17,14 @@ namespace Lidarr.Api.V1.Tags
{ {
_tagService = tagService; _tagService = tagService;
GetResourceById = Get; GetResourceById = GetTag;
GetResourceAll = GetAll; GetResourceAll = GetAll;
CreateResource = Create; CreateResource = Create;
UpdateResource = Update; UpdateResource = Update;
DeleteResource = Delete; DeleteResource = DeleteTag;
} }
private TagResource Get(int id) private TagResource GetTag(int id)
{ {
return _tagService.GetTag(id).ToResource(); return _tagService.GetTag(id).ToResource();
} }
@ -44,7 +44,7 @@ namespace Lidarr.Api.V1.Tags
_tagService.Update(resource.ToModel()); _tagService.Update(resource.ToModel());
} }
private void Delete(int id) private void DeleteTag(int id)
{ {
_tagService.Delete(id); _tagService.Delete(id);
} }

@ -1,4 +1,4 @@
using TinyIoC; using TinyIoC;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -91,7 +91,6 @@ namespace Lidarr.Http
break; break;
case Lifetime.PerRequest: case Lifetime.PerRequest:
throw new InvalidOperationException("Unable to directly register a per request lifetime."); throw new InvalidOperationException("Unable to directly register a per request lifetime.");
break;
default: default:
throw new ArgumentOutOfRangeException(); throw new ArgumentOutOfRangeException();
} }
@ -118,7 +117,6 @@ namespace Lidarr.Http
break; break;
case Lifetime.PerRequest: case Lifetime.PerRequest:
throw new InvalidOperationException("Unable to directly register a per request lifetime."); throw new InvalidOperationException("Unable to directly register a per request lifetime.");
break;
default: default:
throw new ArgumentOutOfRangeException(); throw new ArgumentOutOfRangeException();
} }

@ -1,4 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using FluentAssertions; using FluentAssertions;
using NLog; using NLog;
@ -31,7 +31,7 @@ namespace NzbDrone.Automation.Test
LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", NLog.LogLevel.Trace, consoleTarget)); LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", NLog.LogLevel.Trace, consoleTarget));
} }
[TestFixtureSetUp] [OneTimeSetUp]
public void SmokeTestSetup() public void SmokeTestSetup()
{ {
driver = new FirefoxDriver(); driver = new FirefoxDriver();
@ -56,7 +56,7 @@ namespace NzbDrone.Automation.Test
.Select(e => e.Text); .Select(e => e.Text);
} }
[TestFixtureTearDown] [OneTimeTearDown]
public void SmokeTestTearDown() public void SmokeTestTearDown()
{ {
_runner.KillAll(); _runner.KillAll();

@ -13,8 +13,6 @@ namespace NzbDrone.Core.Test.Datastore.Converters
[Test] [Test]
public void should_return_int_when_saving_int_to_db() public void should_return_int_when_saving_int_to_db()
{ {
var i = 5;
Subject.ToDB(5).Should().Be(5); Subject.ToDB(5).Should().Be(5);
} }

@ -160,7 +160,7 @@ namespace NzbDrone.Core.DecisionEngine
return new Rejection(result.Reason, spec.Type); return new Rejection(result.Reason, spec.Type);
} }
} }
catch (NotImplementedException e) catch (NotImplementedException)
{ {
_logger.Trace("Spec " + spec.GetType().Name + " not implemented."); _logger.Trace("Spec " + spec.GetType().Name + " not implemented.");
} }

@ -158,7 +158,7 @@ namespace NzbDrone.Core.Download.Clients.Hadouken
} }
catch (DownloadClientAuthenticationException ex) catch (DownloadClientAuthenticationException ex)
{ {
_logger.ErrorException(ex.Message, ex); _logger.Error(ex.Message, ex);
return new NzbDroneValidationFailure("Password", "Authentication failed"); return new NzbDroneValidationFailure("Password", "Authentication failed");
} }
@ -174,7 +174,7 @@ namespace NzbDrone.Core.Download.Clients.Hadouken
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.ErrorException(ex.Message, ex); _logger.Error(ex, ex.Message);
return new NzbDroneValidationFailure(String.Empty, "Failed to get the list of torrents: " + ex.Message); return new NzbDroneValidationFailure(String.Empty, "Failed to get the list of torrents: " + ex.Message);
} }

@ -71,9 +71,11 @@ namespace NzbDrone.Core.Download.Clients.Hadouken
private T ProcessRequest<T>(HadoukenSettings settings, string method, params object[] parameters) private T ProcessRequest<T>(HadoukenSettings settings, string method, params object[] parameters)
{ {
var baseUrl = HttpRequestBuilder.BuildBaseUrl(settings.UseSsl, settings.Host, settings.Port, "api"); var baseUrl = HttpRequestBuilder.BuildBaseUrl(settings.UseSsl, settings.Host, settings.Port, "api");
var requestBuilder = new JsonRpcRequestBuilder(baseUrl, method, parameters); var requestBuilder = new JsonRpcRequestBuilder(baseUrl, method, parameters)
requestBuilder.LogResponseContent = true; {
requestBuilder.NetworkCredential = new NetworkCredential(settings.Username, settings.Password); LogResponseContent = true,
NetworkCredential = new NetworkCredential(settings.Username, settings.Password)
};
requestBuilder.Headers.Add("Accept-Encoding", "gzip,deflate"); requestBuilder.Headers.Add("Accept-Encoding", "gzip,deflate");
var httpRequest = requestBuilder.Build(); var httpRequest = requestBuilder.Build();
@ -146,7 +148,7 @@ namespace NzbDrone.Core.Download.Clients.Hadouken
} }
catch(Exception ex) catch(Exception ex)
{ {
_logger.ErrorException("Failed to map Hadouken torrent data.", ex); _logger.Error(ex, "Failed to map Hadouken torrent data.");
} }
return torrent; return torrent;

@ -197,9 +197,12 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent
private HttpRequestBuilder BuildRequest(QBittorrentSettings settings) private HttpRequestBuilder BuildRequest(QBittorrentSettings settings)
{ {
var requestBuilder = new HttpRequestBuilder(settings.UseSsl, settings.Host, settings.Port); var requestBuilder =
requestBuilder.LogResponseContent = true; new HttpRequestBuilder(settings.UseSsl, settings.Host, settings.Port)
requestBuilder.NetworkCredential = new NetworkCredential(settings.Username, settings.Password); {
LogResponseContent = true,
NetworkCredential = new NetworkCredential(settings.Username, settings.Password)
};
return requestBuilder; return requestBuilder;
} }

@ -11,7 +11,6 @@ namespace NzbDrone.Core.ImportLists.HeadphonesImport
public class HeadphonesImportParser : IParseImportListResponse public class HeadphonesImportParser : IParseImportListResponse
{ {
private ImportListResponse _importListResponse; private ImportListResponse _importListResponse;
private readonly Logger _logger;
public IList<ImportListItemInfo> ParseResponse(ImportListResponse importListResponse) public IList<ImportListItemInfo> ParseResponse(ImportListResponse importListResponse)
{ {

@ -12,7 +12,6 @@ namespace NzbDrone.Core.ImportLists.LidarrLists
{ {
private readonly LidarrListsSettings _settings; private readonly LidarrListsSettings _settings;
private ImportListResponse _importListResponse; private ImportListResponse _importListResponse;
private readonly Logger _logger;
public LidarrListsParser(LidarrListsSettings settings) public LidarrListsParser(LidarrListsSettings settings)
{ {

@ -17,15 +17,11 @@ namespace NzbDrone.Core.Indexers.Gazelle
public override int PageSize => 50; public override int PageSize => 50;
private readonly ICached<Dictionary<string, string>> _authCookieCache; private readonly ICached<Dictionary<string, string>> _authCookieCache;
private readonly IHttpClient _httpClient;
private readonly Logger _logger;
public Gazelle(IHttpClient httpClient, ICacheManager cacheManager, IIndexerStatusService indexerStatusService, public Gazelle(IHttpClient httpClient, ICacheManager cacheManager, IIndexerStatusService indexerStatusService,
IConfigService configService, IParsingService parsingService, Logger logger) IConfigService configService, IParsingService parsingService, Logger logger)
: base(httpClient, indexerStatusService, configService, parsingService, logger) : base(httpClient, indexerStatusService, configService, parsingService, logger)
{ {
_httpClient = httpClient;
_logger = logger;
_authCookieCache = cacheManager.GetCache<Dictionary<string, string>>(GetType(), "authCookies"); _authCookieCache = cacheManager.GetCache<Dictionary<string, string>>(GetType(), "authCookies");
} }

@ -6,7 +6,6 @@ namespace NzbDrone.Core.Indexers.Headphones
{ {
public class HeadphonesRssParser : NewznabRssParser public class HeadphonesRssParser : NewznabRssParser
{ {
public const string ns = "{http://www.newznab.com/DTD/2010/feeds/attributes/}";
public HeadphonesSettings Settings { get; set; } public HeadphonesSettings Settings { get; set; }
public HeadphonesRssParser() public HeadphonesRssParser()

@ -51,7 +51,7 @@ namespace NzbDrone.Core.Messaging.Commands
_logger.Error(ex, "Thread aborted"); _logger.Error(ex, "Thread aborted");
Thread.ResetAbort(); Thread.ResetAbort();
} }
catch (OperationCanceledException ex) catch (OperationCanceledException)
{ {
_logger.Trace("Stopped one command execution pipeline"); _logger.Trace("Stopped one command execution pipeline");
} }

@ -22,7 +22,7 @@ namespace NzbDrone.Host.Owin.MiddleWare
public void Attach(IAppBuilder appBuilder) public void Attach(IAppBuilder appBuilder)
{ {
appBuilder.MapConnection("/signalr", typeof(NzbDronePersistentConnection), new ConnectionConfiguration ()); appBuilder.MapSignalR("/signalr", typeof(NzbDronePersistentConnection), new ConnectionConfiguration ());
} }
} }
} }

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
@ -60,7 +60,7 @@ namespace NzbDrone.Host.Owin
if (ex.InnerException is HttpListenerException) if (ex.InnerException is HttpListenerException)
{ {
throw new PortInUseException("Port {0} is already in use, please ensure NzbDrone is not already running.", ex, _configFileProvider.Port); throw new PortInUseException("Port {0} is already in use, please ensure Lidarr is not already running.", ex, _configFileProvider.Port);
} }
throw ex.InnerException; throw ex.InnerException;
@ -70,7 +70,7 @@ namespace NzbDrone.Host.Owin
private void BuildApp(IAppBuilder appBuilder) private void BuildApp(IAppBuilder appBuilder)
{ {
appBuilder.Properties["host.AppName"] = "NzbDrone"; appBuilder.Properties["host.AppName"] = "Lidarr";
foreach (var middleWare in _owinMiddleWares.OrderBy(c => c.Order)) foreach (var middleWare in _owinMiddleWares.OrderBy(c => c.Order))
{ {
@ -88,4 +88,4 @@ namespace NzbDrone.Host.Owin
return provider; return provider;
} }
} }
} }

Loading…
Cancel
Save