Merge branch 'autofac'

Conflicts:
	NzbDrone.Common/IISProvider.cs
	NzbDrone.Core/CentralDispatch.cs
pull/21/head
Mark McDowall 12 years ago
commit 1ef6906dc1

@ -3,11 +3,10 @@ using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Web;
using Autofac;
using Funq;
using Ninject;
using NzbDrone.Api.QualityProfiles;
using NzbDrone.Api.QualityType;
using ServiceStack.ContainerAdapter.Ninject;
using ServiceStack.WebHost.Endpoints;
using QualityProfileService = NzbDrone.Api.QualityProfiles.QualityProfileService;
@ -15,17 +14,17 @@ namespace NzbDrone.Api
{
public class AppHost : AppHostBase
{
private IKernel _kernel;
private IContainer _container;
public AppHost(IKernel kernel) //Tell ServiceStack the name and where to find your web services
public AppHost(IContainer container) //Tell ServiceStack the name and where to find your web services
: base("NzbDrone API", typeof(QualityProfileService).Assembly)
{
_kernel = kernel;
_container = container;
}
public override void Configure(Container container)
{
container.Adapter = new NinjectContainerAdapter(_kernel);
container.Adapter = new AutofacIocAdapter(_container);
SetConfig(new EndpointHostConfig { ServiceStackHandlerFactoryPath = "api" });
Routes

@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autofac;
using ServiceStack.Configuration;
namespace NzbDrone.Api
{
public class AutofacIocAdapter : IContainerAdapter
{
private readonly IContainer _container;
public AutofacIocAdapter(IContainer container)
{
_container = container;
}
public T Resolve<T>()
{
return _container.Resolve<T>();
}
public T TryResolve<T>()
{
T result;
if (_container.TryResolve<T>(out result))
{
return result;
}
return default(T);
}
}
}

@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ninject;
using NzbDrone.Api.Exceptions;
using NzbDrone.Api.Helpers;
using NzbDrone.Core.Providers.Core;
@ -16,7 +15,6 @@ namespace NzbDrone.Api.Filters
public ApplyTo ApplyTo { get; set; }
public int Priority { get; set; }
[Inject]
public ConfigProvider _configProvider;
public void RequestFilter(IHttpRequest req, IHttpResponse res, object requestDto)

@ -50,22 +50,21 @@
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="Autofac">
<HintPath>..\packages\Autofac.2.6.3.862\lib\NET40\Autofac.dll</HintPath>
</Reference>
<Reference Include="Autofac.Configuration">
<HintPath>..\packages\Autofac.2.6.3.862\lib\NET40\Autofac.Configuration.dll</HintPath>
</Reference>
<Reference Include="AutoMapper">
<HintPath>..\packages\AutoMapper.2.2.0\lib\net40\AutoMapper.dll</HintPath>
</Reference>
<Reference Include="Ninject, Version=3.0.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Ninject.3.0.1.10\lib\net40\Ninject.dll</HintPath>
</Reference>
<Reference Include="ServiceStack">
<HintPath>..\packages\ServiceStack.3.9.25\lib\net35\ServiceStack.dll</HintPath>
</Reference>
<Reference Include="ServiceStack.Common">
<HintPath>..\packages\ServiceStack.Common.3.9.25\lib\net35\ServiceStack.Common.dll</HintPath>
</Reference>
<Reference Include="ServiceStack.ContainerAdapter.Ninject">
<HintPath>..\packages\ServiceStack.ContainerAdapter.Ninject.1.0.4526.38581\lib\net40\ServiceStack.ContainerAdapter.Ninject.dll</HintPath>
</Reference>
<Reference Include="ServiceStack.Interfaces">
<HintPath>..\packages\ServiceStack.Common.3.9.25\lib\net35\ServiceStack.Interfaces.dll</HintPath>
</Reference>
@ -94,6 +93,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="AppHost.cs" />
<Compile Include="AutofacContainerAdapter.cs" />
<Compile Include="Bootstrapper.cs" />
<Compile Include="Exceptions\InvalidApiKeyException.cs" />
<Compile Include="Filters\ValidApiRequestAttribute.cs" />

@ -1,7 +1,6 @@
using System.Collections.Generic;
using System.Linq;
using AutoMapper;
using Ninject;
using NzbDrone.Api.Filters;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Repository.Quality;
@ -14,7 +13,6 @@ namespace NzbDrone.Api.QualityProfiles
{
private readonly QualityProvider _qualityProvider;
[Inject]
public QualityProfileService(QualityProvider qualityProvider)
{
_qualityProvider = qualityProvider;

@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using AutoMapper;
using Ninject;
using NzbDrone.Api.Filters;
using NzbDrone.Core.Providers;
using ServiceStack.ServiceInterface;
@ -14,7 +13,6 @@ namespace NzbDrone.Api.QualityType
{
private readonly QualityTypeProvider _qualityTypeProvider;
[Inject]
public QualityTypeService(QualityTypeProvider qualityTypeProvider)
{
_qualityTypeProvider = qualityTypeProvider;

@ -1,10 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Autofac" version="2.6.3.862" targetFramework="net40" />
<package id="AutoMapper" version="2.2.0" targetFramework="net40" />
<package id="Ninject" version="3.0.1.10" targetFramework="net40" />
<package id="ServiceStack" version="3.9.25" targetFramework="net40" />
<package id="ServiceStack.Common" version="3.9.25" targetFramework="net40" />
<package id="ServiceStack.ContainerAdapter.Ninject" version="1.0.4526.38581" targetFramework="net40" />
<package id="ServiceStack.OrmLite.SqlServer" version="3.9.26" targetFramework="net40" />
<package id="ServiceStack.Redis" version="3.9.25" targetFramework="net40" />
<package id="ServiceStack.Text" version="3.9.27" targetFramework="net40" />

@ -1,6 +1,6 @@
using FluentAssertions;
using Autofac;
using FluentAssertions;
using NUnit.Framework;
using Ninject;
using NzbDrone.Test.Common;
namespace NzbDrone.App.Test
@ -11,14 +11,14 @@ namespace NzbDrone.App.Test
[Test]
public void Kernel_can_get_kernel()
{
CentralDispatch.Kernel.Should().NotBeNull();
CentralDispatch.Container.Should().NotBeNull();
}
[Test]
public void Kernel_should_return_same_kernel()
{
var firstKernel = CentralDispatch.Kernel;
var secondKernel = CentralDispatch.Kernel;
var firstKernel = CentralDispatch.Container;
var secondKernel = CentralDispatch.Container;
firstKernel.Should().BeSameAs(secondKernel);
}
@ -26,7 +26,7 @@ namespace NzbDrone.App.Test
[Test]
public void Kernel_should_be_able_to_resolve_ApplicationServer()
{
var appServer = CentralDispatch.Kernel.Get<ApplicationServer>();
var appServer = CentralDispatch.Container.Resolve<ApplicationServer>();
appServer.Should().NotBeNull();
}
@ -34,8 +34,8 @@ namespace NzbDrone.App.Test
[Test]
public void Kernel_should_resolve_same_ApplicationServer_instance()
{
var appServer1 = CentralDispatch.Kernel.Get<ApplicationServer>();
var appServer2 = CentralDispatch.Kernel.Get<ApplicationServer>();
var appServer1 = CentralDispatch.Container.Resolve<ApplicationServer>();
var appServer2 = CentralDispatch.Container.Resolve<ApplicationServer>();
appServer1.Should().BeSameAs(appServer2);
}

@ -3,8 +3,7 @@
//using FluentAssertions;
//using Moq;
//using NUnit.Framework;
//using Ninject;
//using NzbDrone.Common;
////using NzbDrone.Common;
//using NzbDrone.Common.Model;
//using NzbDrone.Providers;
//using NzbDrone.Test.Common;

@ -53,6 +53,12 @@
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="Autofac">
<HintPath>..\packages\Autofac.2.6.3.862\lib\NET40\Autofac.dll</HintPath>
</Reference>
<Reference Include="Autofac.Configuration">
<HintPath>..\packages\Autofac.2.6.3.862\lib\NET40\Autofac.Configuration.dll</HintPath>
</Reference>
<Reference Include="FizzWare.NBuilder, Version=3.0.1.0, Culture=neutral, PublicKeyToken=5651b03e12e42c12, processorArchitecture=MSIL">
<HintPath>..\packages\NBuilder.3.0.1.1\lib\FizzWare.NBuilder.dll</HintPath>
</Reference>
@ -63,10 +69,6 @@
<Reference Include="Moq">
<HintPath>..\packages\Moq.4.0.10827\lib\NET40\Moq.dll</HintPath>
</Reference>
<Reference Include="Ninject, Version=3.0.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Ninject.3.0.1.10\lib\net40\Ninject.dll</HintPath>
</Reference>
<Reference Include="NLog, Version=2.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.2.0.0.2000\lib\net40\NLog.dll</HintPath>
</Reference>

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Autofac" version="2.6.3.862" targetFramework="net40" />
<package id="FluentAssertions" version="1.7.0" />
<package id="Moq" version="4.0.10827" />
<package id="NBuilder" version="3.0.1.1" />
<package id="Ninject" version="3.0.1.10" targetFramework="net40" />
<package id="NLog" version="2.0.0.2000" />
<package id="NUnit" version="2.6.0.12054" />
</packages>

@ -53,6 +53,12 @@
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="Autofac">
<HintPath>..\packages\Autofac.2.6.3.862\lib\NET40\Autofac.dll</HintPath>
</Reference>
<Reference Include="Autofac.Configuration">
<HintPath>..\packages\Autofac.2.6.3.862\lib\NET40\Autofac.Configuration.dll</HintPath>
</Reference>
<Reference Include="FluentAssertions, Version=1.7.0.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\FluentAssertions.1.7.0\Lib\net40\FluentAssertions.dll</HintPath>
@ -60,10 +66,6 @@
<Reference Include="Moq">
<HintPath>..\packages\Moq.4.0.10827\lib\NET40\Moq.dll</HintPath>
</Reference>
<Reference Include="Ninject, Version=3.0.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Ninject.3.0.1.10\lib\net40\Ninject.dll</HintPath>
</Reference>
<Reference Include="NLog">
<HintPath>..\packages\NLog.2.0.0.2000\lib\net40\NLog.dll</HintPath>
</Reference>

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Autofac" version="2.6.3.862" targetFramework="net40" />
<package id="FluentAssertions" version="1.7.0" />
<package id="Moq" version="4.0.10827" />
<package id="Ninject" version="3.0.1.10" targetFramework="net40" />
<package id="NLog" version="2.0.0.2000" />
<package id="NUnit" version="2.6.0.12054" />
</packages>

@ -4,7 +4,6 @@ using System.Linq;
using System.Xml.Linq;
using System.Xml.XPath;
using NLog;
using Ninject;
using NzbDrone.Common.Model;
namespace NzbDrone.Common
@ -16,7 +15,6 @@ namespace NzbDrone.Common
private readonly string _configFile;
[Inject]
public ConfigFileProvider(EnvironmentProvider environmentProvider)
{
_environmentProvider = environmentProvider;

@ -5,7 +5,6 @@ using System.IO;
using System.Net;
using System.Text;
using NLog;
using Ninject;
namespace NzbDrone.Common
{
@ -14,7 +13,6 @@ namespace NzbDrone.Common
private readonly EnvironmentProvider _environmentProvider;
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
[Inject]
public HttpProvider(EnvironmentProvider environmentProvider)
{
_environmentProvider = environmentProvider;

@ -2,7 +2,6 @@
using System;
using System.Diagnostics;
using NLog;
using Ninject;
namespace NzbDrone.Common
{
@ -14,24 +13,6 @@ namespace NzbDrone.Common
private readonly ProcessProvider _processProvider;
private readonly EnvironmentProvider _environmentProvider;
[Inject]
public IISProvider(ConfigFileProvider configFileProvider, ProcessProvider processProvider, EnvironmentProvider environmentProvider)
{
_configFileProvider = configFileProvider;
_processProvider = processProvider;
_environmentProvider = environmentProvider;
}
public IISProvider()
{
}
public string AppUrl
{
get { return string.Format("http://localhost:{0}/", _configFileProvider.Port); }
}
public int IISProcessId { get; private set; }
public bool ServerStarted { get; private set; }
@ -78,6 +59,22 @@ namespace NzbDrone.Common
iisProcess.Exited += IIS_EXITED;
}
public IISProvider(ConfigFileProvider configFileProvider, ProcessProvider processProvider, EnvironmentProvider environmentProvider)
{
_configFileProvider = configFileProvider;
_processProvider = processProvider;
_environmentProvider = environmentProvider;
}
public IISProvider()
{
}
public string AppUrl
{
get { return string.Format("http://localhost:{0}/", _configFileProvider.Port); }
}
private static void OnErrorDataReceived(object sender, DataReceivedEventArgs e)
{
if (e == null || String.IsNullOrWhiteSpace(e.Data))
@ -118,7 +115,6 @@ namespace NzbDrone.Common
{
RestartServer();
}
private void OnOutputDataReceived(object s, DataReceivedEventArgs e)
{
if (e == null || String.IsNullOrWhiteSpace(e.Data) || e.Data.StartsWith("Request started:") ||

@ -53,6 +53,12 @@
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="Autofac">
<HintPath>..\packages\Autofac.2.6.3.862\lib\NET40\Autofac.dll</HintPath>
</Reference>
<Reference Include="Autofac.Configuration">
<HintPath>..\packages\Autofac.2.6.3.862\lib\NET40\Autofac.Configuration.dll</HintPath>
</Reference>
<Reference Include="Exceptron.Client, Version=1.0.7.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Exceptron.Client.1.0.7\lib\net20\Exceptron.Client.dll</HintPath>
@ -61,10 +67,6 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Ninject, Version=3.0.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Ninject.3.0.1.10\lib\net40\Ninject.dll</HintPath>
</Reference>
<Reference Include="NLog">
<HintPath>..\packages\NLog.2.0.0.2000\lib\net40\NLog.dll</HintPath>
</Reference>

@ -5,7 +5,6 @@ using System.Net;
using System.Text;
using NLog;
using Newtonsoft.Json;
using Ninject;
using NzbDrone.Common.Contract;
namespace NzbDrone.Common
@ -19,7 +18,6 @@ namespace NzbDrone.Common
private readonly EnvironmentProvider _environmentProvider;
[Inject]
public RestProvider(EnvironmentProvider environmentProvider)
{
_environmentProvider = environmentProvider;

@ -4,7 +4,6 @@ using System.Linq;
using System.Security.Principal;
using NLog;
using NetFwTypeLib;
using Ninject;
namespace NzbDrone.Common
{
@ -16,7 +15,6 @@ namespace NzbDrone.Common
private readonly EnvironmentProvider _environmentProvider;
private readonly ProcessProvider _processProvider;
[Inject]
public SecurityProvider(ConfigFileProvider configFileProvider, EnvironmentProvider environmentProvider,
ProcessProvider processProvider)
{

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Autofac" version="2.6.3.862" targetFramework="net40" />
<package id="Exceptron.Client" version="1.0.7" targetFramework="net40" />
<package id="Newtonsoft.Json" version="4.5.11" targetFramework="net40" />
<package id="Ninject" version="3.0.1.10" targetFramework="net40" />
<package id="NLog" version="2.0.0.2000" />
</packages>

@ -2,14 +2,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Autofac;
using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Common;
using NzbDrone.Core.Jobs;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Providers.ExternalNotification;
using NzbDrone.Core.Providers.Indexer;
using NzbDrone.Core.Providers.Metadata;
using NzbDrone.Core.Test.Framework;
using Ninject;
namespace NzbDrone.Core.Test
{
@ -18,13 +20,17 @@ namespace NzbDrone.Core.Test
{
readonly IList<Type> indexers = typeof(CentralDispatch).Assembly.GetTypes().Where(t => t.IsSubclassOf(typeof(IndexerBase))).ToList();
readonly IList<Type> jobs = typeof(CentralDispatch).Assembly.GetTypes().Where(t => t.GetInterfaces().Contains(typeof(IJob))).ToList();
readonly IList<Type> extNotifications = typeof(CentralDispatch).Assembly.GetTypes().Where(t => t.IsSubclassOf(typeof(ExternalNotificationBase))).ToList();
readonly IList<Type> metadata = typeof(CentralDispatch).Assembly.GetTypes().Where(t => t.IsSubclassOf(typeof(MetadataBase))).ToList();
private IKernel kernel;
private IContainer kernel;
public CentralDispatchFixture()
{
InitLogging();
kernel = new CentralDispatch().Kernel;
var dispatch = new CentralDispatch();
kernel = dispatch.BuildContainer();
WebTimer.Stop();
}
@ -44,60 +50,93 @@ namespace NzbDrone.Core.Test
foreach (var provider in providers)
{
Console.WriteLine("Resolving " + provider.Name);
kernel.Get(provider).Should().NotBeNull();
kernel.Resolve(provider).Should().NotBeNull();
}
}
[Test]
public void All_jobs_should_be_registered()
{
//Assert
var registeredJobs = kernel.GetAll<IJob>();
var registeredJobs = kernel.Resolve<IEnumerable<IJob>>();
jobs.Should().NotBeEmpty();
registeredJobs.Should().HaveSameCount(jobs);
}
[Test]
public void All_indexers_should_be_registered()
{
//Assert
var registeredIndexers = kernel.GetAll<IndexerBase>();
var registeredIndexers = kernel.Resolve<IEnumerable<IndexerBase>>();
indexers.Should().NotBeEmpty();
registeredIndexers.Should().HaveSameCount(indexers);
}
[Test]
public void All_externalNotifiers_should_be_registered()
{
//Assert
var externalNotificationBases = kernel.Resolve<IEnumerable<ExternalNotificationBase>>();
extNotifications.Should().NotBeEmpty();
externalNotificationBases.Should().HaveSameCount(extNotifications);
}
[Test]
public void All_metadata_clients_should_be_registered()
{
//Assert
var metadataBases = kernel.Resolve<IEnumerable<MetadataBase>>();
metadata.Should().NotBeEmpty();
metadataBases.Should().HaveSameCount(metadata);
}
[Test]
public void jobs_are_initialized()
{
kernel.Get<JobProvider>().All().Should().HaveSameCount(jobs);
kernel.Resolve<JobProvider>().All().Should().HaveSameCount(jobs);
}
[Test]
public void indexers_are_initialized()
{
kernel.Get<IndexerProvider>().All().Should().HaveSameCount(indexers);
kernel.Resolve<IndexerProvider>().All().Should().HaveSameCount(indexers);
}
[Test]
public void externalNotifiers_are_initialized()
{
kernel.Resolve<ExternalNotificationProvider>().All().Should().HaveSameCount(extNotifications);
}
[Test]
public void metadata_clients_are_initialized()
{
kernel.Resolve<MetadataProvider>().All().Should().HaveSameCount(metadata);
}
[Test]
public void quality_profile_initialized()
{
kernel.Get<QualityProvider>().All().Should().HaveCount(2);
kernel.Resolve<QualityProvider>().All().Should().HaveCount(2);
}
[Test]
public void JobProvider_should_be_singletone()
{
var first = kernel.Get<JobProvider>();
var second = kernel.Get<JobProvider>();
var first = kernel.Resolve<JobProvider>();
var second = kernel.Resolve<JobProvider>();
first.Should().BeSameAs(second);
}

@ -54,7 +54,6 @@ namespace NzbDrone.Core.Test.Framework
Mocker.SetConstant(Db);
}
protected static ProgressNotification MockNotification
{
get

@ -6,7 +6,6 @@ using System.Linq;
using System.Xml.Linq;
using FluentAssertions;
using NUnit.Framework;
using Ninject;
using NzbDrone.Common;
using NzbDrone.Core.Helpers;
using NzbDrone.Core.Providers;

@ -1,11 +1,12 @@
using System;
using System.Data;
using System.Linq;
using Autofac;
using FluentAssertions;
using NLog;
using NUnit.Framework;
using Ninject;
using NzbDrone.Common;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Providers.Core;
using NzbDrone.Core.Repository;
@ -17,24 +18,27 @@ namespace NzbDrone.Core.Test.Integeration
[TestFixture(Category = "ServiceIngeneration")]
public class ServiceIntegerationFixture : CoreTest
{
private KernelBase _kernel;
private IContainer _container;
[SetUp]
public void Setup()
{
WithRealDb();
_kernel = new StandardKernel();
_kernel.Bind<IDatabase>().ToConstant(Db);
var builder = new CentralDispatch().ContainerBuilder;
builder.Register(c => Db)
.As<IDatabase>();
_container = builder.Build();
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.ServiceRootUrl)
.Returns("http://services.nzbdrone.com");
}
[Test]
public void should_be_able_to_update_scene_mapping()
{
_kernel.Get<SceneMappingProvider>().UpdateMappings();
_container.Resolve<SceneMappingProvider>().UpdateMappings();
var mappings = Db.Fetch<SceneMapping>();
mappings.Should().NotBeEmpty();
@ -47,7 +51,7 @@ namespace NzbDrone.Core.Test.Integeration
[Test]
public void should_be_able_to_get_daily_series_ids()
{
var dailySeries = _kernel.Get<ReferenceDataProvider>().GetDailySeriesIds();
var dailySeries = _container.Resolve<ReferenceDataProvider>().GetDailySeriesIds();
dailySeries.Should().NotBeEmpty();
dailySeries.Should().OnlyContain(c => c > 0);
@ -76,11 +80,6 @@ namespace NzbDrone.Core.Test.Integeration
hash.Should().HaveLength(8);
}
}
}
}

@ -56,6 +56,12 @@
<Reference Include="Accessibility">
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="Autofac">
<HintPath>..\packages\Autofac.2.6.3.862\lib\NET40\Autofac.dll</HintPath>
</Reference>
<Reference Include="Autofac.Configuration">
<HintPath>..\packages\Autofac.2.6.3.862\lib\NET40\Autofac.Configuration.dll</HintPath>
</Reference>
<Reference Include="AutoMoq">
<HintPath>..\packages\AutoMoq.1.6.1\lib\AutoMoq.dll</HintPath>
</Reference>
@ -97,10 +103,6 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Ninject, Version=3.0.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Ninject.3.0.1.10\lib\net40\Ninject.dll</HintPath>
</Reference>
<Reference Include="NLog, Version=2.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.2.0.0.2000\lib\net40\NLog.dll</HintPath>
</Reference>

@ -69,7 +69,7 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests
[Test]
public void running_scheduled_jobs_should_updates_last_execution_time()
{
IList<IJob> BaseFakeJobs = new List<IJob> { fakeJob };
IEnumerable<IJob> BaseFakeJobs = new List<IJob> { fakeJob };
Mocker.SetConstant(BaseFakeJobs);
//Act
@ -86,7 +86,7 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests
[Test]
public void failing_scheduled_job_should_mark_job_as_failed()
{
IList<IJob> BaseFakeJobs = new List<IJob> { brokenJob };
IEnumerable<IJob> BaseFakeJobs = new List<IJob> { brokenJob };
Mocker.SetConstant(BaseFakeJobs);
//Act
@ -105,7 +105,7 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests
[Test]
public void scheduler_skips_jobs_that_arent_mature_yet()
{
IList<IJob> BaseFakeJobs = new List<IJob> { fakeJob };
IEnumerable<IJob> BaseFakeJobs = new List<IJob> { fakeJob };
Mocker.SetConstant(BaseFakeJobs);
//Act
@ -126,7 +126,7 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests
//after execution so the job can successfully run.
public void can_run_async_job_again()
{
IList<IJob> BaseFakeJobs = new List<IJob> { fakeJob };
IEnumerable<IJob> BaseFakeJobs = new List<IJob> { fakeJob };
Mocker.SetConstant(BaseFakeJobs);
var jobProvider = Mocker.Resolve<JobProvider>();
@ -146,7 +146,7 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests
[Test]
public void no_concurent_jobs()
{
IList<IJob> BaseFakeJobs = new List<IJob> { slowJob };
IEnumerable<IJob> BaseFakeJobs = new List<IJob> { slowJob };
Mocker.SetConstant(BaseFakeJobs);
var jobProvider = Mocker.Resolve<JobProvider>();
@ -166,7 +166,7 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests
[Test]
public void can_run_broken_job_again()
{
IList<IJob> BaseFakeJobs = new List<IJob> { brokenJob };
IEnumerable<IJob> BaseFakeJobs = new List<IJob> { brokenJob };
Mocker.SetConstant(BaseFakeJobs);
@ -188,7 +188,7 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests
[Test]
public void schedule_hit_should_be_ignored_if_queue_is_running()
{
IList<IJob> fakeJobs = new List<IJob> { slowJob, fakeJob };
IEnumerable<IJob> fakeJobs = new List<IJob> { slowJob, fakeJob };
Mocker.SetConstant(fakeJobs);
@ -210,8 +210,7 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests
[Test]
public void can_queue_jobs_at_the_same_time()
{
IList<IJob> BaseFakeJobs = new List<IJob> { slowJob, fakeJob };
IEnumerable<IJob> BaseFakeJobs = new List<IJob> { slowJob, fakeJob };
Mocker.SetConstant(BaseFakeJobs);
var jobProvider = Mocker.Resolve<JobProvider>();
@ -238,7 +237,7 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests
[Test]
public void Init_Jobs()
{
IList<IJob> BaseFakeJobs = new List<IJob> { fakeJob };
IEnumerable<IJob> BaseFakeJobs = new List<IJob> { fakeJob };
Mocker.SetConstant(BaseFakeJobs);
@ -265,7 +264,7 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests
for (int i = 0; i < 2; i++)
{
var fakeTimer = new FakeJob();
IList<IJob> BaseFakeJobs = new List<IJob> { fakeTimer };
IEnumerable<IJob> BaseFakeJobs = new List<IJob> { fakeTimer };
Mocker.SetConstant(BaseFakeJobs);
@ -287,7 +286,7 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests
[Test]
public void inti_should_removed_jobs_that_no_longer_exist()
{
IList<IJob> fakeJobs = new List<IJob> { fakeJob };
IEnumerable<IJob> fakeJobs = new List<IJob> { fakeJob };
Mocker.SetConstant(fakeJobs);
WithRealDb();
@ -307,7 +306,7 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests
[Test]
public void inti_should_removed_jobs_that_no_longer_exist_even_with_same_name()
{
IList<IJob> fakeJobs = new List<IJob> { fakeJob };
IEnumerable<IJob> fakeJobs = new List<IJob> { fakeJob };
Mocker.SetConstant(fakeJobs);
WithRealDb();
@ -329,7 +328,7 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests
[Test]
public void init_should_update_existing_job()
{
IList<IJob> fakeJobs = new List<IJob> { fakeJob };
IEnumerable<IJob> fakeJobs = new List<IJob> { fakeJob };
Mocker.SetConstant(fakeJobs);
WithRealDb();
@ -364,7 +363,7 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests
[Test]
public void jobs_with_zero_interval_are_registered_as_disabled()
{
IList<IJob> fakeJobs = new List<IJob> { disabledJob };
IEnumerable<IJob> fakeJobs = new List<IJob> { disabledJob };
Mocker.SetConstant(fakeJobs);
var jobProvider = Mocker.Resolve<JobProvider>();
@ -378,7 +377,7 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests
[Test]
public void disabled_jobs_arent_run_by_scheduler()
{
IList<IJob> BaseFakeJobs = new List<IJob> { disabledJob };
IEnumerable<IJob> BaseFakeJobs = new List<IJob> { disabledJob };
Mocker.SetConstant(BaseFakeJobs);
var jobProvider = Mocker.Resolve<JobProvider>();
@ -394,7 +393,7 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests
[Test]
public void job_with_specific_target_should_not_update_last_execution()
{
IList<IJob> BaseFakeJobs = new List<IJob> { fakeJob };
IEnumerable<IJob> BaseFakeJobs = new List<IJob> { fakeJob };
Mocker.SetConstant(BaseFakeJobs);
//Act
@ -412,7 +411,7 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests
[Test]
public void job_with_specific_target_should_not_set_success_flag()
{
IList<IJob> BaseFakeJobs = new List<IJob> { fakeJob };
IEnumerable<IJob> BaseFakeJobs = new List<IJob> { fakeJob };
Mocker.SetConstant(BaseFakeJobs);
//Act
@ -430,7 +429,7 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests
[Test]
public void duplicated_queue_item_should_start_queue_if_its_not_running()
{
IList<IJob> BaseFakeJobs = new List<IJob> { fakeJob };
IEnumerable<IJob> BaseFakeJobs = new List<IJob> { fakeJob };
Mocker.SetConstant(BaseFakeJobs);
var stuckQueueItem = new JobQueueItem
@ -456,7 +455,7 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests
[Test]
public void Item_added_to_queue_while_scheduler_runs_should_be_executed()
{
IList<IJob> BaseFakeJobs = new List<IJob> { slowJob, disabledJob };
IEnumerable<IJob> BaseFakeJobs = new List<IJob> { slowJob, disabledJob };
Mocker.SetConstant(BaseFakeJobs);
ResetLastExecution();
@ -477,7 +476,7 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests
[Test]
public void trygin_to_queue_unregistered_job_should_fail()
{
IList<IJob> BaseFakeJobs = new List<IJob> { slowJob, disabledJob };
IEnumerable<IJob> BaseFakeJobs = new List<IJob> { slowJob, disabledJob };
Mocker.SetConstant(BaseFakeJobs);
var jobProvider = Mocker.Resolve<JobProvider>();
@ -492,7 +491,7 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests
[Test]
public void scheduled_job_should_have_scheduler_as_source()
{
IList<IJob> BaseFakeJobs = new List<IJob> { slowJob, fakeJob};
IEnumerable<IJob> BaseFakeJobs = new List<IJob> { slowJob, fakeJob};
Mocker.SetConstant(BaseFakeJobs);
var jobProvider = Mocker.Resolve<JobProvider>();
@ -504,8 +503,5 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests
WaitForQueue();
}
}
}

@ -3,9 +3,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Autofac;
using FluentAssertions;
using NUnit.Framework;
using Ninject;
using NzbDrone.Common;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Test.Framework;
@ -24,7 +24,14 @@ namespace NzbDrone.Core.Test.ProviderTests
[SetUp]
public void Setup()
{
tvDbProvider = new StandardKernel().Get<TvDbProvider>();
var builder = new ContainerBuilder();
builder.RegisterType<EnvironmentProvider>();
builder.RegisterType<TvDbProvider>();
var container = builder.Build();
tvDbProvider = container.Resolve<TvDbProvider>();
}
[TearDown]

@ -7,7 +7,6 @@ using System.Linq;
using FluentAssertions;
using Moq;
using NUnit.Framework;
using Ninject;
using NzbDrone.Common;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Test.Framework;

@ -5,7 +5,6 @@ using System.Collections.Generic;
using System.Linq;
using FluentAssertions;
using NUnit.Framework;
using Ninject;
using NzbDrone.Common;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Test.Framework;

@ -7,7 +7,6 @@ using System.Linq;
using FluentAssertions;
using Moq;
using NUnit.Framework;
using Ninject;
using NzbDrone.Common;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Test.Framework;

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Autofac" version="2.6.3.862" targetFramework="net40" />
<package id="AutoMoq" version="1.6.1" targetFramework="net40" />
<package id="CommonServiceLocator" version="1.0" targetFramework="net40" />
<package id="EntityFramework" version="4.3.1" targetFramework="net40" />
@ -10,7 +11,6 @@
<package id="Moq" version="4.0.10827" />
<package id="NBuilder" version="3.0.1.1" />
<package id="Newtonsoft.Json" version="4.5.11" targetFramework="net40" />
<package id="Ninject" version="3.0.1.10" targetFramework="net40" />
<package id="NLog" version="2.0.0.2000" />
<package id="NUnit" version="2.6.0.12054" />
<package id="Prowlin" version="0.9.4456.26422" targetFramework="net40" />

@ -0,0 +1,94 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autofac;
using Autofac.Builder;
using Autofac.Core;
using SignalR;
namespace NzbDrone.Core
{
public class AutofacSignalrDependencyResolver : DefaultDependencyResolver, IDependencyResolver, IRegistrationSource
{
private ILifetimeScope LifetimeScope { get; set; }
public AutofacSignalrDependencyResolver(ILifetimeScope lifetimeScope)
{
LifetimeScope = lifetimeScope;
var currentRegistrationSource =
LifetimeScope.ComponentRegistry.Sources.FirstOrDefault(s => s.GetType() == GetType());
if (currentRegistrationSource != null)
{
((AutofacSignalrDependencyResolver)currentRegistrationSource).LifetimeScope = lifetimeScope;
}
else
{
LifetimeScope.ComponentRegistry.AddRegistrationSource(this);
}
}
public AutofacSignalrDependencyResolver()
{
}
public override object GetService(Type serviceType)
{
object result;
if (LifetimeScope == null)
{
return base.GetService(serviceType);
}
if (LifetimeScope.TryResolve(serviceType, out result))
{
return result;
}
return null;
}
public override IEnumerable<object> GetServices(Type serviceType)
{
object result;
if (LifetimeScope == null)
{
return base.GetServices(serviceType);
}
if (LifetimeScope.TryResolve(typeof(IEnumerable<>).MakeGenericType(serviceType), out result))
{
return (IEnumerable<object>)result;
}
return Enumerable.Empty<object>();
}
public IEnumerable<IComponentRegistration> RegistrationsFor(Service service, Func<Service, IEnumerable<IComponentRegistration>> registrationAccessor)
{
var typedService = service as TypedService;
if (typedService != null)
{
var instances = base.GetServices(typedService.ServiceType);
if (instances != null)
{
return instances
.Select(i => RegistrationBuilder.ForDelegate(i.GetType(), (c, p) => i).As(typedService.ServiceType)
.InstancePerLifetimeScope()
.PreserveExistingDefaults()
.CreateRegistration());
}
}
return Enumerable.Empty<IComponentRegistration>();
}
bool IRegistrationSource.IsAdapterForIndividualComponents
{
get { return false; }
}
}
}

@ -3,8 +3,8 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using DeskMetrics;
using Ninject;
using Autofac;
using Autofac.Core;
using NLog;
using NzbDrone.Common;
using NzbDrone.Core.Instrumentation;
@ -17,10 +17,7 @@ using NzbDrone.Core.Providers.Metadata;
using NzbDrone.Core.Repository;
using PetaPoco;
using SignalR;
using SignalR.Hosting.AspNet;
using SignalR.Infrastructure;
using Connection = NzbDrone.Core.Datastore.Connection;
using Xbmc = NzbDrone.Core.Providers.ExternalNotification.Xbmc;
namespace NzbDrone.Core
{
@ -29,142 +26,102 @@ namespace NzbDrone.Core
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
private readonly EnvironmentProvider _environmentProvider;
public StandardKernel Kernel { get; private set; }
public ContainerBuilder ContainerBuilder { get; private set; }
public CentralDispatch()
{
_environmentProvider = new EnvironmentProvider();
logger.Debug("Initializing Kernel:");
Kernel = new StandardKernel();
logger.Debug("Initializing ContainerBuilder:");
ContainerBuilder = new ContainerBuilder();
GlobalHost.DependencyResolver = new NinjectDependencyResolver(Kernel);
ContainerBuilder.RegisterAssemblyTypes(typeof(DiskProvider).Assembly).SingleInstance();
ContainerBuilder.RegisterAssemblyTypes(typeof(CentralDispatch).Assembly).SingleInstance();
ContainerBuilder.RegisterType<EnvironmentProvider>();
InitDatabase();
InitReporting();
InitQuality();
InitExternalNotifications();
InitMetadataProviders();
InitIndexers();
InitJobs();
RegisterExternalNotifications();
RegisterMetadataProviders();
RegisterIndexers();
RegisterJobs();
}
private void InitDatabase()
{
logger.Info("Initializing Database...");
logger.Info("Registering Database...");
var appDataPath = _environmentProvider.GetAppDataPath();
if (!Directory.Exists(appDataPath)) Directory.CreateDirectory(appDataPath);
var connection = Kernel.Get<Connection>();
Kernel.Bind<IDatabase>().ToMethod(c => connection.GetMainPetaPocoDb()).InTransientScope();
Kernel.Bind<IDatabase>().ToMethod(c => connection.GetLogPetaPocoDb(false)).WhenInjectedInto<DatabaseTarget>().InSingletonScope();
Kernel.Bind<IDatabase>().ToMethod(c => connection.GetLogPetaPocoDb()).WhenInjectedInto<LogProvider>();
Kernel.Bind<LogDbContext>().ToMethod(c => connection.GetLogEfContext()).WhenInjectedInto<LogProvider>().InSingletonScope();
ContainerBuilder.Register(c => c.Resolve<Connection>().GetMainPetaPocoDb())
.As<IDatabase>();
Kernel.Get<DatabaseTarget>().Register();
LogConfiguration.Reload();
}
ContainerBuilder.Register(c => c.Resolve<Connection>().GetLogPetaPocoDb(false))
.SingleInstance()
.Named<IDatabase>("DatabaseTarget");
private void InitReporting()
{
EnvironmentProvider.UGuid = Kernel.Get<ConfigProvider>().UGuid;
ReportingService.RestProvider = Kernel.Get<RestProvider>();
ReportingService.SetupExceptronDriver();
ContainerBuilder.Register(c => c.Resolve<Connection>().GetLogPetaPocoDb())
.Named<IDatabase>("LogProvider");
ContainerBuilder.Register(c => c.Resolve<Connection>().GetLogEfContext())
.As<LogDbContext>()
.SingleInstance();
ContainerBuilder.RegisterType<DatabaseTarget>().WithParameter(ResolvedParameter.ForNamed<IDatabase>("DatabaseTarget"));
ContainerBuilder.RegisterType<LogProvider>().WithParameter(ResolvedParameter.ForNamed<IDatabase>("LogProvider"));
}
private void InitQuality()
private void RegisterIndexers()
{
logger.Debug("Initializing Quality...");
Kernel.Get<QualityProvider>().SetupDefaultProfiles();
Kernel.Get<QualityTypeProvider>().SetupDefault();
logger.Debug("Registering Indexers...");
ContainerBuilder.RegisterAssemblyTypes(typeof(CentralDispatch).Assembly)
.Where(t => t.BaseType == typeof(IndexerBase))
.As<IndexerBase>();
}
private void InitIndexers()
private void RegisterJobs()
{
logger.Debug("Initializing Indexers...");
Kernel.Bind<IndexerBase>().To<NzbsRUs>();
Kernel.Bind<IndexerBase>().To<Newznab>();
Kernel.Bind<IndexerBase>().To<Wombles>();
Kernel.Bind<IndexerBase>().To<FileSharingTalk>();
Kernel.Bind<IndexerBase>().To<NzbIndex>();
Kernel.Bind<IndexerBase>().To<NzbClub>();
Kernel.Bind<IndexerBase>().To<Omgwtfnzbs>();
Kernel.Bind<IndexerBase>().To<Nzbx>();
var indexers = Kernel.GetAll<IndexerBase>();
Kernel.Get<IndexerProvider>().InitializeIndexers(indexers.ToList());
logger.Debug("Registering Background Jobs...");
var newznabIndexers = new List<NewznabDefinition>
{
new NewznabDefinition { Enable = false, Name = "Nzbs.org", Url = "http://nzbs.org", BuiltIn = true },
new NewznabDefinition { Enable = false, Name = "Nzb.su", Url = "https://nzb.su", BuiltIn = true },
new NewznabDefinition { Enable = false, Name = "Dognzb.cr", Url = "https://dognzb.cr", BuiltIn = true }
};
ContainerBuilder.RegisterType<JobProvider>().SingleInstance();
Kernel.Get<NewznabProvider>().InitializeNewznabIndexers(newznabIndexers);
ContainerBuilder.RegisterAssemblyTypes(typeof(CentralDispatch).Assembly)
.Where(t => t.GetInterfaces().Contains(typeof(IJob)))
.As<IJob>()
.SingleInstance();
}
private void InitJobs()
private void RegisterExternalNotifications()
{
logger.Debug("Initializing Background Jobs...");
Kernel.Bind<JobProvider>().ToSelf().InSingletonScope();
Kernel.Bind<IJob>().To<RssSyncJob>().InSingletonScope();
Kernel.Bind<IJob>().To<ImportNewSeriesJob>().InSingletonScope();
Kernel.Bind<IJob>().To<UpdateInfoJob>().InSingletonScope();
Kernel.Bind<IJob>().To<DiskScanJob>().InSingletonScope();
Kernel.Bind<IJob>().To<DeleteSeriesJob>().InSingletonScope();
Kernel.Bind<IJob>().To<EpisodeSearchJob>().InSingletonScope();
Kernel.Bind<IJob>().To<PostDownloadScanJob>().InSingletonScope();
Kernel.Bind<IJob>().To<UpdateSceneMappingsJob>().InSingletonScope();
Kernel.Bind<IJob>().To<SeasonSearchJob>().InSingletonScope();
Kernel.Bind<IJob>().To<RenameSeasonJob>().InSingletonScope();
Kernel.Bind<IJob>().To<SeriesSearchJob>().InSingletonScope();
Kernel.Bind<IJob>().To<RenameSeriesJob>().InSingletonScope();
Kernel.Bind<IJob>().To<BacklogSearchJob>().InSingletonScope();
Kernel.Bind<IJob>().To<BannerDownloadJob>().InSingletonScope();
Kernel.Bind<IJob>().To<ConvertEpisodeJob>().InSingletonScope();
Kernel.Bind<IJob>().To<AppUpdateJob>().InSingletonScope();
Kernel.Bind<IJob>().To<TrimLogsJob>().InSingletonScope();
Kernel.Bind<IJob>().To<RecentBacklogSearchJob>().InSingletonScope();
Kernel.Bind<IJob>().To<SearchHistoryCleanupJob>().InSingletonScope();
Kernel.Bind<IJob>().To<PastWeekBacklogSearchJob>().InSingletonScope();
Kernel.Bind<IJob>().To<RefreshEpisodeMetadata>().InSingletonScope();
Kernel.Bind<IJob>().To<CleanupRecycleBinJob>().InSingletonScope();
Kernel.Bind<IJob>().To<EmptyRecycleBinJob>().InSingletonScope();
Kernel.Bind<IJob>().To<XemUpdateJob>().InSingletonScope();
Kernel.Bind<IJob>().To<AppShutdownJob>().InSingletonScope();
Kernel.Bind<IJob>().To<AppRestartJob>().InSingletonScope();
Kernel.Get<JobProvider>().Initialize();
Kernel.Get<WebTimer>().StartTimer(30);
logger.Debug("Registering External Notifications...");
ContainerBuilder.RegisterAssemblyTypes(typeof(CentralDispatch).Assembly)
.Where(t => t.BaseType == typeof(ExternalNotificationBase))
.As<ExternalNotificationBase>();
}
private void InitExternalNotifications()
private void RegisterMetadataProviders()
{
logger.Debug("Initializing External Notifications...");
Kernel.Bind<ExternalNotificationBase>().To<Xbmc>();
Kernel.Bind<ExternalNotificationBase>().To<Smtp>();
Kernel.Bind<ExternalNotificationBase>().To<Twitter>();
Kernel.Bind<ExternalNotificationBase>().To<Providers.ExternalNotification.Growl>();
Kernel.Bind<ExternalNotificationBase>().To<Prowl>();
Kernel.Bind<ExternalNotificationBase>().To<Plex>();
var notifiers = Kernel.GetAll<ExternalNotificationBase>();
Kernel.Get<ExternalNotificationProvider>().InitializeNotifiers(notifiers.ToList());
logger.Debug("Registering Metadata Providers...");
ContainerBuilder.RegisterAssemblyTypes(typeof(CentralDispatch).Assembly)
.Where(t => t.IsSubclassOf(typeof(MetadataBase)))
.As<MetadataBase>();
}
private void InitMetadataProviders()
private void RegisterReporting(IContainer container)
{
logger.Debug("Initializing Metadata Providers...");
Kernel.Bind<MetadataBase>().To<Providers.Metadata.Xbmc>().InSingletonScope();
EnvironmentProvider.UGuid = container.Resolve<ConfigProvider>().UGuid;
ReportingService.RestProvider = container.Resolve<RestProvider>();
ReportingService.SetupExceptronDriver();
}
var providers = Kernel.GetAll<MetadataBase>();
Kernel.Get<MetadataProvider>().Initialize(providers.ToList());
private void RegisterQuality(IContainer container)
{
logger.Debug("Initializing Quality...");
container.Resolve<QualityProvider>().SetupDefaultProfiles();
container.Resolve<QualityTypeProvider>().SetupDefault();
}
public void DedicateToHost()
@ -192,6 +149,45 @@ namespace NzbDrone.Core
}
}
public IContainer BuildContainer()
{
var container = ContainerBuilder.Build();
logger.Debug("Initializing Components");
container.Resolve<DatabaseTarget>().Register();
LogConfiguration.Reload();
RegisterReporting(container);
RegisterQuality(container);
var indexers = container.Resolve<IEnumerable<IndexerBase>>();
container.Resolve<IndexerProvider>().InitializeIndexers(indexers.ToList());
var newznabIndexers = new List<NewznabDefinition>
{
new NewznabDefinition { Enable = false, Name = "Nzbs.org", Url = "http://nzbs.org", BuiltIn = true },
new NewznabDefinition { Enable = false, Name = "Nzb.su", Url = "https://nzb.su", BuiltIn = true },
new NewznabDefinition { Enable = false, Name = "Dognzb.cr", Url = "https://dognzb.cr", BuiltIn = true }
};
container.Resolve<NewznabProvider>().InitializeNewznabIndexers(newznabIndexers);
container.Resolve<JobProvider>().Initialize();
container.Resolve<WebTimer>().StartTimer(30);
var notifiers = container.Resolve<IEnumerable<ExternalNotificationBase>>();
container.Resolve<ExternalNotificationProvider>().InitializeNotifiers(notifiers.ToList());
var providers = container.Resolve<IEnumerable<MetadataBase>>();
container.Resolve<MetadataProvider>().Initialize(providers.ToList());
//SignalR
GlobalHost.DependencyResolver = new AutofacSignalrDependencyResolver(container.BeginLifetimeScope("SignalR"));
return container;
}
private static void ShutDown()
{
logger.Info("Shutting down application...");

@ -1,6 +1,5 @@
using System;
using NLog.Config;
using Ninject;
using NLog;
using NLog.Targets;
using NLog.Targets.Wrappers;
@ -14,7 +13,6 @@ namespace NzbDrone.Core.Instrumentation
{
private readonly IDatabase _database;
[Inject]
public DatabaseTarget(IDatabase database)
{
_database = database;

@ -1,13 +1,11 @@
using System.Data.Common;
using System.Data.Entity;
using System.Linq;
using Ninject;
namespace NzbDrone.Core.Instrumentation
{
public class LogDbContext : DbContext
{
[Inject]
public LogDbContext(DbConnection connection)
: base(connection, false)
{

@ -3,11 +3,8 @@ using System.Linq;
using System.Diagnostics;
using System.IO;
using NLog;
using Ninject;
using NzbDrone.Common;
using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Providers.Core;
namespace NzbDrone.Core.Jobs
{
@ -20,7 +17,6 @@ namespace NzbDrone.Core.Jobs
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
[Inject]
public AppRestartJob(EnvironmentProvider environmentProvider, ProcessProvider processProvider,
ServiceProvider serviceProvider, IISProvider iisProvider)
{

@ -3,11 +3,8 @@ using System.Linq;
using System.Diagnostics;
using System.IO;
using NLog;
using Ninject;
using NzbDrone.Common;
using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Providers.Core;
namespace NzbDrone.Core.Jobs
{
@ -19,7 +16,6 @@ namespace NzbDrone.Core.Jobs
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
[Inject]
public AppShutdownJob(EnvironmentProvider environmentProvider, ProcessProvider processProvider, ServiceProvider serviceProvider)
{
_environmentProvider = environmentProvider;

@ -3,7 +3,6 @@ using System.Linq;
using System.Diagnostics;
using System.IO;
using NLog;
using Ninject;
using NzbDrone.Common;
using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers;
@ -23,7 +22,6 @@ namespace NzbDrone.Core.Jobs
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
[Inject]
public AppUpdateJob(UpdateProvider updateProvider, EnvironmentProvider environmentProvider, DiskProvider diskProvider,
HttpProvider httpProvider, ProcessProvider processProvider, ArchiveProvider archiveProvider, ConfigFileProvider configFileProvider)
{

@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using NLog;
using Ninject;
using NzbDrone.Core.Model;
using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers;
@ -20,7 +19,6 @@ namespace NzbDrone.Core.Jobs
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
[Inject]
public BacklogSearchJob(EpisodeProvider episodeProvider, EpisodeSearchJob episodeSearchJob,
SeasonSearchJob seasonSearchJob, ConfigProvider configProvider)
{

@ -1,7 +1,6 @@
using System;
using System.IO;
using System.Linq;
using Ninject;
using NLog;
using NzbDrone.Common;
using NzbDrone.Core.Model.Notification;
@ -19,7 +18,6 @@ namespace NzbDrone.Core.Jobs
private const string BANNER_URL_PREFIX = "http://www.thetvdb.com/banners/";
[Inject]
public BannerDownloadJob(SeriesProvider seriesProvider, BannerProvider bannerProvider)
{
_seriesProvider = seriesProvider;

@ -1,6 +1,5 @@
using System.Linq;
using System;
using Ninject;
using NLog;
using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers;
@ -12,7 +11,6 @@ namespace NzbDrone.Core.Jobs
{
private readonly RecycleBinProvider _recycleBinProvider;
[Inject]
public CleanupRecycleBinJob(RecycleBinProvider recycleBinProvider)
{
_recycleBinProvider = recycleBinProvider;

@ -1,6 +1,5 @@
using System.Linq;
using System;
using Ninject;
using NLog;
using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers;
@ -17,7 +16,6 @@ namespace NzbDrone.Core.Jobs
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
[Inject]
public ConvertEpisodeJob(HandbrakeProvider handbrakeProvider, AtomicParsleyProvider atomicParsleyProvider,
EpisodeProvider episodeProvider)
{

@ -1,6 +1,5 @@
using System.Linq;
using System;
using Ninject;
using NLog;
using NzbDrone.Common;
using NzbDrone.Core.Model.Notification;
@ -15,7 +14,6 @@ namespace NzbDrone.Core.Jobs
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
[Inject]
public DeleteSeriesJob(SeriesProvider seriesProvider, RecycleBinProvider recycleBinProvider)
{
_seriesProvider = seriesProvider;

@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Ninject;
using NLog;
using NzbDrone.Core.Helpers;
using NzbDrone.Core.Model.Notification;
@ -18,7 +17,6 @@ namespace NzbDrone.Core.Jobs
private readonly ConfigProvider _configProvider;
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
[Inject]
public DiskScanJob(SeriesProvider seriesProvider, DiskScanProvider diskScanProvider,
ConfigProvider configProvider)
{

@ -1,6 +1,5 @@
using System.Linq;
using System;
using Ninject;
using NLog;
using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers;
@ -12,7 +11,6 @@ namespace NzbDrone.Core.Jobs
{
private readonly RecycleBinProvider _recycleBinProvider;
[Inject]
public EmptyRecycleBinJob(RecycleBinProvider recycleBinProvider)
{
_recycleBinProvider = recycleBinProvider;

@ -1,6 +1,5 @@
using System.Linq;
using System;
using Ninject;
using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers;
@ -10,7 +9,6 @@ namespace NzbDrone.Core.Jobs
{
private readonly SearchProvider _searchProvider;
[Inject]
public EpisodeSearchJob(SearchProvider searchProvider)
{
_searchProvider = searchProvider;

@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Ninject;
using NLog;
using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers;
@ -28,7 +27,6 @@ namespace NzbDrone.Core.Jobs
private List<int> _attemptedSeries;
[Inject]
public ImportNewSeriesJob(SeriesProvider seriesProvider, EpisodeProvider episodeProvider,
MediaFileProvider mediaFileProvider, UpdateInfoJob updateInfoJob,
DiskScanJob diskScanJob, BannerDownloadJob bannerDownloadJob,

@ -7,7 +7,6 @@ using System.Diagnostics;
using System.Linq;
using System.Threading;
using NLog;
using Ninject;
using NzbDrone.Core.Model;
using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers;
@ -25,7 +24,7 @@ namespace NzbDrone.Core.Jobs
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
private readonly IDatabase _database;
private readonly NotificationProvider _notificationProvider;
private readonly IList<IJob> _jobs;
private readonly IEnumerable<IJob> _jobs;
private Thread _jobThread;
public Stopwatch StopWatch { get; private set; }
@ -36,8 +35,7 @@ namespace NzbDrone.Core.Jobs
private ProgressNotification _notification;
[Inject]
public JobProvider(IDatabase database, NotificationProvider notificationProvider, IList<IJob> jobs)
public JobProvider(IDatabase database, NotificationProvider notificationProvider, IEnumerable<IJob> jobs)
{
StopWatch = new Stopwatch();
_database = database;

@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using NLog;
using Ninject;
using NzbDrone.Core.Model;
using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers;
@ -19,7 +18,6 @@ namespace NzbDrone.Core.Jobs
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
[Inject]
public PastWeekBacklogSearchJob(EpisodeProvider episodeProvider, EpisodeSearchJob episodeSearchJob,
ConfigProvider configProvider)
{

@ -1,7 +1,6 @@
using System.Linq;
using System;
using NLog;
using Ninject;
using NzbDrone.Common;
using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers;
@ -17,7 +16,6 @@ namespace NzbDrone.Core.Jobs
private readonly ConfigProvider _configProvider;
private readonly DiskProvider _diskProvider;
[Inject]
public PostDownloadScanJob(PostDownloadProvider postDownloadProvider,ConfigProvider configProvider, DiskProvider diskProvider)
{
_postDownloadProvider = postDownloadProvider;

@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using NLog;
using Ninject;
using NzbDrone.Core.Model;
using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers;
@ -19,7 +18,6 @@ namespace NzbDrone.Core.Jobs
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
[Inject]
public RecentBacklogSearchJob(EpisodeProvider episodeProvider, EpisodeSearchJob episodeSearchJob,
ConfigProvider configProvider)
{

@ -2,7 +2,6 @@ using System.Collections.Generic;
using System.Linq;
using System;
using NLog;
using Ninject;
using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Repository;
@ -17,7 +16,6 @@ namespace NzbDrone.Core.Jobs
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
[Inject]
public RefreshEpisodeMetadata(MediaFileProvider mediaFileProvider, SeriesProvider seriesProvider,
MetadataProvider metadataProvider)
{

@ -2,7 +2,6 @@ using System.Collections.Generic;
using System.Linq;
using System;
using NLog;
using Ninject;
using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Repository;
@ -19,7 +18,6 @@ namespace NzbDrone.Core.Jobs
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
[Inject]
public RenameSeasonJob(MediaFileProvider mediaFileProvider, DiskScanProvider diskScanProvider,
ExternalNotificationProvider externalNotificationProvider, SeriesProvider seriesProvider,
MetadataProvider metadataProvider)

@ -2,7 +2,6 @@ using System.Collections.Generic;
using System.Linq;
using System;
using NLog;
using Ninject;
using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Repository;
@ -19,7 +18,6 @@ namespace NzbDrone.Core.Jobs
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
[Inject]
public RenameSeriesJob(MediaFileProvider mediaFileProvider, DiskScanProvider diskScanProvider,
ExternalNotificationProvider externalNotificationProvider, SeriesProvider seriesProvider,
MetadataProvider metadataProvider)

@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Ninject;
using NLog;
using NzbDrone.Core.Model;
using NzbDrone.Core.Model.Notification;
@ -26,7 +25,6 @@ namespace NzbDrone.Core.Jobs
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
[Inject]
public RssSyncJob(DownloadProvider downloadProvider, IndexerProvider indexerProvider,
MonitoredEpisodeSpecification isMonitoredEpisodeSpecification, AllowedDownloadSpecification allowedDownloadSpecification,
UpgradeHistorySpecification upgradeHistorySpecification, ConfigProvider configProvider)

@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Ninject;
using NLog;
using NzbDrone.Core.Helpers;
using NzbDrone.Core.Model.Notification;
@ -16,7 +15,6 @@ namespace NzbDrone.Core.Jobs
private readonly SearchHistoryProvider _searchHistoryProvider;
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
[Inject]
public SearchHistoryCleanupJob(SearchHistoryProvider searchHistoryProvider)
{
_searchHistoryProvider = searchHistoryProvider;

@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using NLog;
using Ninject;
using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Repository;
@ -17,7 +16,6 @@ namespace NzbDrone.Core.Jobs
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
[Inject]
public SeasonSearchJob(SearchProvider searchProvider, EpisodeSearchJob episodeSearchJob,
EpisodeProvider episodeProvider)
{

@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using NLog;
using Ninject;
using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Repository;
@ -16,7 +15,6 @@ namespace NzbDrone.Core.Jobs
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
[Inject]
public SeriesSearchJob(SeasonSearchJob seasonSearchJob,
SeasonProvider seasonProvider)
{

@ -1,6 +1,5 @@
using System;
using System.Linq;
using Ninject;
using NzbDrone.Core.Instrumentation;
using NzbDrone.Core.Model.Notification;
@ -10,7 +9,6 @@ namespace NzbDrone.Core.Jobs
{
private readonly LogProvider _logProvider;
[Inject]
public TrimLogsJob(LogProvider logProvider)
{
_logProvider = logProvider;

@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using NLog;
using Ninject;
using NzbDrone.Core.Helpers;
using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers;
@ -19,7 +18,6 @@ namespace NzbDrone.Core.Jobs
private readonly ConfigProvider _configProvider;
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
[Inject]
public UpdateInfoJob(SeriesProvider seriesProvider, EpisodeProvider episodeProvider,
ReferenceDataProvider referenceDataProvider, ConfigProvider configProvider)
{

@ -1,6 +1,5 @@
using System;
using System.Linq;
using Ninject;
using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers;
@ -10,7 +9,6 @@ namespace NzbDrone.Core.Jobs
{
private readonly SceneMappingProvider _sceneNameMappingProvider;
[Inject]
public UpdateSceneMappingsJob(SceneMappingProvider sceneNameMappingProvider)
{
_sceneNameMappingProvider = sceneNameMappingProvider;

@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using NLog;
using Ninject;
using NzbDrone.Core.Helpers;
using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers;
@ -16,7 +15,6 @@ namespace NzbDrone.Core.Jobs
private static readonly Logger _logger = LogManager.GetCurrentClassLogger();
[Inject]
public XemUpdateJob(XemProvider xemProvider)
{
_xemProvider = xemProvider;

@ -1,34 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ninject;
using SignalR;
namespace NzbDrone.Core
{
public class NinjectDependencyResolver : DefaultDependencyResolver
{
private readonly IKernel _kernel;
public NinjectDependencyResolver(IKernel kernel)
{
if (kernel == null)
{
throw new ArgumentNullException("kernel");
}
_kernel = kernel;
}
public override object GetService(Type serviceType)
{
return _kernel.TryGet(serviceType) ?? base.GetService(serviceType);
}
public override IEnumerable<object> GetServices(Type serviceType)
{
return _kernel.GetAll(serviceType).Concat(base.GetServices(serviceType));
}
}
}

@ -123,6 +123,12 @@
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Reference Include="Autofac">
<HintPath>..\packages\Autofac.2.6.3.862\lib\NET40\Autofac.dll</HintPath>
</Reference>
<Reference Include="Autofac.Configuration">
<HintPath>..\packages\Autofac.2.6.3.862\lib\NET40\Autofac.Configuration.dll</HintPath>
</Reference>
<Reference Include="DataTables.Mvc.Core, Version=0.1.0.85, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\DataTables.Mvc.Core.0.1.0.85\lib\DataTables.Mvc.Core.dll</HintPath>
@ -167,10 +173,6 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Ninject, Version=3.0.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Ninject.3.0.1.10\lib\net40\Ninject.dll</HintPath>
</Reference>
<Reference Include="NLog, Version=2.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.2.0.0.2000\lib\net40\NLog.dll</HintPath>
</Reference>
@ -318,7 +320,7 @@
<Compile Include="Model\Xem\XemResult.cs" />
<Compile Include="Model\Xem\XemSceneTvdbMapping.cs" />
<Compile Include="Model\Xem\XemValues.cs" />
<Compile Include="NinjectDependencyResolver.cs" />
<Compile Include="AutofacSignalrDependencyResolver.cs" />
<Compile Include="Providers\BannerProvider.cs" />
<Compile Include="Providers\DecisionEngine\AllowedReleaseGroupSpecification.cs" />
<Compile Include="Providers\DecisionEngine\CustomStartDateSpecification.cs" />

@ -2,7 +2,6 @@
using System.Linq;
using Ionic.Zip;
using NLog;
using Ninject;
using NzbDrone.Common;
namespace NzbDrone.Core.Providers
@ -12,7 +11,6 @@ namespace NzbDrone.Core.Providers
private readonly EnvironmentProvider _environmentProvider;
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
[Inject]
public BackupProvider(EnvironmentProvider environmentProvider)
{
_environmentProvider = environmentProvider;

@ -4,7 +4,6 @@ using System.IO;
using System.Linq;
using System.Text;
using NLog;
using Ninject;
using NzbDrone.Common;
using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Repository;
@ -20,7 +19,6 @@ namespace NzbDrone.Core.Providers
private const string BANNER_URL_PREFIX = "http://www.thetvdb.com/banners/";
[Inject]
public BannerProvider(HttpProvider httpProvider, EnvironmentProvider environmentProvider,
DiskProvider diskProvider)
{

@ -3,7 +3,6 @@ using System.IO;
using System.Linq;
using Ionic.Zip;
using NLog;
using Ninject;
using NzbDrone.Common;
namespace NzbDrone.Core.Providers.Core

@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Ninject;
using NLog;
using NzbDrone.Core.Model;
using NzbDrone.Core.Model.Sabnzbd;
@ -18,7 +17,6 @@ namespace NzbDrone.Core.Providers.Core
private readonly IDatabase _database;
[Inject]
public ConfigProvider(IDatabase database)
{
_database = database;

@ -4,7 +4,6 @@ using System.Net;
using System.Net.Sockets;
using System.Text;
using NLog;
using Ninject;
namespace NzbDrone.Core.Providers.Core
{
@ -12,7 +11,6 @@ namespace NzbDrone.Core.Providers.Core
{
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
[Inject]
public UdpProvider()
{

@ -1,6 +1,5 @@
using System.Linq;
using NLog;
using Ninject;
using NzbDrone.Core.Model;
namespace NzbDrone.Core.Providers.DecisionEngine
@ -11,7 +10,6 @@ namespace NzbDrone.Core.Providers.DecisionEngine
private readonly EpisodeProvider _episodeProvider;
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
[Inject]
public AcceptableSizeSpecification(QualityTypeProvider qualityTypeProvider, EpisodeProvider episodeProvider)
{
_qualityTypeProvider = qualityTypeProvider;

@ -1,6 +1,5 @@
using System.Linq;
using NLog;
using Ninject;
using NzbDrone.Core.Model;
using NzbDrone.Core.Repository.Search;
@ -17,7 +16,6 @@ namespace NzbDrone.Core.Providers.DecisionEngine
private readonly CustomStartDateSpecification _customStartDateSpecification;
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
[Inject]
public AllowedDownloadSpecification(QualityAllowedByProfileSpecification qualityAllowedByProfileSpecification,
UpgradeDiskSpecification upgradeDiskSpecification, AcceptableSizeSpecification acceptableSizeSpecification,
AlreadyInQueueSpecification alreadyInQueueSpecification, RetentionSpecification retentionSpecification,

@ -1,7 +1,6 @@
using System;
using System.Linq;
using NLog;
using Ninject;
using NzbDrone.Core.Model;
using NzbDrone.Core.Providers.Core;
@ -12,7 +11,6 @@ namespace NzbDrone.Core.Providers.DecisionEngine
private readonly ConfigProvider _configProvider;
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
[Inject]
public AllowedReleaseGroupSpecification(ConfigProvider configProvider)
{
_configProvider = configProvider;

@ -1,6 +1,5 @@
using System.Linq;
using NLog;
using Ninject;
using NzbDrone.Core.Model;
namespace NzbDrone.Core.Providers.DecisionEngine
@ -11,7 +10,6 @@ namespace NzbDrone.Core.Providers.DecisionEngine
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
[Inject]
public AlreadyInQueueSpecification(DownloadProvider downloadProvider)
{
_downloadProvider = downloadProvider;

@ -1,6 +1,5 @@
using System.Linq;
using NLog;
using Ninject;
using NzbDrone.Core.Model;
namespace NzbDrone.Core.Providers.DecisionEngine

@ -1,6 +1,5 @@
using System.Linq;
using NLog;
using Ninject;
using NzbDrone.Core.Model;
namespace NzbDrone.Core.Providers.DecisionEngine
@ -11,7 +10,6 @@ namespace NzbDrone.Core.Providers.DecisionEngine
private readonly EpisodeProvider _episodeProvider;
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
[Inject]
public MonitoredEpisodeSpecification(SeriesProvider seriesProvider, EpisodeProvider episodeProvider)
{
_seriesProvider = seriesProvider;

@ -1,6 +1,5 @@
using System.Linq;
using NLog;
using Ninject;
using NzbDrone.Core.Model;
using NzbDrone.Core.Providers.Core;
@ -11,7 +10,6 @@ namespace NzbDrone.Core.Providers.DecisionEngine
private readonly ConfigProvider _configProvider;
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
[Inject]
public RetentionSpecification(ConfigProvider configProvider)
{
_configProvider = configProvider;

@ -1,6 +1,5 @@
using System.Linq;
using NLog;
using Ninject;
using NzbDrone.Core.Model;
namespace NzbDrone.Core.Providers.DecisionEngine
@ -11,7 +10,6 @@ namespace NzbDrone.Core.Providers.DecisionEngine
private readonly QualityUpgradeSpecification _qualityUpgradeSpecification;
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
[Inject]
public UpgradeDiskSpecification(EpisodeProvider episodeProvider, QualityUpgradeSpecification qualityUpgradeSpecification)
{
_episodeProvider = episodeProvider;

@ -1,6 +1,5 @@
using System.Linq;
using NLog;
using Ninject;
using NzbDrone.Core.Model;
namespace NzbDrone.Core.Providers.DecisionEngine
@ -12,7 +11,6 @@ namespace NzbDrone.Core.Providers.DecisionEngine
private readonly QualityUpgradeSpecification _qualityUpgradeSpecification;
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
[Inject]
public UpgradeHistorySpecification(EpisodeProvider episodeProvider, HistoryProvider historyProvider, QualityUpgradeSpecification qualityUpgradeSpecification)
{
_episodeProvider = episodeProvider;

@ -1,6 +1,5 @@
using System.Linq;
using NLog;
using Ninject;
using NzbDrone.Core.Repository;
namespace NzbDrone.Core.Providers.DecisionEngine
@ -10,7 +9,6 @@ namespace NzbDrone.Core.Providers.DecisionEngine
private readonly QualityProvider _qualityProvider;
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
[Inject]
public UpgradePossibleSpecification(QualityProvider qualityProvider)
{
_qualityProvider = qualityProvider;

@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Ninject;
using NLog;
using NzbDrone.Common;
using NzbDrone.Core.Model;
@ -25,7 +24,6 @@ namespace NzbDrone.Core.Providers
private readonly ConfigProvider _configProvider;
private readonly RecycleBinProvider _recycleBinProvider;
[Inject]
public DiskScanProvider(DiskProvider diskProvider, EpisodeProvider episodeProvider,
SeriesProvider seriesProvider, MediaFileProvider mediaFileProvider,
ExternalNotificationProvider externalNotificationProvider, DownloadProvider downloadProvider,

@ -2,7 +2,6 @@
using System.IO;
using System.Linq;
using NLog;
using Ninject;
using NzbDrone.Common;
using NzbDrone.Core.Model;
using NzbDrone.Core.Providers.Core;
@ -20,7 +19,6 @@ namespace NzbDrone.Core.Providers.DownloadClients
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
[Inject]
public BlackholeProvider(ConfigProvider configProvider, HttpProvider httpProvider,
DiskProvider diskProvider, UpgradeHistorySpecification upgradeHistorySpecification)
{

@ -2,7 +2,6 @@
using System.IO;
using System.Linq;
using NLog;
using Ninject;
using NzbDrone.Common;
using NzbDrone.Core.Model;
using NzbDrone.Core.Providers.Core;
@ -19,7 +18,6 @@ namespace NzbDrone.Core.Providers.DownloadClients
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
[Inject]
public PneumaticProvider(ConfigProvider configProvider, HttpProvider httpProvider,
DiskProvider diskProvider, UpgradeHistorySpecification upgradeHistorySpecification)
{

@ -6,7 +6,6 @@ using System.Text.RegularExpressions;
using System.Web;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Ninject;
using NLog;
using NzbDrone.Common;
using NzbDrone.Core.Model;
@ -21,7 +20,6 @@ namespace NzbDrone.Core.Providers.DownloadClients
private readonly ConfigProvider _configProvider;
private readonly HttpProvider _httpProvider;
[Inject]
public SabProvider(ConfigProvider configProvider, HttpProvider httpProvider)
{
_configProvider = configProvider;

@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Ninject;
using NLog;
using NzbDrone.Core.Model;
using NzbDrone.Core.Providers.Core;
@ -23,7 +22,6 @@ namespace NzbDrone.Core.Providers
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
[Inject]
public DownloadProvider(SabProvider sabProvider, HistoryProvider historyProvider,
EpisodeProvider episodeProvider, ExternalNotificationProvider externalNotificationProvider,
ConfigProvider configProvider, BlackholeProvider blackholeProvider,

@ -2,7 +2,6 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using Ninject;
using NLog;
using NzbDrone.Core.Model;
using NzbDrone.Core.Repository;
@ -20,7 +19,6 @@ namespace NzbDrone.Core.Providers
private readonly SeasonProvider _seasonProvider;
private readonly IDatabase _database;
[Inject]
public EpisodeProvider(IDatabase database, TvDbProvider tvDbProviderProvider,
SeasonProvider seasonProvider)
{

@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Ninject;
using NLog;
using NzbDrone.Core.Model;
using NzbDrone.Core.Providers.ExternalNotification;
@ -17,7 +16,6 @@ namespace NzbDrone.Core.Providers
private IEnumerable<ExternalNotificationBase> _notifiers;
[Inject]
public ExternalNotificationProvider(IDatabase database, IEnumerable<ExternalNotificationBase> notifiers)
{
_database = database;

@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Linq;
using DataTables.Mvc.Core.Helpers;
using DataTables.Mvc.Core.Models;
using Ninject;
using NLog;
using NzbDrone.Core.Model;
using NzbDrone.Core.Repository;
@ -18,7 +17,6 @@ namespace NzbDrone.Core.Providers
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
[Inject]
public HistoryProvider(IDatabase database)
{
_database = database;

@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.ServiceModel.Syndication;
using System.Text.RegularExpressions;
using Ninject;
using NzbDrone.Common;
using NzbDrone.Core.Model;
using NzbDrone.Core.Providers.Core;
@ -11,7 +10,6 @@ namespace NzbDrone.Core.Providers.Indexer
{
public class FileSharingTalk : IndexerBase
{
[Inject]
public FileSharingTalk(HttpProvider httpProvider, ConfigProvider configProvider)
: base(httpProvider, configProvider)
{

@ -4,7 +4,6 @@ using System.Linq;
using System.Net;
using System.ServiceModel.Syndication;
using System.Text.RegularExpressions;
using Ninject;
using NLog;
using NzbDrone.Common;
using NzbDrone.Core.Model;
@ -21,7 +20,6 @@ namespace NzbDrone.Core.Providers.Indexer
protected static readonly Regex TitleSearchRegex = new Regex(@"[\W]", RegexOptions.IgnoreCase | RegexOptions.Compiled);
protected static readonly Regex RemoveThe = new Regex(@"^the\s", RegexOptions.IgnoreCase | RegexOptions.Compiled);
[Inject]
protected IndexerBase(HttpProvider httpProvider, ConfigProvider configProvider)
{
_httpProvider = httpProvider;

@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.ServiceModel.Syndication;
using System.Text.RegularExpressions;
using Ninject;
using NzbDrone.Common;
using NzbDrone.Core.Model;
using NzbDrone.Core.Providers.Core;
@ -13,7 +12,6 @@ namespace NzbDrone.Core.Providers.Indexer
{
private readonly NewznabProvider _newznabProvider;
[Inject]
public Newznab(HttpProvider httpProvider, ConfigProvider configProvider, NewznabProvider newznabProvider)
: base(httpProvider, configProvider)
{

@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.ServiceModel.Syndication;
using System.Text.RegularExpressions;
using Ninject;
using NzbDrone.Common;
using NzbDrone.Core.Model;
using NzbDrone.Core.Providers.Core;
@ -11,7 +10,6 @@ namespace NzbDrone.Core.Providers.Indexer
{
public class NzbClub : IndexerBase
{
[Inject]
public NzbClub(HttpProvider httpProvider, ConfigProvider configProvider)
: base(httpProvider, configProvider)
{

@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.ServiceModel.Syndication;
using System.Text.RegularExpressions;
using Ninject;
using NzbDrone.Common;
using NzbDrone.Core.Model;
using NzbDrone.Core.Providers.Core;
@ -11,7 +10,6 @@ namespace NzbDrone.Core.Providers.Indexer
{
public class NzbIndex : IndexerBase
{
[Inject]
public NzbIndex(HttpProvider httpProvider, ConfigProvider configProvider)
: base(httpProvider, configProvider)
{

@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.ServiceModel.Syndication;
using System.Text.RegularExpressions;
using Ninject;
using NzbDrone.Common;
using NzbDrone.Core.Model;
using NzbDrone.Core.Providers.Core;
@ -11,7 +10,6 @@ namespace NzbDrone.Core.Providers.Indexer
{
public class NzbsRUs : IndexerBase
{
[Inject]
public NzbsRUs(HttpProvider httpProvider, ConfigProvider configProvider) : base(httpProvider, configProvider)
{
}

@ -6,7 +6,6 @@ using System.ServiceModel.Syndication;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Ninject;
using NzbDrone.Common;
using NzbDrone.Core.Model;
using NzbDrone.Core.Model.Nzbx;
@ -16,7 +15,6 @@ namespace NzbDrone.Core.Providers.Indexer
{
class Nzbx : IndexerBase
{
[Inject]
public Nzbx(HttpProvider httpProvider, ConfigProvider configProvider)
: base(httpProvider, configProvider)
{

@ -4,7 +4,6 @@ using System.Linq;
using System.ServiceModel.Syndication;
using System.Text;
using System.Text.RegularExpressions;
using Ninject;
using NzbDrone.Common;
using NzbDrone.Core.Model;
using NzbDrone.Core.Providers.Core;
@ -13,7 +12,6 @@ namespace NzbDrone.Core.Providers.Indexer
{
class Omgwtfnzbs : IndexerBase
{
[Inject]
public Omgwtfnzbs(HttpProvider httpProvider, ConfigProvider configProvider)
: base(httpProvider, configProvider)
{

@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.ServiceModel.Syndication;
using System.Text.RegularExpressions;
using Ninject;
using NzbDrone.Common;
using NzbDrone.Core.Model;
using NzbDrone.Core.Providers.Core;
@ -11,7 +10,6 @@ namespace NzbDrone.Core.Providers.Indexer
{
public class Wombles : IndexerBase
{
[Inject]
public Wombles(HttpProvider httpProvider, ConfigProvider configProvider) : base(httpProvider, configProvider)
{
}

@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Ninject;
using NLog;
using NzbDrone.Core.Providers.Indexer;
using NzbDrone.Core.Repository;
@ -16,7 +15,6 @@ namespace NzbDrone.Core.Providers
private IEnumerable<IndexerBase> _indexers;
[Inject]
public IndexerProvider(IDatabase database, IEnumerable<IndexerBase> indexers)
{
_database = database;

@ -2,7 +2,6 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Ninject;
using NLog;
using NzbDrone.Core.Helpers;
using NzbDrone.Core.Providers.Core;
@ -20,7 +19,6 @@ namespace NzbDrone.Core.Providers
private readonly IDatabase _database;
private readonly EpisodeProvider _episodeProvider;
[Inject]
public MediaFileProvider(EpisodeProvider episodeProvider, ConfigProvider configProvider, IDatabase database)
{
_episodeProvider = episodeProvider;

@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Ninject;
using NLog;
using NzbDrone.Core.Model;
using NzbDrone.Core.Providers.ExternalNotification;
@ -20,7 +19,6 @@ namespace NzbDrone.Core.Providers
private IEnumerable<MetadataBase> _metadataProviders;
private readonly TvDbProvider _tvDbProvider;
[Inject]
public MetadataProvider(IDatabase database, IEnumerable<MetadataBase> metadataProviders,
TvDbProvider tvDbProvider)
{

@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Net;
using Ninject;
using NLog;
using NzbDrone.Core.Providers.Indexer;
using NzbDrone.Core.Repository;
@ -15,7 +14,6 @@ namespace NzbDrone.Core.Providers
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
private readonly IDatabase _database;
[Inject]
public NewznabProvider(IDatabase database)
{
_database = database;

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

Loading…
Cancel
Save