moved config to objectdb.
This commit is contained in:
parent
65061cdc96
commit
13658e3c6d
|
@ -11,6 +11,7 @@ using NzbDrone.Api.ErrorManagement;
|
||||||
using NzbDrone.Api.Extensions;
|
using NzbDrone.Api.Extensions;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
using NzbDrone.Core;
|
using NzbDrone.Core;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Lifecycle;
|
using NzbDrone.Core.Lifecycle;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
using SignalR;
|
using SignalR;
|
||||||
|
@ -68,7 +69,7 @@ namespace NzbDrone.Api
|
||||||
|
|
||||||
private void RegisterReporting(ILifetimeScope container)
|
private void RegisterReporting(ILifetimeScope container)
|
||||||
{
|
{
|
||||||
EnvironmentProvider.UGuid = container.Resolve<ConfigProvider>().UGuid;
|
EnvironmentProvider.UGuid = container.Resolve<ConfigService>().UGuid;
|
||||||
ReportingService.RestProvider = container.Resolve<RestProvider>();
|
ReportingService.RestProvider = container.Resolve<RestProvider>();
|
||||||
ReportingService.SetupExceptronDriver();
|
ReportingService.SetupExceptronDriver();
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ using FizzWare.NBuilder;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
using NzbDrone.Core.Providers;
|
using NzbDrone.Core.Providers;
|
||||||
|
@ -42,28 +43,28 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||||
[Test]
|
[Test]
|
||||||
public void should_be_true_when_allowedReleaseGroups_is_empty()
|
public void should_be_true_when_allowedReleaseGroups_is_empty()
|
||||||
{
|
{
|
||||||
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.AllowedReleaseGroups).Returns(String.Empty);
|
Mocker.GetMock<ConfigService>().SetupGet(s => s.AllowedReleaseGroups).Returns(String.Empty);
|
||||||
Mocker.Resolve<AllowedReleaseGroupSpecification>().IsSatisfiedBy(parseResult).Should().BeTrue();
|
Mocker.Resolve<AllowedReleaseGroupSpecification>().IsSatisfiedBy(parseResult).Should().BeTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_be_true_when_allowedReleaseGroups_is_nzbs_releaseGroup()
|
public void should_be_true_when_allowedReleaseGroups_is_nzbs_releaseGroup()
|
||||||
{
|
{
|
||||||
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.AllowedReleaseGroups).Returns("2HD");
|
Mocker.GetMock<ConfigService>().SetupGet(s => s.AllowedReleaseGroups).Returns("2HD");
|
||||||
Mocker.Resolve<AllowedReleaseGroupSpecification>().IsSatisfiedBy(parseResult).Should().BeTrue();
|
Mocker.Resolve<AllowedReleaseGroupSpecification>().IsSatisfiedBy(parseResult).Should().BeTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_be_true_when_allowedReleaseGroups_contains_nzbs_releaseGroup()
|
public void should_be_true_when_allowedReleaseGroups_contains_nzbs_releaseGroup()
|
||||||
{
|
{
|
||||||
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.AllowedReleaseGroups).Returns("2HD, LOL");
|
Mocker.GetMock<ConfigService>().SetupGet(s => s.AllowedReleaseGroups).Returns("2HD, LOL");
|
||||||
Mocker.Resolve<AllowedReleaseGroupSpecification>().IsSatisfiedBy(parseResult).Should().BeTrue();
|
Mocker.Resolve<AllowedReleaseGroupSpecification>().IsSatisfiedBy(parseResult).Should().BeTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_be_false_when_allowedReleaseGroups_does_not_contain_nzbs_releaseGroup()
|
public void should_be_false_when_allowedReleaseGroups_does_not_contain_nzbs_releaseGroup()
|
||||||
{
|
{
|
||||||
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.AllowedReleaseGroups).Returns("LOL,DTD");
|
Mocker.GetMock<ConfigService>().SetupGet(s => s.AllowedReleaseGroups).Returns("LOL,DTD");
|
||||||
Mocker.Resolve<AllowedReleaseGroupSpecification>().IsSatisfiedBy(parseResult).Should().BeFalse();
|
Mocker.Resolve<AllowedReleaseGroupSpecification>().IsSatisfiedBy(parseResult).Should().BeFalse();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ using FizzWare.NBuilder;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
using NzbDrone.Core.Providers;
|
using NzbDrone.Core.Providers;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
|
@ -37,22 +38,22 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||||
|
|
||||||
private void WithUnlimitedRetention()
|
private void WithUnlimitedRetention()
|
||||||
{
|
{
|
||||||
Mocker.GetMock<ConfigProvider>().SetupGet(c => c.Retention).Returns(0);
|
Mocker.GetMock<ConfigService>().SetupGet(c => c.Retention).Returns(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WithLongRetention()
|
private void WithLongRetention()
|
||||||
{
|
{
|
||||||
Mocker.GetMock<ConfigProvider>().SetupGet(c => c.Retention).Returns(1000);
|
Mocker.GetMock<ConfigService>().SetupGet(c => c.Retention).Returns(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WithShortRetention()
|
private void WithShortRetention()
|
||||||
{
|
{
|
||||||
Mocker.GetMock<ConfigProvider>().SetupGet(c => c.Retention).Returns(10);
|
Mocker.GetMock<ConfigService>().SetupGet(c => c.Retention).Returns(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WithEqualRetention()
|
private void WithEqualRetention()
|
||||||
{
|
{
|
||||||
Mocker.GetMock<ConfigProvider>().SetupGet(c => c.Retention).Returns(100);
|
Mocker.GetMock<ConfigService>().SetupGet(c => c.Retention).Returns(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Datastore;
|
using NzbDrone.Core.Datastore;
|
||||||
using NzbDrone.Core.Model.Notification;
|
using NzbDrone.Core.Model.Notification;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
|
@ -95,7 +96,7 @@ namespace NzbDrone.Core.Test.Framework
|
||||||
[TearDown]
|
[TearDown]
|
||||||
public void CoreTestTearDown()
|
public void CoreTestTearDown()
|
||||||
{
|
{
|
||||||
ConfigProvider.ClearCache();
|
ConfigService.ClearCache();
|
||||||
|
|
||||||
if (EnvironmentProvider.IsMono)
|
if (EnvironmentProvider.IsMono)
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,6 +10,7 @@ using FluentAssertions;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Indexers;
|
using NzbDrone.Core.Indexers;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
using NzbDrone.Core.Providers;
|
using NzbDrone.Core.Providers;
|
||||||
|
@ -29,17 +30,17 @@ namespace NzbDrone.Core.Test.IndexerTests
|
||||||
{
|
{
|
||||||
private void WithConfiguredIndexers()
|
private void WithConfiguredIndexers()
|
||||||
{
|
{
|
||||||
Mocker.GetMock<ConfigProvider>().SetupGet(c => c.NzbsOrgHash).Returns("MockedConfigValue");
|
Mocker.GetMock<ConfigService>().SetupGet(c => c.NzbsOrgHash).Returns("MockedConfigValue");
|
||||||
Mocker.GetMock<ConfigProvider>().SetupGet(c => c.NzbsOrgUId).Returns("MockedConfigValue");
|
Mocker.GetMock<ConfigService>().SetupGet(c => c.NzbsOrgUId).Returns("MockedConfigValue");
|
||||||
|
|
||||||
Mocker.GetMock<ConfigProvider>().SetupGet(c => c.NzbsrusHash).Returns("MockedConfigValue");
|
Mocker.GetMock<ConfigService>().SetupGet(c => c.NzbsrusHash).Returns("MockedConfigValue");
|
||||||
Mocker.GetMock<ConfigProvider>().SetupGet(c => c.NzbsrusUId).Returns("MockedConfigValue");
|
Mocker.GetMock<ConfigService>().SetupGet(c => c.NzbsrusUId).Returns("MockedConfigValue");
|
||||||
|
|
||||||
Mocker.GetMock<ConfigProvider>().SetupGet(c => c.FileSharingTalkUid).Returns("MockedConfigValue");
|
Mocker.GetMock<ConfigService>().SetupGet(c => c.FileSharingTalkUid).Returns("MockedConfigValue");
|
||||||
Mocker.GetMock<ConfigProvider>().SetupGet(c => c.FileSharingTalkSecret).Returns("MockedConfigValue");
|
Mocker.GetMock<ConfigService>().SetupGet(c => c.FileSharingTalkSecret).Returns("MockedConfigValue");
|
||||||
|
|
||||||
Mocker.GetMock<ConfigProvider>().SetupGet(c => c.OmgwtfnzbsUsername).Returns("MockedConfigValue");
|
Mocker.GetMock<ConfigService>().SetupGet(c => c.OmgwtfnzbsUsername).Returns("MockedConfigValue");
|
||||||
Mocker.GetMock<ConfigProvider>().SetupGet(c => c.OmgwtfnzbsApiKey).Returns("MockedConfigValue");
|
Mocker.GetMock<ConfigService>().SetupGet(c => c.OmgwtfnzbsApiKey).Returns("MockedConfigValue");
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestCase("nzbsrus.xml")]
|
[TestCase("nzbsrus.xml")]
|
||||||
|
|
|
@ -8,6 +8,7 @@ using FluentAssertions;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Indexers;
|
using NzbDrone.Core.Indexers;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
using NzbDrone.Core.Providers;
|
using NzbDrone.Core.Providers;
|
||||||
|
@ -75,8 +76,8 @@ namespace NzbDrone.Core.Test.Indexers
|
||||||
|
|
||||||
public class MockIndexer : IndexerBase
|
public class MockIndexer : IndexerBase
|
||||||
{
|
{
|
||||||
public MockIndexer(HttpProvider httpProvider, ConfigProvider configProvider)
|
public MockIndexer(HttpProvider httpProvider, ConfigService configService)
|
||||||
: base(httpProvider, configProvider)
|
: base(httpProvider, configService)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,8 +134,8 @@ namespace NzbDrone.Core.Test.Indexers
|
||||||
|
|
||||||
public class TestUrlIndexer : IndexerBase
|
public class TestUrlIndexer : IndexerBase
|
||||||
{
|
{
|
||||||
public TestUrlIndexer(HttpProvider httpProvider, ConfigProvider configProvider)
|
public TestUrlIndexer(HttpProvider httpProvider, ConfigService configService)
|
||||||
: base(httpProvider, configProvider)
|
: base(httpProvider, configService)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,8 +187,8 @@ namespace NzbDrone.Core.Test.Indexers
|
||||||
|
|
||||||
public class CustomParserIndexer : IndexerBase
|
public class CustomParserIndexer : IndexerBase
|
||||||
{
|
{
|
||||||
public CustomParserIndexer(HttpProvider httpProvider, ConfigProvider configProvider)
|
public CustomParserIndexer(HttpProvider httpProvider, ConfigService configService)
|
||||||
: base(httpProvider, configProvider)
|
: base(httpProvider, configService)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,8 +247,8 @@ namespace NzbDrone.Core.Test.Indexers
|
||||||
|
|
||||||
public class NotConfiguredIndexer : IndexerBase
|
public class NotConfiguredIndexer : IndexerBase
|
||||||
{
|
{
|
||||||
public NotConfiguredIndexer(HttpProvider httpProvider, ConfigProvider configProvider)
|
public NotConfiguredIndexer(HttpProvider httpProvider, ConfigService configService)
|
||||||
: base(httpProvider, configProvider)
|
: base(httpProvider, configService)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,8 +300,8 @@ namespace NzbDrone.Core.Test.Indexers
|
||||||
|
|
||||||
public class DefaultEnabledIndexer : IndexerBase
|
public class DefaultEnabledIndexer : IndexerBase
|
||||||
{
|
{
|
||||||
public DefaultEnabledIndexer(HttpProvider httpProvider, ConfigProvider configProvider)
|
public DefaultEnabledIndexer(HttpProvider httpProvider, ConfigService configService)
|
||||||
: base(httpProvider, configProvider)
|
: base(httpProvider, configService)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ using FizzWare.NBuilder;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
using NzbDrone.Core.Jobs;
|
using NzbDrone.Core.Jobs;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
|
@ -21,7 +22,7 @@ namespace NzbDrone.Core.Test.JobTests
|
||||||
{
|
{
|
||||||
private void WithEnableBacklogSearching()
|
private void WithEnableBacklogSearching()
|
||||||
{
|
{
|
||||||
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.EnableBacklogSearching).Returns(true);
|
Mocker.GetMock<ConfigService>().SetupGet(s => s.EnableBacklogSearching).Returns(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
|
|
@ -7,6 +7,7 @@ using FluentAssertions;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Jobs;
|
using NzbDrone.Core.Jobs;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
using NzbDrone.Core.Providers;
|
using NzbDrone.Core.Providers;
|
||||||
|
@ -44,7 +45,7 @@ namespace NzbDrone.Core.Test.JobTests
|
||||||
Mocker.GetMock<PostDownloadProvider>().Setup(s => s.ProcessDropFolder(path));
|
Mocker.GetMock<PostDownloadProvider>().Setup(s => s.ProcessDropFolder(path));
|
||||||
Mocker.Resolve<PostDownloadScanJob>().Start(MockNotification, new { Path = path });
|
Mocker.Resolve<PostDownloadScanJob>().Start(MockNotification, new { Path = path });
|
||||||
|
|
||||||
Mocker.GetMock<ConfigProvider>().Verify(s => s.DownloadClientTvDirectory, Times.Never());
|
Mocker.GetMock<ConfigService>().Verify(s => s.DownloadClientTvDirectory, Times.Never());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -52,10 +53,10 @@ namespace NzbDrone.Core.Test.JobTests
|
||||||
{
|
{
|
||||||
var path = @"C:\Test\Unsorted TV";
|
var path = @"C:\Test\Unsorted TV";
|
||||||
|
|
||||||
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.DownloadClientTvDirectory).Returns(path);
|
Mocker.GetMock<ConfigService>().SetupGet(s => s.DownloadClientTvDirectory).Returns(path);
|
||||||
Mocker.Resolve<PostDownloadScanJob>().Start(MockNotification, null);
|
Mocker.Resolve<PostDownloadScanJob>().Start(MockNotification, null);
|
||||||
|
|
||||||
Mocker.GetMock<ConfigProvider>().Verify(s => s.DownloadClientTvDirectory, Times.Once());
|
Mocker.GetMock<ConfigService>().Verify(s => s.DownloadClientTvDirectory, Times.Once());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -63,7 +64,7 @@ namespace NzbDrone.Core.Test.JobTests
|
||||||
{
|
{
|
||||||
var path = @"C:\Test\Unsorted TV";
|
var path = @"C:\Test\Unsorted TV";
|
||||||
|
|
||||||
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.DownloadClientTvDirectory).Returns(path);
|
Mocker.GetMock<ConfigService>().SetupGet(s => s.DownloadClientTvDirectory).Returns(path);
|
||||||
Mocker.Resolve<PostDownloadScanJob>().Start(MockNotification, null);
|
Mocker.Resolve<PostDownloadScanJob>().Start(MockNotification, null);
|
||||||
|
|
||||||
Mocker.GetMock<PostDownloadProvider>().Verify(s => s.ProcessDropFolder(path), Times.Once());
|
Mocker.GetMock<PostDownloadProvider>().Verify(s => s.ProcessDropFolder(path), Times.Once());
|
||||||
|
|
|
@ -6,6 +6,7 @@ using FizzWare.NBuilder;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
using NzbDrone.Core.Jobs;
|
using NzbDrone.Core.Jobs;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
|
@ -24,7 +25,7 @@ namespace NzbDrone.Core.Test.JobTests
|
||||||
{
|
{
|
||||||
private void WithEnableBacklogSearching()
|
private void WithEnableBacklogSearching()
|
||||||
{
|
{
|
||||||
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.EnableBacklogSearching).Returns(true);
|
Mocker.GetMock<ConfigService>().SetupGet(s => s.EnableBacklogSearching).Returns(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
|
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Jobs;
|
using NzbDrone.Core.Jobs;
|
||||||
using NzbDrone.Core.Model.Notification;
|
using NzbDrone.Core.Model.Notification;
|
||||||
using NzbDrone.Core.Providers;
|
using NzbDrone.Core.Providers;
|
||||||
|
@ -18,7 +19,7 @@ namespace NzbDrone.Core.Test.JobTests
|
||||||
{
|
{
|
||||||
public void WithMinutes(int minutes)
|
public void WithMinutes(int minutes)
|
||||||
{
|
{
|
||||||
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.RssSyncInterval).Returns(minutes);
|
Mocker.GetMock<ConfigService>().SetupGet(s => s.RssSyncInterval).Returns(minutes);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestCase(10)]
|
[TestCase(10)]
|
||||||
|
|
|
@ -172,7 +172,7 @@
|
||||||
<Compile Include="JobTests\PostDownloadScanJobFixture.cs" />
|
<Compile Include="JobTests\PostDownloadScanJobFixture.cs" />
|
||||||
<Compile Include="JobTests\RecentBacklogSearchJobTest.cs" />
|
<Compile Include="JobTests\RecentBacklogSearchJobTest.cs" />
|
||||||
<Compile Include="ParserTests\QualityParserFixture.cs" />
|
<Compile Include="ParserTests\QualityParserFixture.cs" />
|
||||||
<Compile Include="ProviderTests\ConfigProviderTests\ConfigCachingFixture.cs" />
|
<Compile Include="Configuration\ConfigCachingFixture.cs" />
|
||||||
<Compile Include="ProviderTests\BannerProviderTest.cs" />
|
<Compile Include="ProviderTests\BannerProviderTest.cs" />
|
||||||
<Compile Include="DecisionEngineTests\AllowedReleaseGroupSpecificationFixture.cs" />
|
<Compile Include="DecisionEngineTests\AllowedReleaseGroupSpecificationFixture.cs" />
|
||||||
<Compile Include="DecisionEngineTests\CustomStartDateSpecificationFixture.cs" />
|
<Compile Include="DecisionEngineTests\CustomStartDateSpecificationFixture.cs" />
|
||||||
|
@ -250,7 +250,7 @@
|
||||||
<Compile Include="Indexers\IndexerServiceTest.cs" />
|
<Compile Include="Indexers\IndexerServiceTest.cs" />
|
||||||
<Compile Include="HistoryTests\HistoryServiceTest.cs" />
|
<Compile Include="HistoryTests\HistoryServiceTest.cs" />
|
||||||
<Compile Include="ProviderTests\MediaFileProviderTest.cs" />
|
<Compile Include="ProviderTests\MediaFileProviderTest.cs" />
|
||||||
<Compile Include="ProviderTests\ConfigProviderTests\ConfigProviderFixture.cs" />
|
<Compile Include="Configuration\ConfigServiceFixture.cs" />
|
||||||
<Compile Include="TvTests\EpisodeProviderTests\EpisodeProviderTest.cs" />
|
<Compile Include="TvTests\EpisodeProviderTests\EpisodeProviderTest.cs" />
|
||||||
<Compile Include="Framework\TestDbHelper.cs" />
|
<Compile Include="Framework\TestDbHelper.cs" />
|
||||||
<Compile Include="ParserTests\ParserFixture.cs" />
|
<Compile Include="ParserTests\ParserFixture.cs" />
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using FluentAssertions;
|
|
||||||
using Moq;
|
|
||||||
using NUnit.Framework;
|
|
||||||
using NzbDrone.Core.Providers.Core;
|
|
||||||
using NzbDrone.Core.Repository;
|
|
||||||
using NzbDrone.Core.Test.Framework;
|
|
||||||
using PetaPoco;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test.ProviderTests.ConfigProviderTests
|
|
||||||
{
|
|
||||||
[TestFixture]
|
|
||||||
public class ConfigCachingFixture : CoreTest
|
|
||||||
{
|
|
||||||
[SetUp]
|
|
||||||
public void Setup()
|
|
||||||
{
|
|
||||||
Mocker.GetMock<IDatabase>().Setup(c => c.Fetch<Config>())
|
|
||||||
.Returns(new List<Config> { new Config { Key = "Key1", Value = "Value1" } });
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void getting_value_more_than_once_should_hit_db_once()
|
|
||||||
{
|
|
||||||
Mocker.Resolve<ConfigProvider>().GetValue("Key1", null).Should().Be("Value1");
|
|
||||||
Mocker.Resolve<ConfigProvider>().GetValue("Key1", null).Should().Be("Value1");
|
|
||||||
Mocker.Resolve<ConfigProvider>().GetValue("Key1", null).Should().Be("Value1");
|
|
||||||
|
|
||||||
Mocker.GetMock<IDatabase>().Verify(c => c.Fetch<Config>(), Times.Once());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,192 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Linq;
|
|
||||||
using FluentAssertions;
|
|
||||||
using NUnit.Framework;
|
|
||||||
using NzbDrone.Core.Providers.Core;
|
|
||||||
using NzbDrone.Core.Repository;
|
|
||||||
using NzbDrone.Core.Test.Framework;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test.ProviderTests.ConfigProviderTests
|
|
||||||
{
|
|
||||||
[TestFixture]
|
|
||||||
// ReSharper disable InconsistentNaming
|
|
||||||
public class ConfigProviderFixture : SqlCeTest
|
|
||||||
{
|
|
||||||
[SetUp]
|
|
||||||
public void SetUp()
|
|
||||||
{
|
|
||||||
WithRealDb();
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void Add_new_value_to_database()
|
|
||||||
{
|
|
||||||
const string key = "MY_KEY";
|
|
||||||
const string value = "MY_VALUE";
|
|
||||||
|
|
||||||
Mocker.Resolve<ConfigProvider>().SetValue(key, value);
|
|
||||||
Mocker.Resolve<ConfigProvider>().GetValue(key, "").Should().Be(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void Get_value_from_database()
|
|
||||||
{
|
|
||||||
const string key = "MY_KEY";
|
|
||||||
const string value = "MY_VALUE";
|
|
||||||
|
|
||||||
|
|
||||||
Db.Insert(new Config { Key = key, Value = value });
|
|
||||||
Db.Insert(new Config { Key = "Other Key", Value = "OtherValue" });
|
|
||||||
|
|
||||||
//Act
|
|
||||||
var result = Mocker.Resolve<ConfigProvider>().GetValue(key, "");
|
|
||||||
|
|
||||||
//Assert
|
|
||||||
result.Should().Be(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void Get_value_should_return_default_when_no_value()
|
|
||||||
{
|
|
||||||
const string key = "MY_KEY";
|
|
||||||
const string value = "MY_VALUE";
|
|
||||||
|
|
||||||
//Act
|
|
||||||
var result = Mocker.Resolve<ConfigProvider>().GetValue(key, value);
|
|
||||||
|
|
||||||
//Assert
|
|
||||||
result.Should().Be(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void New_value_should_update_old_value_new_value()
|
|
||||||
{
|
|
||||||
const string key = "MY_KEY";
|
|
||||||
const string originalValue = "OLD_VALUE";
|
|
||||||
const string newValue = "NEW_VALUE";
|
|
||||||
|
|
||||||
Db.Insert(new Config { Key = key, Value = originalValue });
|
|
||||||
|
|
||||||
//Act
|
|
||||||
Mocker.Resolve<ConfigProvider>().SetValue(key, newValue);
|
|
||||||
var result = Mocker.Resolve<ConfigProvider>().GetValue(key, "");
|
|
||||||
|
|
||||||
//Assert
|
|
||||||
result.Should().Be(newValue);
|
|
||||||
Db.Fetch<Config>().Should().HaveCount(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void New_value_should_update_old_value_same_value()
|
|
||||||
{
|
|
||||||
const string key = "MY_KEY";
|
|
||||||
const string value = "OLD_VALUE";
|
|
||||||
|
|
||||||
//Act
|
|
||||||
Mocker.Resolve<ConfigProvider>().SetValue(key, value);
|
|
||||||
Mocker.Resolve<ConfigProvider>().SetValue(key, value);
|
|
||||||
var result = Mocker.Resolve<ConfigProvider>().GetValue(key, "");
|
|
||||||
|
|
||||||
//Assert
|
|
||||||
result.Should().Be(value);
|
|
||||||
Db.Fetch<Config>().Should().HaveCount(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void get_value_with_persist_should_store_default_value()
|
|
||||||
{
|
|
||||||
const string key = "MY_KEY";
|
|
||||||
string value = Guid.NewGuid().ToString();
|
|
||||||
|
|
||||||
//Act
|
|
||||||
Mocker.Resolve<ConfigProvider>().GetValue(key, value, persist: true).Should().Be(value);
|
|
||||||
Mocker.Resolve<ConfigProvider>().GetValue(key, string.Empty).Should().Be(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void get_value_with_out_persist_should_not_store_default_value()
|
|
||||||
{
|
|
||||||
const string key = "MY_KEY";
|
|
||||||
string value1 = Guid.NewGuid().ToString();
|
|
||||||
string value2 = Guid.NewGuid().ToString();
|
|
||||||
|
|
||||||
//Act
|
|
||||||
Mocker.Resolve<ConfigProvider>().GetValue(key, value1).Should().Be(value1);
|
|
||||||
Mocker.Resolve<ConfigProvider>().GetValue(key, value2).Should().Be(value2);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void uguid_should_only_be_set_once()
|
|
||||||
{
|
|
||||||
var guid1 = Mocker.Resolve<ConfigProvider>().UGuid;
|
|
||||||
var guid2 = Mocker.Resolve<ConfigProvider>().UGuid;
|
|
||||||
|
|
||||||
guid1.Should().Be(guid2);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void uguid_should_return_valid_result_on_first_call()
|
|
||||||
{
|
|
||||||
var guid = Mocker.Resolve<ConfigProvider>().UGuid;
|
|
||||||
guid.Should().NotBeEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void updating_a_vakye_should_update_its_value()
|
|
||||||
{
|
|
||||||
Mocker.Resolve<ConfigProvider>().SabHost = "Test";
|
|
||||||
Mocker.Resolve<ConfigProvider>().SabHost.Should().Be("Test");
|
|
||||||
|
|
||||||
Mocker.Resolve<ConfigProvider>().SabHost = "Test2";
|
|
||||||
Mocker.Resolve<ConfigProvider>().SabHost.Should().Be("Test2");
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
[Description("This test will use reflection to ensure each config property read/writes to a unique key")]
|
|
||||||
public void config_properties_should_write_and_read_using_same_key()
|
|
||||||
{
|
|
||||||
var configProvider = Mocker.Resolve<ConfigProvider>();
|
|
||||||
var allProperties = typeof(ConfigProvider).GetProperties().Where(p => p.GetSetMethod() != null);
|
|
||||||
|
|
||||||
|
|
||||||
//Act
|
|
||||||
foreach (var propertyInfo in allProperties)
|
|
||||||
{
|
|
||||||
object value = null;
|
|
||||||
|
|
||||||
if (propertyInfo.PropertyType == typeof(string))
|
|
||||||
{
|
|
||||||
value = new Guid().ToString();
|
|
||||||
}
|
|
||||||
else if (propertyInfo.PropertyType == typeof(int))
|
|
||||||
{
|
|
||||||
value = DateTime.Now.Millisecond;
|
|
||||||
}
|
|
||||||
else if (propertyInfo.PropertyType == typeof(bool))
|
|
||||||
{
|
|
||||||
value = true;
|
|
||||||
}
|
|
||||||
else if (propertyInfo.PropertyType.BaseType == typeof(Enum))
|
|
||||||
{
|
|
||||||
value = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
propertyInfo.GetSetMethod().Invoke(configProvider, new[] { value });
|
|
||||||
var returnValue = propertyInfo.GetGetMethod().Invoke(configProvider, null);
|
|
||||||
|
|
||||||
if (propertyInfo.PropertyType.BaseType == typeof(Enum))
|
|
||||||
{
|
|
||||||
returnValue = (int)returnValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
returnValue.Should().Be(value, propertyInfo.Name);
|
|
||||||
}
|
|
||||||
|
|
||||||
Db.Fetch<Config>().Should()
|
|
||||||
.HaveSameCount(allProperties, "two different properties are writing to the same key in db. Copy/Past fail.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -8,6 +8,7 @@ using FluentAssertions;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
using NzbDrone.Core.Providers;
|
using NzbDrone.Core.Providers;
|
||||||
|
@ -90,7 +91,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||||
Mocker.GetMock<MediaFileProvider>()
|
Mocker.GetMock<MediaFileProvider>()
|
||||||
.Setup(e => e.Delete(It.IsAny<int>()));
|
.Setup(e => e.Delete(It.IsAny<int>()));
|
||||||
|
|
||||||
Mocker.GetMock<ConfigProvider>()
|
Mocker.GetMock<ConfigService>()
|
||||||
.SetupGet(s => s.AutoIgnorePreviouslyDownloadedEpisodes)
|
.SetupGet(s => s.AutoIgnorePreviouslyDownloadedEpisodes)
|
||||||
.Returns(true);
|
.Returns(true);
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ using FluentAssertions;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
using NzbDrone.Core.Providers.DownloadClients;
|
using NzbDrone.Core.Providers.DownloadClients;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
@ -26,7 +27,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void Setup()
|
public void Setup()
|
||||||
{
|
{
|
||||||
Mocker.GetMock<ConfigProvider>().SetupGet(c => c.BlackholeDirectory).Returns(blackHoleFolder);
|
Mocker.GetMock<ConfigService>().SetupGet(c => c.BlackholeDirectory).Returns(blackHoleFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ using FluentAssertions;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Model.Nzbget;
|
using NzbDrone.Core.Model.Nzbget;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
using NzbDrone.Core.Providers.DownloadClients;
|
using NzbDrone.Core.Providers.DownloadClients;
|
||||||
|
@ -19,7 +20,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.NzbgetProviderTes
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void Setup()
|
public void Setup()
|
||||||
{
|
{
|
||||||
var fakeConfig = Mocker.GetMock<ConfigProvider>();
|
var fakeConfig = Mocker.GetMock<ConfigService>();
|
||||||
fakeConfig.SetupGet(c => c.NzbgetHost).Returns("192.168.5.55");
|
fakeConfig.SetupGet(c => c.NzbgetHost).Returns("192.168.5.55");
|
||||||
fakeConfig.SetupGet(c => c.NzbgetPort).Returns(6789);
|
fakeConfig.SetupGet(c => c.NzbgetPort).Returns(6789);
|
||||||
fakeConfig.SetupGet(c => c.NzbgetUsername).Returns("nzbget");
|
fakeConfig.SetupGet(c => c.NzbgetUsername).Returns("nzbget");
|
||||||
|
|
|
@ -7,6 +7,7 @@ using FluentAssertions;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Model.Nzbget;
|
using NzbDrone.Core.Model.Nzbget;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
using NzbDrone.Core.Providers.DownloadClients;
|
using NzbDrone.Core.Providers.DownloadClients;
|
||||||
|
@ -19,7 +20,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.NzbgetProviderTes
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void Setup()
|
public void Setup()
|
||||||
{
|
{
|
||||||
var fakeConfig = Mocker.GetMock<ConfigProvider>();
|
var fakeConfig = Mocker.GetMock<ConfigService>();
|
||||||
fakeConfig.SetupGet(c => c.NzbgetHost).Returns("192.168.5.55");
|
fakeConfig.SetupGet(c => c.NzbgetHost).Returns("192.168.5.55");
|
||||||
fakeConfig.SetupGet(c => c.NzbgetPort).Returns(6789);
|
fakeConfig.SetupGet(c => c.NzbgetPort).Returns(6789);
|
||||||
fakeConfig.SetupGet(c => c.NzbgetUsername).Returns("nzbget");
|
fakeConfig.SetupGet(c => c.NzbgetUsername).Returns("nzbget");
|
||||||
|
|
|
@ -8,6 +8,7 @@ using FluentAssertions;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
using NzbDrone.Core.Providers.DownloadClients;
|
using NzbDrone.Core.Providers.DownloadClients;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
@ -29,8 +30,8 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests
|
||||||
{
|
{
|
||||||
nzbPath = pneumaticFolder + title + ".nzb";
|
nzbPath = pneumaticFolder + title + ".nzb";
|
||||||
|
|
||||||
Mocker.GetMock<ConfigProvider>().SetupGet(c => c.PneumaticDirectory).Returns(pneumaticFolder);
|
Mocker.GetMock<ConfigService>().SetupGet(c => c.PneumaticDirectory).Returns(pneumaticFolder);
|
||||||
Mocker.GetMock<ConfigProvider>().SetupGet(c => c.DownloadClientTvDirectory).Returns(sabDrop);
|
Mocker.GetMock<ConfigService>().SetupGet(c => c.DownloadClientTvDirectory).Returns(sabDrop);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WithExistingFile()
|
private void WithExistingFile()
|
||||||
|
|
|
@ -8,6 +8,7 @@ using FluentAssertions;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
using NzbDrone.Core.Model.Sabnzbd;
|
using NzbDrone.Core.Model.Sabnzbd;
|
||||||
|
@ -35,7 +36,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests
|
||||||
string password = "pass";
|
string password = "pass";
|
||||||
string cat = "tv";
|
string cat = "tv";
|
||||||
|
|
||||||
var fakeConfig = Mocker.GetMock<ConfigProvider>();
|
var fakeConfig = Mocker.GetMock<ConfigService>();
|
||||||
fakeConfig.SetupGet(c => c.SabHost).Returns(sabHost);
|
fakeConfig.SetupGet(c => c.SabHost).Returns(sabHost);
|
||||||
fakeConfig.SetupGet(c => c.SabPort).Returns(sabPort);
|
fakeConfig.SetupGet(c => c.SabPort).Returns(sabPort);
|
||||||
fakeConfig.SetupGet(c => c.SabApiKey).Returns(apikey);
|
fakeConfig.SetupGet(c => c.SabApiKey).Returns(apikey);
|
||||||
|
|
|
@ -10,6 +10,7 @@ using FluentAssertions;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
using NzbDrone.Core.Model.Sabnzbd;
|
using NzbDrone.Core.Model.Sabnzbd;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
|
@ -31,7 +32,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void Setup()
|
public void Setup()
|
||||||
{
|
{
|
||||||
var fakeConfig = Mocker.GetMock<ConfigProvider>();
|
var fakeConfig = Mocker.GetMock<ConfigService>();
|
||||||
|
|
||||||
fakeConfig.SetupGet(c => c.SabHost).Returns("192.168.5.55");
|
fakeConfig.SetupGet(c => c.SabHost).Returns("192.168.5.55");
|
||||||
fakeConfig.SetupGet(c => c.SabPort).Returns(2222);
|
fakeConfig.SetupGet(c => c.SabPort).Returns(2222);
|
||||||
|
@ -209,11 +210,11 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests
|
||||||
[Test]
|
[Test]
|
||||||
public void downloadNzb_should_use_sabRecentTvPriority_when_recentEpisode_is_true()
|
public void downloadNzb_should_use_sabRecentTvPriority_when_recentEpisode_is_true()
|
||||||
{
|
{
|
||||||
Mocker.GetMock<ConfigProvider>()
|
Mocker.GetMock<ConfigService>()
|
||||||
.SetupGet(s => s.SabRecentTvPriority)
|
.SetupGet(s => s.SabRecentTvPriority)
|
||||||
.Returns(SabPriorityType.High);
|
.Returns(SabPriorityType.High);
|
||||||
|
|
||||||
Mocker.GetMock<ConfigProvider>()
|
Mocker.GetMock<ConfigService>()
|
||||||
.SetupGet(s => s.SabBacklogTvPriority)
|
.SetupGet(s => s.SabBacklogTvPriority)
|
||||||
.Returns(SabPriorityType.Low);
|
.Returns(SabPriorityType.Low);
|
||||||
|
|
||||||
|
@ -231,11 +232,11 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests
|
||||||
[Test]
|
[Test]
|
||||||
public void downloadNzb_should_use_sabBackogTvPriority_when_recentEpisode_is_false()
|
public void downloadNzb_should_use_sabBackogTvPriority_when_recentEpisode_is_false()
|
||||||
{
|
{
|
||||||
Mocker.GetMock<ConfigProvider>()
|
Mocker.GetMock<ConfigService>()
|
||||||
.SetupGet(s => s.SabRecentTvPriority)
|
.SetupGet(s => s.SabRecentTvPriority)
|
||||||
.Returns(SabPriorityType.High);
|
.Returns(SabPriorityType.High);
|
||||||
|
|
||||||
Mocker.GetMock<ConfigProvider>()
|
Mocker.GetMock<ConfigService>()
|
||||||
.SetupGet(s => s.SabBacklogTvPriority)
|
.SetupGet(s => s.SabBacklogTvPriority)
|
||||||
.Returns(SabPriorityType.Low);
|
.Returns(SabPriorityType.Low);
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ using FizzWare.NBuilder;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.History;
|
using NzbDrone.Core.History;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
|
@ -33,7 +34,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadProviderTests
|
||||||
|
|
||||||
private void SetDownloadClient(DownloadClientType clientType)
|
private void SetDownloadClient(DownloadClientType clientType)
|
||||||
{
|
{
|
||||||
Mocker.GetMock<ConfigProvider>()
|
Mocker.GetMock<ConfigService>()
|
||||||
.Setup(c => c.DownloadClient)
|
.Setup(c => c.DownloadClient)
|
||||||
.Returns(clientType);
|
.Returns(clientType);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ using FluentAssertions;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
using NzbDrone.Core.Providers;
|
using NzbDrone.Core.Providers;
|
||||||
|
@ -133,7 +134,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
|
|
||||||
Mocker.GetMock<ConfigProvider>().Setup(e => e.SortingSeasonFolderFormat).Returns(seasonFolderFormat);
|
Mocker.GetMock<ConfigService>().Setup(e => e.SortingSeasonFolderFormat).Returns(seasonFolderFormat);
|
||||||
|
|
||||||
//Act
|
//Act
|
||||||
var result = Mocker.Resolve<MediaFileProvider>().CalculateFilePath(fakeSeries, 1, filename, ".mkv");
|
var result = Mocker.Resolve<MediaFileProvider>().CalculateFilePath(fakeSeries, 1, filename, ".mkv");
|
||||||
|
|
|
@ -8,6 +8,7 @@ using FluentAssertions;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
using NzbDrone.Core.Model.Notification;
|
using NzbDrone.Core.Model.Notification;
|
||||||
using NzbDrone.Core.Providers;
|
using NzbDrone.Core.Providers;
|
||||||
|
@ -93,7 +94,7 @@ namespace NzbDrone.Core.Test.ProviderTests.Metadata
|
||||||
|
|
||||||
private void WithUseBanners()
|
private void WithUseBanners()
|
||||||
{
|
{
|
||||||
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.MetadataUseBanners).Returns(true);
|
Mocker.GetMock<ConfigService>().SetupGet(s => s.MetadataUseBanners).Returns(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WithSingleEpisodeFile()
|
private void WithSingleEpisodeFile()
|
||||||
|
|
|
@ -7,6 +7,7 @@ using FluentAssertions;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
using NzbDrone.Core.Model.Notification;
|
using NzbDrone.Core.Model.Notification;
|
||||||
using NzbDrone.Core.Providers;
|
using NzbDrone.Core.Providers;
|
||||||
|
@ -75,7 +76,7 @@ namespace NzbDrone.Core.Test.ProviderTests.Metadata
|
||||||
|
|
||||||
private void WithUseBanners()
|
private void WithUseBanners()
|
||||||
{
|
{
|
||||||
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.MetadataUseBanners).Returns(true);
|
Mocker.GetMock<ConfigService>().SetupGet(s => s.MetadataUseBanners).Returns(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WithSpecials()
|
private void WithSpecials()
|
||||||
|
|
|
@ -10,6 +10,7 @@ using FluentAssertions;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Model.Xbmc;
|
using NzbDrone.Core.Model.Xbmc;
|
||||||
using NzbDrone.Core.Providers;
|
using NzbDrone.Core.Providers;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
|
@ -26,22 +27,22 @@ namespace NzbDrone.Core.Test.ProviderTests
|
||||||
{
|
{
|
||||||
private void WithSingleClient()
|
private void WithSingleClient()
|
||||||
{
|
{
|
||||||
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.PlexClientHosts)
|
Mocker.GetMock<ConfigService>().SetupGet(s => s.PlexClientHosts)
|
||||||
.Returns("localhost:3000");
|
.Returns("localhost:3000");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WithMultipleClients()
|
private void WithMultipleClients()
|
||||||
{
|
{
|
||||||
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.PlexClientHosts)
|
Mocker.GetMock<ConfigService>().SetupGet(s => s.PlexClientHosts)
|
||||||
.Returns("localhost:3000, 192.168.0.10:3000");
|
.Returns("localhost:3000, 192.168.0.10:3000");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void WithClientCredentials()
|
public void WithClientCredentials()
|
||||||
{
|
{
|
||||||
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.PlexUsername)
|
Mocker.GetMock<ConfigService>().SetupGet(s => s.PlexUsername)
|
||||||
.Returns("plex");
|
.Returns("plex");
|
||||||
|
|
||||||
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.PlexPassword)
|
Mocker.GetMock<ConfigService>().SetupGet(s => s.PlexPassword)
|
||||||
.Returns("plex");
|
.Returns("plex");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ using FluentAssertions;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
using NzbDrone.Core.Providers;
|
using NzbDrone.Core.Providers;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
|
@ -49,7 +50,7 @@ namespace NzbDrone.Core.Test.ProviderTests.RecycleBinProviderTests
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void Setup()
|
public void Setup()
|
||||||
{
|
{
|
||||||
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.RecycleBin).Returns(RecycleBin);
|
Mocker.GetMock<ConfigService>().SetupGet(s => s.RecycleBin).Returns(RecycleBin);
|
||||||
|
|
||||||
Mocker.GetMock<DiskProvider>().Setup(s => s.GetDirectories(RecycleBin))
|
Mocker.GetMock<DiskProvider>().Setup(s => s.GetDirectories(RecycleBin))
|
||||||
.Returns(new [] { @"C:\Test\RecycleBin\Folder1", @"C:\Test\RecycleBin\Folder2", @"C:\Test\RecycleBin\Folder3" });
|
.Returns(new [] { @"C:\Test\RecycleBin\Folder1", @"C:\Test\RecycleBin\Folder2", @"C:\Test\RecycleBin\Folder3" });
|
||||||
|
@ -61,7 +62,7 @@ namespace NzbDrone.Core.Test.ProviderTests.RecycleBinProviderTests
|
||||||
[Test]
|
[Test]
|
||||||
public void should_return_if_recycleBin_not_configured()
|
public void should_return_if_recycleBin_not_configured()
|
||||||
{
|
{
|
||||||
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.RecycleBin).Returns(String.Empty);
|
Mocker.GetMock<ConfigService>().SetupGet(s => s.RecycleBin).Returns(String.Empty);
|
||||||
|
|
||||||
Mocker.Resolve<RecycleBinProvider>().Cleanup();
|
Mocker.Resolve<RecycleBinProvider>().Cleanup();
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ using FluentAssertions;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
using NzbDrone.Core.Providers;
|
using NzbDrone.Core.Providers;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
|
@ -28,12 +29,12 @@ namespace NzbDrone.Core.Test.ProviderTests.RecycleBinProviderTests
|
||||||
{
|
{
|
||||||
private void WithRecycleBin()
|
private void WithRecycleBin()
|
||||||
{
|
{
|
||||||
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.RecycleBin).Returns(@"C:\Test\Recycle Bin");
|
Mocker.GetMock<ConfigService>().SetupGet(s => s.RecycleBin).Returns(@"C:\Test\Recycle Bin");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WithoutRecycleBin()
|
private void WithoutRecycleBin()
|
||||||
{
|
{
|
||||||
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.RecycleBin).Returns(String.Empty);
|
Mocker.GetMock<ConfigService>().SetupGet(s => s.RecycleBin).Returns(String.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
|
|
@ -10,6 +10,7 @@ using FluentAssertions;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
using NzbDrone.Core.Providers;
|
using NzbDrone.Core.Providers;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
|
@ -28,12 +29,12 @@ namespace NzbDrone.Core.Test.ProviderTests.RecycleBinProviderTests
|
||||||
{
|
{
|
||||||
private void WithRecycleBin()
|
private void WithRecycleBin()
|
||||||
{
|
{
|
||||||
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.RecycleBin).Returns(@"C:\Test\Recycle Bin");
|
Mocker.GetMock<ConfigService>().SetupGet(s => s.RecycleBin).Returns(@"C:\Test\Recycle Bin");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WithoutRecycleBin()
|
private void WithoutRecycleBin()
|
||||||
{
|
{
|
||||||
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.RecycleBin).Returns(String.Empty);
|
Mocker.GetMock<ConfigService>().SetupGet(s => s.RecycleBin).Returns(String.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
|
|
@ -10,6 +10,7 @@ using FluentAssertions;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
using NzbDrone.Core.Providers;
|
using NzbDrone.Core.Providers;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
|
@ -31,7 +32,7 @@ namespace NzbDrone.Core.Test.ProviderTests.RecycleBinProviderTests
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void Setup()
|
public void Setup()
|
||||||
{
|
{
|
||||||
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.RecycleBin).Returns(RecycleBin);
|
Mocker.GetMock<ConfigService>().SetupGet(s => s.RecycleBin).Returns(RecycleBin);
|
||||||
|
|
||||||
Mocker.GetMock<DiskProvider>().Setup(s => s.GetDirectories(RecycleBin))
|
Mocker.GetMock<DiskProvider>().Setup(s => s.GetDirectories(RecycleBin))
|
||||||
.Returns(new [] { @"C:\Test\RecycleBin\Folder1", @"C:\Test\RecycleBin\Folder2", @"C:\Test\RecycleBin\Folder3" });
|
.Returns(new [] { @"C:\Test\RecycleBin\Folder1", @"C:\Test\RecycleBin\Folder2", @"C:\Test\RecycleBin\Folder3" });
|
||||||
|
@ -43,7 +44,7 @@ namespace NzbDrone.Core.Test.ProviderTests.RecycleBinProviderTests
|
||||||
[Test]
|
[Test]
|
||||||
public void should_return_if_recycleBin_not_configured()
|
public void should_return_if_recycleBin_not_configured()
|
||||||
{
|
{
|
||||||
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.RecycleBin).Returns(String.Empty);
|
Mocker.GetMock<ConfigService>().SetupGet(s => s.RecycleBin).Returns(String.Empty);
|
||||||
|
|
||||||
Mocker.Resolve<RecycleBinProvider>().Empty();
|
Mocker.Resolve<RecycleBinProvider>().Empty();
|
||||||
|
|
||||||
|
|
|
@ -6,10 +6,10 @@ using FluentAssertions;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
using NzbDrone.Core.Providers;
|
using NzbDrone.Core.Providers;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
using NzbDrone.Core.Repository;
|
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
using NzbDrone.Test.Common;
|
using NzbDrone.Test.Common;
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void Setup()
|
public void Setup()
|
||||||
{
|
{
|
||||||
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.ServiceRootUrl)
|
Mocker.GetMock<ConfigService>().SetupGet(s => s.ServiceRootUrl)
|
||||||
.Returns("http://services.nzbdrone.com");
|
.Returns("http://services.nzbdrone.com");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ using FluentAssertions;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Providers;
|
using NzbDrone.Core.Providers;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
using NzbDrone.Core.Repository;
|
using NzbDrone.Core.Repository;
|
||||||
|
@ -23,7 +24,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void Setup()
|
public void Setup()
|
||||||
{
|
{
|
||||||
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.ServiceRootUrl)
|
Mocker.GetMock<ConfigService>().SetupGet(s => s.ServiceRootUrl)
|
||||||
.Returns("http://services.nzbdrone.com");
|
.Returns("http://services.nzbdrone.com");
|
||||||
|
|
||||||
WithRealDb();
|
WithRealDb();
|
||||||
|
|
|
@ -4,6 +4,7 @@ using FluentAssertions;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Providers;
|
using NzbDrone.Core.Providers;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
@ -22,7 +23,7 @@ namespace NzbDrone.Core.Test.ProviderTests.UpdateProviderTests
|
||||||
{
|
{
|
||||||
WithStrictMocker();
|
WithStrictMocker();
|
||||||
|
|
||||||
Mocker.GetMock<ConfigProvider>().SetupGet(c => c.UpdateUrl).Returns("http://update.nzbdrone.com/_test/");
|
Mocker.GetMock<ConfigService>().SetupGet(c => c.UpdateUrl).Returns("http://update.nzbdrone.com/_test/");
|
||||||
Mocker.Resolve<HttpProvider>();
|
Mocker.Resolve<HttpProvider>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ using FluentAssertions;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
using NzbDrone.Core.Model.Xbmc;
|
using NzbDrone.Core.Model.Xbmc;
|
||||||
using NzbDrone.Core.Providers;
|
using NzbDrone.Core.Providers;
|
||||||
|
@ -296,7 +297,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
||||||
var header = "NzbDrone Test";
|
var header = "NzbDrone Test";
|
||||||
var message = "Test Message!";
|
var message = "Test Message!";
|
||||||
|
|
||||||
var fakeConfig = Mocker.GetMock<ConfigProvider>();
|
var fakeConfig = Mocker.GetMock<ConfigService>();
|
||||||
fakeConfig.SetupGet(s => s.XbmcHosts).Returns("localhost:8080");
|
fakeConfig.SetupGet(s => s.XbmcHosts).Returns("localhost:8080");
|
||||||
|
|
||||||
//var fakeUdpProvider = Mocker.GetMock<EventClient>();
|
//var fakeUdpProvider = Mocker.GetMock<EventClient>();
|
||||||
|
@ -440,7 +441,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
||||||
//Setup
|
//Setup
|
||||||
WithStrictMocker();
|
WithStrictMocker();
|
||||||
|
|
||||||
var fakeConfig = Mocker.GetMock<ConfigProvider>();
|
var fakeConfig = Mocker.GetMock<ConfigService>();
|
||||||
fakeConfig.SetupGet(s => s.XbmcHosts).Returns("localhost:8080");
|
fakeConfig.SetupGet(s => s.XbmcHosts).Returns("localhost:8080");
|
||||||
|
|
||||||
var fakeEventClient = Mocker.GetMock<EventClientProvider>();
|
var fakeEventClient = Mocker.GetMock<EventClientProvider>();
|
||||||
|
|
|
@ -7,6 +7,7 @@ using FizzWare.NBuilder;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
using NzbDrone.Core.Providers;
|
using NzbDrone.Core.Providers;
|
||||||
|
@ -814,7 +815,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
||||||
WithRealDb();
|
WithRealDb();
|
||||||
Mocker.Resolve<TvDbProvider>();
|
Mocker.Resolve<TvDbProvider>();
|
||||||
|
|
||||||
Mocker.GetMock<ConfigProvider>()
|
Mocker.GetMock<ConfigService>()
|
||||||
.Setup(e => e.DefaultQualityProfile).Returns(1);
|
.Setup(e => e.DefaultQualityProfile).Returns(1);
|
||||||
|
|
||||||
Db.Insert(Builder<QualityProfile>.CreateNew().Build());
|
Db.Insert(Builder<QualityProfile>.CreateNew().Build());
|
||||||
|
|
Binary file not shown.
|
@ -0,0 +1,12 @@
|
||||||
|
using System.Linq;
|
||||||
|
using NzbDrone.Core.Datastore;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.Configuration
|
||||||
|
{
|
||||||
|
public class Config : ModelBase
|
||||||
|
{
|
||||||
|
public string Key { get; set; }
|
||||||
|
|
||||||
|
public string Value { get; set; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
using System.Linq;
|
||||||
|
using NzbDrone.Core.Datastore;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.Configuration
|
||||||
|
{
|
||||||
|
public interface IConfigRepository : IBasicRepository<Config>
|
||||||
|
{
|
||||||
|
Config Get(string key);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ConfigRepository : BasicRepository<Config>, IConfigRepository
|
||||||
|
{
|
||||||
|
public ConfigRepository(IObjectDatabase objectDatabase)
|
||||||
|
: base(objectDatabase)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Config Get(string key)
|
||||||
|
{
|
||||||
|
return Queryable.SingleOrDefault(c => c.Key == key);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,31 +5,28 @@ using NLog;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
using NzbDrone.Core.Model.Nzbget;
|
using NzbDrone.Core.Model.Nzbget;
|
||||||
using NzbDrone.Core.Model.Sabnzbd;
|
using NzbDrone.Core.Model.Sabnzbd;
|
||||||
using NzbDrone.Core.Repository;
|
using NzbDrone.Core.Providers;
|
||||||
using PetaPoco;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Providers.Core
|
namespace NzbDrone.Core.Configuration
|
||||||
{
|
{
|
||||||
public class ConfigProvider
|
public class ConfigService : IConfigService
|
||||||
{
|
{
|
||||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
private readonly IConfigRepository _repository;
|
||||||
|
private readonly Logger _logger;
|
||||||
|
private static Dictionary<string, string> _cache;
|
||||||
|
|
||||||
private static Dictionary<string, string> cache = new Dictionary<string, string>();
|
|
||||||
|
|
||||||
private readonly IDatabase _database;
|
public ConfigService(IConfigRepository repository, Logger logger)
|
||||||
|
|
||||||
public ConfigProvider(IDatabase database)
|
|
||||||
{
|
{
|
||||||
_database = database;
|
_repository = repository;
|
||||||
|
_logger = logger;
|
||||||
|
_cache = new Dictionary<string, string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConfigProvider()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<Config> All()
|
public IEnumerable<Config> All()
|
||||||
{
|
{
|
||||||
return _database.Fetch<Config>();
|
return _repository.All();
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual String NzbsOrgUId
|
public virtual String NzbsOrgUId
|
||||||
|
@ -619,14 +616,15 @@ namespace NzbDrone.Core.Providers.Core
|
||||||
|
|
||||||
string dbValue;
|
string dbValue;
|
||||||
|
|
||||||
if (cache.TryGetValue(key, out dbValue) && dbValue != null && !String.IsNullOrEmpty(dbValue))
|
if (_cache.TryGetValue(key, out dbValue) && dbValue != null && !String.IsNullOrEmpty(dbValue))
|
||||||
return dbValue;
|
return dbValue;
|
||||||
|
|
||||||
logger.Trace("Unable to find config key '{0}' defaultValue:'{1}'", key, defaultValue);
|
_logger.Trace("Unable to find config key '{0}' defaultValue:'{1}'", key, defaultValue);
|
||||||
|
|
||||||
if (persist)
|
if (persist)
|
||||||
|
{
|
||||||
SetValue(key, defaultValue.ToString());
|
SetValue(key, defaultValue.ToString());
|
||||||
|
}
|
||||||
return defaultValue.ToString();
|
return defaultValue.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -647,18 +645,18 @@ namespace NzbDrone.Core.Providers.Core
|
||||||
if (value == null)
|
if (value == null)
|
||||||
throw new ArgumentNullException("key");
|
throw new ArgumentNullException("key");
|
||||||
|
|
||||||
logger.Trace("Writing Setting to file. Key:'{0}' Value:'{1}'", key, value);
|
_logger.Trace("Writing Setting to file. Key:'{0}' Value:'{1}'", key, value);
|
||||||
|
|
||||||
var dbValue = _database.SingleOrDefault<Config>("WHERE [KEY]=@0", key);
|
var dbValue = _repository.Get(key);
|
||||||
|
|
||||||
if (dbValue == null)
|
if (dbValue == null)
|
||||||
{
|
{
|
||||||
_database.Insert(new Config { Key = key, Value = value });
|
_repository.Insert(new Config { Key = key, Value = value });
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dbValue.Value = value;
|
dbValue.Value = value;
|
||||||
_database.Update(dbValue);
|
_repository.Update(dbValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
ClearCache();
|
ClearCache();
|
||||||
|
@ -666,20 +664,20 @@ namespace NzbDrone.Core.Providers.Core
|
||||||
|
|
||||||
private void EnsureCache()
|
private void EnsureCache()
|
||||||
{
|
{
|
||||||
lock (cache)
|
lock (_cache)
|
||||||
{
|
{
|
||||||
if (!cache.Any())
|
if (!_cache.Any())
|
||||||
{
|
{
|
||||||
cache = _database.Fetch<Config>().ToDictionary(c => c.Key, c => c.Value);
|
_cache = All().ToDictionary(c => c.Key, c => c.Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ClearCache()
|
public static void ClearCache()
|
||||||
{
|
{
|
||||||
lock (cache)
|
lock (_cache)
|
||||||
{
|
{
|
||||||
cache = new Dictionary<string, string>();
|
_cache = new Dictionary<string, string>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,102 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using NzbDrone.Core.Model;
|
||||||
|
using NzbDrone.Core.Model.Nzbget;
|
||||||
|
using NzbDrone.Core.Model.Sabnzbd;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.Configuration
|
||||||
|
{
|
||||||
|
public interface IConfigService
|
||||||
|
{
|
||||||
|
IEnumerable<Config> All();
|
||||||
|
String NzbsOrgUId { get; set; }
|
||||||
|
String NzbsOrgHash { get; set; }
|
||||||
|
String NzbsrusUId { get; set; }
|
||||||
|
String NzbsrusHash { get; set; }
|
||||||
|
String FileSharingTalkUid { get; set; }
|
||||||
|
String FileSharingTalkSecret { get; set; }
|
||||||
|
String SabHost { get; set; }
|
||||||
|
int SabPort { get; set; }
|
||||||
|
String SabApiKey { get; set; }
|
||||||
|
String SabUsername { get; set; }
|
||||||
|
String SabPassword { get; set; }
|
||||||
|
String SabTvCategory { get; set; }
|
||||||
|
SabPriorityType SabBacklogTvPriority { get; set; }
|
||||||
|
SabPriorityType SabRecentTvPriority { get; set; }
|
||||||
|
String DownloadClientTvDirectory { get; set; }
|
||||||
|
bool SortingIncludeSeriesName { get; set; }
|
||||||
|
bool SortingIncludeEpisodeTitle { get; set; }
|
||||||
|
bool SortingReplaceSpaces { get; set; }
|
||||||
|
bool SortingAppendQuality { get; set; }
|
||||||
|
bool UseSeasonFolder { get; set; }
|
||||||
|
string SortingSeasonFolderFormat { get; set; }
|
||||||
|
int SortingSeparatorStyle { get; set; }
|
||||||
|
int SortingNumberStyle { get; set; }
|
||||||
|
int SortingMultiEpisodeStyle { get; set; }
|
||||||
|
bool SortingUseSceneName { get; set; }
|
||||||
|
int DefaultQualityProfile { get; set; }
|
||||||
|
Boolean XbmcNotifyOnGrab { get; set; }
|
||||||
|
Boolean XbmcNotifyOnDownload { get; set; }
|
||||||
|
Boolean XbmcUpdateLibrary { get; set; }
|
||||||
|
Boolean XbmcCleanLibrary { get; set; }
|
||||||
|
Boolean XbmcUpdateWhenPlaying { get; set; }
|
||||||
|
string XbmcHosts { get; set; }
|
||||||
|
string XbmcUsername { get; set; }
|
||||||
|
string XbmcPassword { get; set; }
|
||||||
|
string UpdateUrl { get; set; }
|
||||||
|
Boolean SmtpNotifyOnGrab { get; set; }
|
||||||
|
Boolean SmtpNotifyOnDownload { get; set; }
|
||||||
|
string SmtpServer { get; set; }
|
||||||
|
int SmtpPort { get; set; }
|
||||||
|
Boolean SmtpUseSsl { get; set; }
|
||||||
|
string SmtpUsername { get; set; }
|
||||||
|
string SmtpPassword { get; set; }
|
||||||
|
string SmtpFromAddress { get; set; }
|
||||||
|
string SmtpToAddresses { get; set; }
|
||||||
|
Boolean TwitterNotifyOnGrab { get; set; }
|
||||||
|
Boolean TwitterNotifyOnDownload { get; set; }
|
||||||
|
string TwitterAccessToken { get; set; }
|
||||||
|
string TwitterAccessTokenSecret { get; set; }
|
||||||
|
Boolean GrowlNotifyOnGrab { get; set; }
|
||||||
|
Boolean GrowlNotifyOnDownload { get; set; }
|
||||||
|
string GrowlHost { get; set; }
|
||||||
|
string GrowlPassword { get; set; }
|
||||||
|
Boolean ProwlNotifyOnGrab { get; set; }
|
||||||
|
Boolean ProwlNotifyOnDownload { get; set; }
|
||||||
|
string ProwlApiKeys { get; set; }
|
||||||
|
int ProwlPriority { get; set; }
|
||||||
|
bool EnableBacklogSearching { get; set; }
|
||||||
|
bool AutoIgnorePreviouslyDownloadedEpisodes { get; set; }
|
||||||
|
int Retention { get; set; }
|
||||||
|
Guid UGuid { get; }
|
||||||
|
DownloadClientType DownloadClient { get; set; }
|
||||||
|
string BlackholeDirectory { get; set; }
|
||||||
|
string ServiceRootUrl { get; }
|
||||||
|
Boolean PlexNotifyOnGrab { get; set; }
|
||||||
|
Boolean PlexNotifyOnDownload { get; set; }
|
||||||
|
Boolean PlexUpdateLibrary { get; set; }
|
||||||
|
string PlexServerHost { get; set; }
|
||||||
|
string PlexClientHosts { get; set; }
|
||||||
|
string PlexUsername { get; set; }
|
||||||
|
string PlexPassword { get; set; }
|
||||||
|
Boolean MetadataUseBanners { get; set; }
|
||||||
|
string AllowedReleaseGroups { get; set; }
|
||||||
|
string PneumaticDirectory { get; set; }
|
||||||
|
string RecycleBin { get; set; }
|
||||||
|
int RssSyncInterval { get; set; }
|
||||||
|
string OmgwtfnzbsUsername { get; set; }
|
||||||
|
string OmgwtfnzbsApiKey { get; set; }
|
||||||
|
Boolean IgnoreArticlesWhenSortingSeries { get; set; }
|
||||||
|
Boolean DownloadClientUseSceneName { get; set; }
|
||||||
|
String NzbgetUsername { get; set; }
|
||||||
|
String NzbgetPassword { get; set; }
|
||||||
|
String NzbgetHost { get; set; }
|
||||||
|
Int32 NzbgetPort { get; set; }
|
||||||
|
String NzbgetTvCategory { get; set; }
|
||||||
|
Int32 NzbgetPriority { get; set; }
|
||||||
|
PriorityType NzbgetBacklogTvPriority { get; set; }
|
||||||
|
PriorityType NzbgetRecentTvPriority { get; set; }
|
||||||
|
string GetValue(string key, object defaultValue, bool persist = false);
|
||||||
|
void SetValue(string key, string value);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
|
|
||||||
|
@ -8,12 +9,12 @@ namespace NzbDrone.Core.DecisionEngine
|
||||||
{
|
{
|
||||||
public class AllowedReleaseGroupSpecification
|
public class AllowedReleaseGroupSpecification
|
||||||
{
|
{
|
||||||
private readonly ConfigProvider _configProvider;
|
private readonly IConfigService _configService;
|
||||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
public AllowedReleaseGroupSpecification(ConfigProvider configProvider)
|
public AllowedReleaseGroupSpecification(IConfigService configService)
|
||||||
{
|
{
|
||||||
_configProvider = configProvider;
|
_configService = configService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AllowedReleaseGroupSpecification()
|
public AllowedReleaseGroupSpecification()
|
||||||
|
@ -25,7 +26,7 @@ namespace NzbDrone.Core.DecisionEngine
|
||||||
{
|
{
|
||||||
logger.Trace("Beginning release group check for: {0}", subject);
|
logger.Trace("Beginning release group check for: {0}", subject);
|
||||||
|
|
||||||
var allowed = _configProvider.AllowedReleaseGroups;
|
var allowed = _configService.AllowedReleaseGroups;
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(allowed))
|
if (string.IsNullOrWhiteSpace(allowed))
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
|
|
||||||
|
@ -7,12 +8,12 @@ namespace NzbDrone.Core.DecisionEngine
|
||||||
{
|
{
|
||||||
public class LanguageSpecification
|
public class LanguageSpecification
|
||||||
{
|
{
|
||||||
private readonly ConfigProvider _configProvider;
|
private readonly IConfigService _configService;
|
||||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
public LanguageSpecification(ConfigProvider configProvider)
|
public LanguageSpecification(IConfigService configService)
|
||||||
{
|
{
|
||||||
_configProvider = configProvider;
|
_configService = configService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LanguageSpecification()
|
public LanguageSpecification()
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
|
|
||||||
|
@ -7,12 +8,12 @@ namespace NzbDrone.Core.DecisionEngine
|
||||||
{
|
{
|
||||||
public class RetentionSpecification
|
public class RetentionSpecification
|
||||||
{
|
{
|
||||||
private readonly ConfigProvider _configProvider;
|
private readonly IConfigService _configService;
|
||||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
public RetentionSpecification(ConfigProvider configProvider)
|
public RetentionSpecification(IConfigService configService)
|
||||||
{
|
{
|
||||||
_configProvider = configProvider;
|
_configService = configService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RetentionSpecification()
|
public RetentionSpecification()
|
||||||
|
@ -23,7 +24,7 @@ namespace NzbDrone.Core.DecisionEngine
|
||||||
public virtual bool IsSatisfiedBy(EpisodeParseResult subject)
|
public virtual bool IsSatisfiedBy(EpisodeParseResult subject)
|
||||||
{
|
{
|
||||||
logger.Trace("Checking if report meets retention requirements. {0}", subject.Age);
|
logger.Trace("Checking if report meets retention requirements. {0}", subject.Age);
|
||||||
if (_configProvider.Retention > 0 && subject.Age > _configProvider.Retention)
|
if (_configService.Retention > 0 && subject.Age > _configService.Retention)
|
||||||
{
|
{
|
||||||
logger.Trace("Report age: {0} rejected by user's retention limit", subject.Age);
|
logger.Trace("Report age: {0} rejected by user's retention limit", subject.Age);
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -3,6 +3,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ServiceModel.Syndication;
|
using System.ServiceModel.Syndication;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
|
|
||||||
|
@ -10,8 +11,8 @@ namespace NzbDrone.Core.Indexers
|
||||||
{
|
{
|
||||||
public class FileSharingTalk : IndexerBase
|
public class FileSharingTalk : IndexerBase
|
||||||
{
|
{
|
||||||
public FileSharingTalk(HttpProvider httpProvider, ConfigProvider configProvider)
|
public FileSharingTalk(HttpProvider httpProvider, IConfigService configService)
|
||||||
: base(httpProvider, configProvider)
|
: base(httpProvider, configService)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +23,7 @@ namespace NzbDrone.Core.Indexers
|
||||||
return new[]
|
return new[]
|
||||||
{
|
{
|
||||||
string.Format("http://filesharingtalk.com/ng_rss.php?uid={0}&ps={1}&category=tv&subcategory=x264sd,x264720,xvid,webdl720,x2641080",
|
string.Format("http://filesharingtalk.com/ng_rss.php?uid={0}&ps={1}&category=tv&subcategory=x264sd,x264720,xvid,webdl720,x2641080",
|
||||||
_configProvider.FileSharingTalkUid, _configProvider.FileSharingTalkSecret)
|
_configService.FileSharingTalkUid, _configService.FileSharingTalkSecret)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,8 +32,8 @@ namespace NzbDrone.Core.Indexers
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return !string.IsNullOrWhiteSpace(_configProvider.FileSharingTalkUid) &&
|
return !string.IsNullOrWhiteSpace(_configService.FileSharingTalkUid) &&
|
||||||
!string.IsNullOrWhiteSpace(_configProvider.FileSharingTalkSecret);
|
!string.IsNullOrWhiteSpace(_configService.FileSharingTalkSecret);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ using System.ServiceModel.Syndication;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
|
|
||||||
|
@ -15,15 +16,15 @@ namespace NzbDrone.Core.Indexers
|
||||||
{
|
{
|
||||||
protected readonly Logger _logger;
|
protected readonly Logger _logger;
|
||||||
protected readonly HttpProvider _httpProvider;
|
protected readonly HttpProvider _httpProvider;
|
||||||
protected readonly ConfigProvider _configProvider;
|
protected readonly IConfigService _configService;
|
||||||
|
|
||||||
protected static readonly Regex TitleSearchRegex = new Regex(@"[\W]", RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
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);
|
protected static readonly Regex RemoveThe = new Regex(@"^the\s", RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||||
|
|
||||||
protected IndexerBase(HttpProvider httpProvider, ConfigProvider configProvider)
|
protected IndexerBase(HttpProvider httpProvider, IConfigService configService)
|
||||||
{
|
{
|
||||||
_httpProvider = httpProvider;
|
_httpProvider = httpProvider;
|
||||||
_configProvider = configProvider;
|
_configService = configService;
|
||||||
|
|
||||||
_logger = LogManager.GetLogger(GetType().ToString());
|
_logger = LogManager.GetLogger(GetType().ToString());
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ using System.Collections.Generic;
|
||||||
using System.ServiceModel.Syndication;
|
using System.ServiceModel.Syndication;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
using NzbDrone.Core.Providers;
|
using NzbDrone.Core.Providers;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
|
@ -14,8 +15,8 @@ namespace NzbDrone.Core.Indexers
|
||||||
{
|
{
|
||||||
private readonly INewznabService _newznabProvider;
|
private readonly INewznabService _newznabProvider;
|
||||||
|
|
||||||
public Newznab(HttpProvider httpProvider, ConfigProvider configProvider, INewznabService newznabProvider)
|
public Newznab(HttpProvider httpProvider, IConfigService configService, INewznabService newznabProvider)
|
||||||
: base(httpProvider, configProvider)
|
: base(httpProvider, configService)
|
||||||
{
|
{
|
||||||
_newznabProvider = newznabProvider;
|
_newznabProvider = newznabProvider;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ using System.Collections.Generic;
|
||||||
using System.ServiceModel.Syndication;
|
using System.ServiceModel.Syndication;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
|
|
||||||
|
@ -11,8 +12,8 @@ namespace NzbDrone.Core.Indexers
|
||||||
{
|
{
|
||||||
public class NzbClub : IndexerBase
|
public class NzbClub : IndexerBase
|
||||||
{
|
{
|
||||||
public NzbClub(HttpProvider httpProvider, ConfigProvider configProvider)
|
public NzbClub(HttpProvider httpProvider, IConfigService configService)
|
||||||
: base(httpProvider, configProvider)
|
: base(httpProvider, configService)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ using System.Collections.Generic;
|
||||||
using System.ServiceModel.Syndication;
|
using System.ServiceModel.Syndication;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
|
|
||||||
|
@ -11,8 +12,8 @@ namespace NzbDrone.Core.Indexers
|
||||||
{
|
{
|
||||||
public class NzbIndex : IndexerBase
|
public class NzbIndex : IndexerBase
|
||||||
{
|
{
|
||||||
public NzbIndex(HttpProvider httpProvider, ConfigProvider configProvider)
|
public NzbIndex(HttpProvider httpProvider, IConfigService configService)
|
||||||
: base(httpProvider, configProvider)
|
: base(httpProvider, configService)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ using System.Collections.Generic;
|
||||||
using System.ServiceModel.Syndication;
|
using System.ServiceModel.Syndication;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
|
|
||||||
|
@ -11,7 +12,7 @@ namespace NzbDrone.Core.Indexers
|
||||||
{
|
{
|
||||||
public class NzbsRUs : IndexerBase
|
public class NzbsRUs : IndexerBase
|
||||||
{
|
{
|
||||||
public NzbsRUs(HttpProvider httpProvider, ConfigProvider configProvider) : base(httpProvider, configProvider)
|
public NzbsRUs(HttpProvider httpProvider, IConfigService configService) : base(httpProvider, configService)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,8 +24,8 @@ namespace NzbDrone.Core.Indexers
|
||||||
{
|
{
|
||||||
string.Format(
|
string.Format(
|
||||||
"https://www.nzbsrus.com/rssfeed.php?cat=91,75&i={0}&h={1}",
|
"https://www.nzbsrus.com/rssfeed.php?cat=91,75&i={0}&h={1}",
|
||||||
_configProvider.NzbsrusUId,
|
_configService.NzbsrusUId,
|
||||||
_configProvider.NzbsrusHash)
|
_configService.NzbsrusHash)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,8 +34,8 @@ namespace NzbDrone.Core.Indexers
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return !string.IsNullOrWhiteSpace(_configProvider.NzbsrusUId) &&
|
return !string.IsNullOrWhiteSpace(_configService.NzbsrusUId) &&
|
||||||
!string.IsNullOrWhiteSpace(_configProvider.NzbsrusHash);
|
!string.IsNullOrWhiteSpace(_configService.NzbsrusHash);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ using System.Net;
|
||||||
using System.ServiceModel.Syndication;
|
using System.ServiceModel.Syndication;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
using NzbDrone.Core.Model.Nzbx;
|
using NzbDrone.Core.Model.Nzbx;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
|
@ -13,8 +14,8 @@ namespace NzbDrone.Core.Indexers
|
||||||
{
|
{
|
||||||
class Nzbx : IndexerBase
|
class Nzbx : IndexerBase
|
||||||
{
|
{
|
||||||
public Nzbx(HttpProvider httpProvider, ConfigProvider configProvider)
|
public Nzbx(HttpProvider httpProvider, IConfigService configService)
|
||||||
: base(httpProvider, configProvider)
|
: base(httpProvider, configService)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ using System.Linq;
|
||||||
using System.ServiceModel.Syndication;
|
using System.ServiceModel.Syndication;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
|
|
||||||
|
@ -11,8 +12,8 @@ namespace NzbDrone.Core.Indexers
|
||||||
{
|
{
|
||||||
class Omgwtfnzbs : IndexerBase
|
class Omgwtfnzbs : IndexerBase
|
||||||
{
|
{
|
||||||
public Omgwtfnzbs(HttpProvider httpProvider, ConfigProvider configProvider)
|
public Omgwtfnzbs(HttpProvider httpProvider, IConfigService configService)
|
||||||
: base(httpProvider, configProvider)
|
: base(httpProvider, configService)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +29,7 @@ namespace NzbDrone.Core.Indexers
|
||||||
return new string[]
|
return new string[]
|
||||||
{
|
{
|
||||||
String.Format("http://rss.omgwtfnzbs.org/rss-search.php?catid=19,20&user={0}&api={1}&eng=1",
|
String.Format("http://rss.omgwtfnzbs.org/rss-search.php?catid=19,20&user={0}&api={1}&eng=1",
|
||||||
_configProvider.OmgwtfnzbsUsername, _configProvider.OmgwtfnzbsApiKey)
|
_configService.OmgwtfnzbsUsername, _configService.OmgwtfnzbsApiKey)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,8 +38,8 @@ namespace NzbDrone.Core.Indexers
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return !string.IsNullOrWhiteSpace(_configProvider.OmgwtfnzbsUsername) &&
|
return !string.IsNullOrWhiteSpace(_configService.OmgwtfnzbsUsername) &&
|
||||||
!string.IsNullOrWhiteSpace(_configProvider.OmgwtfnzbsApiKey);
|
!string.IsNullOrWhiteSpace(_configService.OmgwtfnzbsApiKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ServiceModel.Syndication;
|
using System.ServiceModel.Syndication;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
|
|
||||||
|
@ -10,7 +11,7 @@ namespace NzbDrone.Core.Indexers
|
||||||
{
|
{
|
||||||
public class Wombles : IndexerBase
|
public class Wombles : IndexerBase
|
||||||
{
|
{
|
||||||
public Wombles(HttpProvider httpProvider, ConfigProvider configProvider) : base(httpProvider, configProvider)
|
public Wombles(HttpProvider httpProvider, IConfigService configService) : base(httpProvider, configService)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,12 +2,10 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
using NzbDrone.Core.Model.Notification;
|
using NzbDrone.Core.Model.Notification;
|
||||||
using NzbDrone.Core.Providers;
|
|
||||||
using NzbDrone.Core.Providers.Core;
|
|
||||||
using NzbDrone.Core.Repository;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Jobs
|
namespace NzbDrone.Core.Jobs
|
||||||
{
|
{
|
||||||
|
@ -16,17 +14,17 @@ namespace NzbDrone.Core.Jobs
|
||||||
private readonly IEpisodeService _episodeService;
|
private readonly IEpisodeService _episodeService;
|
||||||
private readonly EpisodeSearchJob _episodeSearchJob;
|
private readonly EpisodeSearchJob _episodeSearchJob;
|
||||||
private readonly SeasonSearchJob _seasonSearchJob;
|
private readonly SeasonSearchJob _seasonSearchJob;
|
||||||
private readonly ConfigProvider _configProvider;
|
private readonly IConfigService _configService;
|
||||||
|
|
||||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
public BacklogSearchJob(IEpisodeService episodeService, EpisodeSearchJob episodeSearchJob,
|
public BacklogSearchJob(IEpisodeService episodeService, EpisodeSearchJob episodeSearchJob,
|
||||||
SeasonSearchJob seasonSearchJob, ConfigProvider configProvider)
|
SeasonSearchJob seasonSearchJob, IConfigService configService)
|
||||||
{
|
{
|
||||||
_episodeService = episodeService;
|
_episodeService = episodeService;
|
||||||
_episodeSearchJob = episodeSearchJob;
|
_episodeSearchJob = episodeSearchJob;
|
||||||
_seasonSearchJob = seasonSearchJob;
|
_seasonSearchJob = seasonSearchJob;
|
||||||
_configProvider = configProvider;
|
_configService = configService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Name
|
public string Name
|
||||||
|
@ -89,7 +87,7 @@ namespace NzbDrone.Core.Jobs
|
||||||
|
|
||||||
public List<Episode> GetMissingForEnabledSeries()
|
public List<Episode> GetMissingForEnabledSeries()
|
||||||
{
|
{
|
||||||
if (!_configProvider.EnableBacklogSearching)
|
if (!_configService.EnableBacklogSearching)
|
||||||
{
|
{
|
||||||
Logger.Trace("Backlog searching is not enabled, only running for explicitly enabled series.");
|
Logger.Trace("Backlog searching is not enabled, only running for explicitly enabled series.");
|
||||||
return _episodeService.EpisodesWithoutFiles(true).Where(e =>
|
return _episodeService.EpisodesWithoutFiles(true).Where(e =>
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
using NzbDrone.Core.Helpers;
|
using NzbDrone.Core.Helpers;
|
||||||
using NzbDrone.Core.Model.Notification;
|
using NzbDrone.Core.Model.Notification;
|
||||||
|
@ -15,16 +16,16 @@ namespace NzbDrone.Core.Jobs
|
||||||
{
|
{
|
||||||
private readonly ISeriesService _seriesService;
|
private readonly ISeriesService _seriesService;
|
||||||
private readonly DiskScanProvider _diskScanProvider;
|
private readonly DiskScanProvider _diskScanProvider;
|
||||||
private readonly ConfigProvider _configProvider;
|
private readonly IConfigService _configService;
|
||||||
private readonly ISeriesRepository _seriesRepository;
|
private readonly ISeriesRepository _seriesRepository;
|
||||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
public DiskScanJob(ISeriesService seriesService, DiskScanProvider diskScanProvider,
|
public DiskScanJob(ISeriesService seriesService, DiskScanProvider diskScanProvider,
|
||||||
ConfigProvider configProvider, ISeriesRepository seriesRepository)
|
IConfigService configService, ISeriesRepository seriesRepository)
|
||||||
{
|
{
|
||||||
_seriesService = seriesService;
|
_seriesService = seriesService;
|
||||||
_diskScanProvider = diskScanProvider;
|
_diskScanProvider = diskScanProvider;
|
||||||
_configProvider = configProvider;
|
_configService = configService;
|
||||||
_seriesRepository = seriesRepository;
|
_seriesRepository = seriesRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +48,7 @@ namespace NzbDrone.Core.Jobs
|
||||||
IList<Series> seriesToScan;
|
IList<Series> seriesToScan;
|
||||||
if (options == null || options.SeriesId == 0)
|
if (options == null || options.SeriesId == 0)
|
||||||
{
|
{
|
||||||
if (_configProvider.IgnoreArticlesWhenSortingSeries)
|
if (_configService.IgnoreArticlesWhenSortingSeries)
|
||||||
seriesToScan = _seriesRepository.All().OrderBy(o => o.Title.IgnoreArticles()).ToList();
|
seriesToScan = _seriesRepository.All().OrderBy(o => o.Title.IgnoreArticles()).ToList();
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
using NzbDrone.Core.Model.Notification;
|
using NzbDrone.Core.Model.Notification;
|
||||||
|
@ -15,16 +16,16 @@ namespace NzbDrone.Core.Jobs
|
||||||
{
|
{
|
||||||
private readonly IEpisodeService _episodeService;
|
private readonly IEpisodeService _episodeService;
|
||||||
private readonly EpisodeSearchJob _episodeSearchJob;
|
private readonly EpisodeSearchJob _episodeSearchJob;
|
||||||
private readonly ConfigProvider _configProvider;
|
private readonly IConfigService _configService;
|
||||||
|
|
||||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
public PastWeekBacklogSearchJob(IEpisodeService episodeService, EpisodeSearchJob episodeSearchJob,
|
public PastWeekBacklogSearchJob(IEpisodeService episodeService, EpisodeSearchJob episodeSearchJob,
|
||||||
ConfigProvider configProvider)
|
IConfigService configService)
|
||||||
{
|
{
|
||||||
_episodeService = episodeService;
|
_episodeService = episodeService;
|
||||||
_episodeSearchJob = episodeSearchJob;
|
_episodeSearchJob = episodeSearchJob;
|
||||||
_configProvider = configProvider;
|
_configService = configService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Name
|
public string Name
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
using System;
|
using System;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Model.Notification;
|
using NzbDrone.Core.Model.Notification;
|
||||||
using NzbDrone.Core.Providers;
|
using NzbDrone.Core.Providers;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
|
@ -13,13 +14,13 @@ namespace NzbDrone.Core.Jobs
|
||||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
private readonly PostDownloadProvider _postDownloadProvider;
|
private readonly PostDownloadProvider _postDownloadProvider;
|
||||||
private readonly ConfigProvider _configProvider;
|
private readonly IConfigService _configService;
|
||||||
private readonly DiskProvider _diskProvider;
|
private readonly DiskProvider _diskProvider;
|
||||||
|
|
||||||
public PostDownloadScanJob(PostDownloadProvider postDownloadProvider,ConfigProvider configProvider, DiskProvider diskProvider)
|
public PostDownloadScanJob(PostDownloadProvider postDownloadProvider,IConfigService configService, DiskProvider diskProvider)
|
||||||
{
|
{
|
||||||
_postDownloadProvider = postDownloadProvider;
|
_postDownloadProvider = postDownloadProvider;
|
||||||
_configProvider = configProvider;
|
_configService = configService;
|
||||||
_diskProvider = diskProvider;
|
_diskProvider = diskProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +46,7 @@ namespace NzbDrone.Core.Jobs
|
||||||
dropFolder = options.Path;
|
dropFolder = options.Path;
|
||||||
|
|
||||||
else
|
else
|
||||||
dropFolder = _configProvider.DownloadClientTvDirectory;
|
dropFolder = _configService.DownloadClientTvDirectory;
|
||||||
|
|
||||||
if (String.IsNullOrWhiteSpace(dropFolder))
|
if (String.IsNullOrWhiteSpace(dropFolder))
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
using NzbDrone.Core.Model.Notification;
|
using NzbDrone.Core.Model.Notification;
|
||||||
|
@ -15,16 +16,16 @@ namespace NzbDrone.Core.Jobs
|
||||||
{
|
{
|
||||||
private readonly IEpisodeService _episodeService;
|
private readonly IEpisodeService _episodeService;
|
||||||
private readonly EpisodeSearchJob _episodeSearchJob;
|
private readonly EpisodeSearchJob _episodeSearchJob;
|
||||||
private readonly ConfigProvider _configProvider;
|
private readonly IConfigService _configService;
|
||||||
|
|
||||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
public RecentBacklogSearchJob(IEpisodeService episodeService, EpisodeSearchJob episodeSearchJob,
|
public RecentBacklogSearchJob(IEpisodeService episodeService, EpisodeSearchJob episodeSearchJob,
|
||||||
ConfigProvider configProvider)
|
IConfigService configService)
|
||||||
{
|
{
|
||||||
_episodeService = episodeService;
|
_episodeService = episodeService;
|
||||||
_episodeSearchJob = episodeSearchJob;
|
_episodeSearchJob = episodeSearchJob;
|
||||||
_configProvider = configProvider;
|
_configService = configService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Name
|
public string Name
|
||||||
|
@ -50,7 +51,7 @@ namespace NzbDrone.Core.Jobs
|
||||||
|
|
||||||
public List<Episode> GetMissingForEnabledSeries()
|
public List<Episode> GetMissingForEnabledSeries()
|
||||||
{
|
{
|
||||||
if (!_configProvider.EnableBacklogSearching)
|
if (!_configService.EnableBacklogSearching)
|
||||||
{
|
{
|
||||||
Logger.Trace("Backlog searching is not enabled, only running for explicitly enabled series.");
|
Logger.Trace("Backlog searching is not enabled, only running for explicitly enabled series.");
|
||||||
return _episodeService.EpisodesWithoutFiles(true).Where(e =>
|
return _episodeService.EpisodesWithoutFiles(true).Where(e =>
|
||||||
|
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using NLog;
|
using NLog;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Indexers;
|
using NzbDrone.Core.Indexers;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
using NzbDrone.Core.Model.Notification;
|
using NzbDrone.Core.Model.Notification;
|
||||||
|
@ -19,21 +20,21 @@ namespace NzbDrone.Core.Jobs
|
||||||
private readonly MonitoredEpisodeSpecification _isMonitoredEpisodeSpecification;
|
private readonly MonitoredEpisodeSpecification _isMonitoredEpisodeSpecification;
|
||||||
private readonly AllowedDownloadSpecification _allowedDownloadSpecification;
|
private readonly AllowedDownloadSpecification _allowedDownloadSpecification;
|
||||||
private readonly UpgradeHistorySpecification _upgradeHistorySpecification;
|
private readonly UpgradeHistorySpecification _upgradeHistorySpecification;
|
||||||
private readonly ConfigProvider _configProvider;
|
private readonly IConfigService _configService;
|
||||||
|
|
||||||
|
|
||||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
public RssSyncJob(DownloadProvider downloadProvider, IIndexerService indexerService,
|
public RssSyncJob(DownloadProvider downloadProvider, IIndexerService indexerService,
|
||||||
MonitoredEpisodeSpecification isMonitoredEpisodeSpecification, AllowedDownloadSpecification allowedDownloadSpecification,
|
MonitoredEpisodeSpecification isMonitoredEpisodeSpecification, AllowedDownloadSpecification allowedDownloadSpecification,
|
||||||
UpgradeHistorySpecification upgradeHistorySpecification, ConfigProvider configProvider)
|
UpgradeHistorySpecification upgradeHistorySpecification, IConfigService configService)
|
||||||
{
|
{
|
||||||
_downloadProvider = downloadProvider;
|
_downloadProvider = downloadProvider;
|
||||||
_indexerService = indexerService;
|
_indexerService = indexerService;
|
||||||
_isMonitoredEpisodeSpecification = isMonitoredEpisodeSpecification;
|
_isMonitoredEpisodeSpecification = isMonitoredEpisodeSpecification;
|
||||||
_allowedDownloadSpecification = allowedDownloadSpecification;
|
_allowedDownloadSpecification = allowedDownloadSpecification;
|
||||||
_upgradeHistorySpecification = upgradeHistorySpecification;
|
_upgradeHistorySpecification = upgradeHistorySpecification;
|
||||||
_configProvider = configProvider;
|
_configService = configService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Name
|
public string Name
|
||||||
|
@ -43,7 +44,7 @@ namespace NzbDrone.Core.Jobs
|
||||||
|
|
||||||
public TimeSpan DefaultInterval
|
public TimeSpan DefaultInterval
|
||||||
{
|
{
|
||||||
get { return TimeSpan.FromMinutes(_configProvider.RssSyncInterval); }
|
get { return TimeSpan.FromMinutes(_configService.RssSyncInterval); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Start(ProgressNotification notification, dynamic options)
|
public void Start(ProgressNotification notification, dynamic options)
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
using NzbDrone.Core.Helpers;
|
using NzbDrone.Core.Helpers;
|
||||||
using NzbDrone.Core.Model.Notification;
|
using NzbDrone.Core.Model.Notification;
|
||||||
|
@ -16,17 +17,17 @@ namespace NzbDrone.Core.Jobs
|
||||||
private readonly ISeriesService _seriesService;
|
private readonly ISeriesService _seriesService;
|
||||||
private readonly IEpisodeService _episodeService;
|
private readonly IEpisodeService _episodeService;
|
||||||
private readonly ReferenceDataProvider _referenceDataProvider;
|
private readonly ReferenceDataProvider _referenceDataProvider;
|
||||||
private readonly ConfigProvider _configProvider;
|
private readonly IConfigService _configService;
|
||||||
private readonly ISeriesRepository _seriesRepository;
|
private readonly ISeriesRepository _seriesRepository;
|
||||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
public UpdateInfoJob(ISeriesService seriesService, IEpisodeService episodeService,
|
public UpdateInfoJob(ISeriesService seriesService, IEpisodeService episodeService,
|
||||||
ReferenceDataProvider referenceDataProvider, ConfigProvider configProvider, ISeriesRepository seriesRepository)
|
ReferenceDataProvider referenceDataProvider, IConfigService configService, ISeriesRepository seriesRepository)
|
||||||
{
|
{
|
||||||
_seriesService = seriesService;
|
_seriesService = seriesService;
|
||||||
_episodeService = episodeService;
|
_episodeService = episodeService;
|
||||||
_referenceDataProvider = referenceDataProvider;
|
_referenceDataProvider = referenceDataProvider;
|
||||||
_configProvider = configProvider;
|
_configService = configService;
|
||||||
_seriesRepository = seriesRepository;
|
_seriesRepository = seriesRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +51,7 @@ namespace NzbDrone.Core.Jobs
|
||||||
IList<Series> seriesToUpdate;
|
IList<Series> seriesToUpdate;
|
||||||
if (options == null || options.SeriesId == 0)
|
if (options == null || options.SeriesId == 0)
|
||||||
{
|
{
|
||||||
if (_configProvider.IgnoreArticlesWhenSortingSeries)
|
if (_configService.IgnoreArticlesWhenSortingSeries)
|
||||||
seriesToUpdate = _seriesRepository.All().OrderBy(o => o.Title.IgnoreArticles()).ToList();
|
seriesToUpdate = _seriesRepository.All().OrderBy(o => o.Title.IgnoreArticles()).ToList();
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
|
@ -214,6 +214,9 @@
|
||||||
<Compile Include="..\NzbDrone.Common\Properties\SharedAssemblyInfo.cs">
|
<Compile Include="..\NzbDrone.Common\Properties\SharedAssemblyInfo.cs">
|
||||||
<Link>Properties\SharedAssemblyInfo.cs</Link>
|
<Link>Properties\SharedAssemblyInfo.cs</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Configuration\Config.cs" />
|
||||||
|
<Compile Include="Configuration\ConfigRepository.cs" />
|
||||||
|
<Compile Include="Configuration\IConfigService.cs" />
|
||||||
<Compile Include="Constants.cs" />
|
<Compile Include="Constants.cs" />
|
||||||
<Compile Include="ContainerExtentions.cs" />
|
<Compile Include="ContainerExtentions.cs" />
|
||||||
<Compile Include="Datastore\ModelBase.cs" />
|
<Compile Include="Datastore\ModelBase.cs" />
|
||||||
|
@ -406,7 +409,7 @@
|
||||||
<Compile Include="Providers\Core\ArchiveProvider.cs">
|
<Compile Include="Providers\Core\ArchiveProvider.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Providers\Core\ConfigProvider.cs">
|
<Compile Include="Configuration\ConfigService.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Providers\Core\UdpProvider.cs">
|
<Compile Include="Providers\Core\UdpProvider.cs">
|
||||||
|
@ -589,7 +592,6 @@
|
||||||
<Compile Include="Tv\Episode.cs" />
|
<Compile Include="Tv\Episode.cs" />
|
||||||
<Compile Include="Instrumentation\Log.cs" />
|
<Compile Include="Instrumentation\Log.cs" />
|
||||||
<Compile Include="History\History.cs" />
|
<Compile Include="History\History.cs" />
|
||||||
<Compile Include="Repository\Config.cs" />
|
|
||||||
<Compile Include="Repository\Quality\QualityType.cs" />
|
<Compile Include="Repository\Quality\QualityType.cs" />
|
||||||
<Compile Include="Repository\Quality\QualityProfile.cs" />
|
<Compile Include="Repository\Quality\QualityProfile.cs" />
|
||||||
<Compile Include="RootFolders\RootFolder.cs" />
|
<Compile Include="RootFolders\RootFolder.cs" />
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using NLog;
|
using NLog;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
|
@ -11,13 +12,13 @@ namespace NzbDrone.Core.Providers.Converting
|
||||||
{
|
{
|
||||||
public class AtomicParsleyProvider
|
public class AtomicParsleyProvider
|
||||||
{
|
{
|
||||||
private readonly ConfigProvider _configProvider;
|
private readonly IConfigService _configService;
|
||||||
|
|
||||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
public AtomicParsleyProvider(ConfigProvider configProvider)
|
public AtomicParsleyProvider(IConfigService configService)
|
||||||
{
|
{
|
||||||
_configProvider = configProvider;
|
_configService = configService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AtomicParsleyProvider()
|
public AtomicParsleyProvider()
|
||||||
|
@ -29,8 +30,8 @@ namespace NzbDrone.Core.Providers.Converting
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
|
|
||||||
var atomicParsleyLocation = _configProvider.GetValue("AtomicParsleyLocation", "");
|
var atomicParsleyLocation = _configService.GetValue("AtomicParsleyLocation", "");
|
||||||
var atomicParsleyTitleType = (AtomicParsleyTitleType) Convert.ToInt32(_configProvider.GetValue("AtomicParsley", 0));
|
var atomicParsleyTitleType = (AtomicParsleyTitleType) Convert.ToInt32(_configService.GetValue("AtomicParsley", 0));
|
||||||
|
|
||||||
var atomicParsleyCommand = String.Format("\"{0}\" --overWrite --title \"{1}\" --genre \"TV Shows\" --stik \"TV Show\" --TVShowName \"{2}\" --TVEpisodeNum \"{3}\" --TVSeason \"{4}\"",
|
var atomicParsleyCommand = String.Format("\"{0}\" --overWrite --title \"{1}\" --genre \"TV Shows\" --stik \"TV Show\" --TVShowName \"{2}\" --TVEpisodeNum \"{3}\" --TVSeason \"{4}\"",
|
||||||
outputFile, episode.Title, episode.Series.Title, episode.EpisodeNumber, episode.SeasonNumber);
|
outputFile, episode.Title, episode.Series.Title, episode.EpisodeNumber, episode.SeasonNumber);
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using NLog;
|
using NLog;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
using NzbDrone.Core.Model.Notification;
|
using NzbDrone.Core.Model.Notification;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
|
@ -12,7 +13,7 @@ namespace NzbDrone.Core.Providers.Converting
|
||||||
public class HandbrakeProvider
|
public class HandbrakeProvider
|
||||||
{
|
{
|
||||||
//Interacts with Handbrake
|
//Interacts with Handbrake
|
||||||
private readonly ConfigProvider _configProvider;
|
private readonly IConfigService _configService;
|
||||||
private ProgressNotification _notification;
|
private ProgressNotification _notification;
|
||||||
private Episode _currentEpisode;
|
private Episode _currentEpisode;
|
||||||
|
|
||||||
|
@ -22,9 +23,9 @@ namespace NzbDrone.Core.Providers.Converting
|
||||||
|
|
||||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
public HandbrakeProvider(ConfigProvider configProvider)
|
public HandbrakeProvider(IConfigService configService)
|
||||||
{
|
{
|
||||||
_configProvider = configProvider;
|
_configService = configService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HandbrakeProvider()
|
public HandbrakeProvider()
|
||||||
|
@ -37,9 +38,9 @@ namespace NzbDrone.Core.Providers.Converting
|
||||||
_notification = notification;
|
_notification = notification;
|
||||||
_currentEpisode = episode;
|
_currentEpisode = episode;
|
||||||
|
|
||||||
var outputFile = _configProvider.GetValue("iPodConvertDir", "");
|
var outputFile = _configService.GetValue("iPodConvertDir", "");
|
||||||
|
|
||||||
var handBrakePreset = _configProvider.GetValue("HandBrakePreset", "iPhone & iPod Touch");
|
var handBrakePreset = _configService.GetValue("HandBrakePreset", "iPhone & iPod Touch");
|
||||||
var handBrakeCommand = String.Format("-i \"{0}\" -o \"{1}\" --preset=\"{2}\"", episode.EpisodeFile.Path, outputFile, handBrakePreset);
|
var handBrakeCommand = String.Format("-i \"{0}\" -o \"{1}\" --preset=\"{2}\"", episode.EpisodeFile.Path, outputFile, handBrakePreset);
|
||||||
var handBrakeFile = @"C:\Program Files (x86)\Handbrake\HandBrakeCLI.exe";
|
var handBrakeFile = @"C:\Program Files (x86)\Handbrake\HandBrakeCLI.exe";
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
|
@ -22,7 +23,7 @@ namespace NzbDrone.Core.Providers
|
||||||
private readonly ExternalNotificationProvider _externalNotificationProvider;
|
private readonly ExternalNotificationProvider _externalNotificationProvider;
|
||||||
private readonly DownloadProvider _downloadProvider;
|
private readonly DownloadProvider _downloadProvider;
|
||||||
private readonly SignalRProvider _signalRProvider;
|
private readonly SignalRProvider _signalRProvider;
|
||||||
private readonly ConfigProvider _configProvider;
|
private readonly IConfigService _configService;
|
||||||
private readonly RecycleBinProvider _recycleBinProvider;
|
private readonly RecycleBinProvider _recycleBinProvider;
|
||||||
private readonly MediaInfoProvider _mediaInfoProvider;
|
private readonly MediaInfoProvider _mediaInfoProvider;
|
||||||
private readonly ISeriesRepository _seriesRepository;
|
private readonly ISeriesRepository _seriesRepository;
|
||||||
|
@ -30,7 +31,7 @@ namespace NzbDrone.Core.Providers
|
||||||
public DiskScanProvider(DiskProvider diskProvider, IEpisodeService episodeService,
|
public DiskScanProvider(DiskProvider diskProvider, IEpisodeService episodeService,
|
||||||
ISeriesService seriesService, MediaFileProvider mediaFileProvider,
|
ISeriesService seriesService, MediaFileProvider mediaFileProvider,
|
||||||
ExternalNotificationProvider externalNotificationProvider, DownloadProvider downloadProvider,
|
ExternalNotificationProvider externalNotificationProvider, DownloadProvider downloadProvider,
|
||||||
SignalRProvider signalRProvider, ConfigProvider configProvider,
|
SignalRProvider signalRProvider, IConfigService configService,
|
||||||
RecycleBinProvider recycleBinProvider, MediaInfoProvider mediaInfoProvider, ISeriesRepository seriesRepository)
|
RecycleBinProvider recycleBinProvider, MediaInfoProvider mediaInfoProvider, ISeriesRepository seriesRepository)
|
||||||
{
|
{
|
||||||
_diskProvider = diskProvider;
|
_diskProvider = diskProvider;
|
||||||
|
@ -40,7 +41,7 @@ namespace NzbDrone.Core.Providers
|
||||||
_externalNotificationProvider = externalNotificationProvider;
|
_externalNotificationProvider = externalNotificationProvider;
|
||||||
_downloadProvider = downloadProvider;
|
_downloadProvider = downloadProvider;
|
||||||
_signalRProvider = signalRProvider;
|
_signalRProvider = signalRProvider;
|
||||||
_configProvider = configProvider;
|
_configService = configService;
|
||||||
_recycleBinProvider = recycleBinProvider;
|
_recycleBinProvider = recycleBinProvider;
|
||||||
_mediaInfoProvider = mediaInfoProvider;
|
_mediaInfoProvider = mediaInfoProvider;
|
||||||
_seriesRepository = seriesRepository;
|
_seriesRepository = seriesRepository;
|
||||||
|
@ -270,7 +271,7 @@ namespace NzbDrone.Core.Providers
|
||||||
{
|
{
|
||||||
Logger.Trace("Detaching episode {0} from file.", episode.OID);
|
Logger.Trace("Detaching episode {0} from file.", episode.OID);
|
||||||
episode.EpisodeFile = null;
|
episode.EpisodeFile = null;
|
||||||
episode.Ignored = _configProvider.AutoIgnorePreviouslyDownloadedEpisodes;
|
episode.Ignored = _configService.AutoIgnorePreviouslyDownloadedEpisodes;
|
||||||
episode.GrabDate = null;
|
episode.GrabDate = null;
|
||||||
episode.PostDownloadStatus = PostDownloadStatusType.Unknown;
|
episode.PostDownloadStatus = PostDownloadStatusType.Unknown;
|
||||||
_episodeService.UpdateEpisode(episode);
|
_episodeService.UpdateEpisode(episode);
|
||||||
|
|
|
@ -3,6 +3,7 @@ using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.History;
|
using NzbDrone.Core.History;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
|
@ -12,7 +13,7 @@ namespace NzbDrone.Core.Providers.DownloadClients
|
||||||
{
|
{
|
||||||
public class BlackholeProvider : IDownloadClient
|
public class BlackholeProvider : IDownloadClient
|
||||||
{
|
{
|
||||||
private readonly ConfigProvider _configProvider;
|
private readonly IConfigService _configService;
|
||||||
private readonly HttpProvider _httpProvider;
|
private readonly HttpProvider _httpProvider;
|
||||||
private readonly DiskProvider _diskProvider;
|
private readonly DiskProvider _diskProvider;
|
||||||
private readonly UpgradeHistorySpecification _upgradeHistorySpecification;
|
private readonly UpgradeHistorySpecification _upgradeHistorySpecification;
|
||||||
|
@ -20,10 +21,10 @@ namespace NzbDrone.Core.Providers.DownloadClients
|
||||||
|
|
||||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
public BlackholeProvider(ConfigProvider configProvider, HttpProvider httpProvider,
|
public BlackholeProvider(IConfigService configService, HttpProvider httpProvider,
|
||||||
DiskProvider diskProvider, UpgradeHistorySpecification upgradeHistorySpecification)
|
DiskProvider diskProvider, UpgradeHistorySpecification upgradeHistorySpecification)
|
||||||
{
|
{
|
||||||
_configProvider = configProvider;
|
_configService = configService;
|
||||||
_httpProvider = httpProvider;
|
_httpProvider = httpProvider;
|
||||||
_diskProvider = diskProvider;
|
_diskProvider = diskProvider;
|
||||||
_upgradeHistorySpecification = upgradeHistorySpecification;
|
_upgradeHistorySpecification = upgradeHistorySpecification;
|
||||||
|
@ -39,7 +40,7 @@ namespace NzbDrone.Core.Providers.DownloadClients
|
||||||
{
|
{
|
||||||
title = MediaFileProvider.CleanFilename(title);
|
title = MediaFileProvider.CleanFilename(title);
|
||||||
|
|
||||||
var filename = Path.Combine(_configProvider.BlackholeDirectory, title + ".nzb");
|
var filename = Path.Combine(_configService.BlackholeDirectory, title + ".nzb");
|
||||||
|
|
||||||
if (_diskProvider.FileExists(filename))
|
if (_diskProvider.FileExists(filename))
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,6 +8,7 @@ using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
using NzbDrone.Core.Model.Nzbget;
|
using NzbDrone.Core.Model.Nzbget;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
|
@ -18,12 +19,12 @@ namespace NzbDrone.Core.Providers.DownloadClients
|
||||||
public class NzbgetProvider : IDownloadClient
|
public class NzbgetProvider : IDownloadClient
|
||||||
{
|
{
|
||||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||||
private readonly ConfigProvider _configProvider;
|
private readonly IConfigService _configService;
|
||||||
private readonly HttpProvider _httpProvider;
|
private readonly HttpProvider _httpProvider;
|
||||||
|
|
||||||
public NzbgetProvider(ConfigProvider configProvider, HttpProvider httpProvider)
|
public NzbgetProvider(IConfigService configService, HttpProvider httpProvider)
|
||||||
{
|
{
|
||||||
_configProvider = configProvider;
|
_configService = configService;
|
||||||
_httpProvider = httpProvider;
|
_httpProvider = httpProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,8 +69,8 @@ namespace NzbDrone.Core.Providers.DownloadClients
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string cat = _configProvider.NzbgetTvCategory;
|
string cat = _configService.NzbgetTvCategory;
|
||||||
int priority = recentlyAired ? (int)_configProvider.NzbgetRecentTvPriority : (int)_configProvider.NzbgetBacklogTvPriority;
|
int priority = recentlyAired ? (int)_configService.NzbgetRecentTvPriority : (int)_configService.NzbgetBacklogTvPriority;
|
||||||
|
|
||||||
var command = new JsonRequest
|
var command = new JsonRequest
|
||||||
{
|
{
|
||||||
|
@ -115,16 +116,16 @@ namespace NzbDrone.Core.Providers.DownloadClients
|
||||||
{
|
{
|
||||||
//Get saved values if any of these are defaults
|
//Get saved values if any of these are defaults
|
||||||
if (host == null)
|
if (host == null)
|
||||||
host = _configProvider.NzbgetHost;
|
host = _configService.NzbgetHost;
|
||||||
|
|
||||||
if (port == 0)
|
if (port == 0)
|
||||||
port = _configProvider.NzbgetPort;
|
port = _configService.NzbgetPort;
|
||||||
|
|
||||||
if (username == null)
|
if (username == null)
|
||||||
username = _configProvider.NzbgetUsername;
|
username = _configService.NzbgetUsername;
|
||||||
|
|
||||||
if (password == null)
|
if (password == null)
|
||||||
password = _configProvider.NzbgetPassword;
|
password = _configService.NzbgetPassword;
|
||||||
|
|
||||||
var command = new JsonRequest
|
var command = new JsonRequest
|
||||||
{
|
{
|
||||||
|
@ -158,10 +159,10 @@ namespace NzbDrone.Core.Providers.DownloadClients
|
||||||
private string PostCommand(string command)
|
private string PostCommand(string command)
|
||||||
{
|
{
|
||||||
var url = String.Format(@"{0}:{1}",
|
var url = String.Format(@"{0}:{1}",
|
||||||
_configProvider.NzbgetHost,
|
_configService.NzbgetHost,
|
||||||
_configProvider.NzbgetPort);
|
_configService.NzbgetPort);
|
||||||
|
|
||||||
return _httpProvider.PostCommand(url, _configProvider.NzbgetUsername, _configProvider.NzbgetPassword, command);
|
return _httpProvider.PostCommand(url, _configService.NzbgetUsername, _configService.NzbgetPassword, command);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CheckForError(string response)
|
private void CheckForError(string response)
|
||||||
|
|
|
@ -3,6 +3,7 @@ using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
using NzbDrone.Core.DecisionEngine;
|
using NzbDrone.Core.DecisionEngine;
|
||||||
|
@ -11,17 +12,17 @@ namespace NzbDrone.Core.Providers.DownloadClients
|
||||||
{
|
{
|
||||||
public class PneumaticProvider : IDownloadClient
|
public class PneumaticProvider : IDownloadClient
|
||||||
{
|
{
|
||||||
private readonly ConfigProvider _configProvider;
|
private readonly IConfigService _configService;
|
||||||
private readonly HttpProvider _httpProvider;
|
private readonly HttpProvider _httpProvider;
|
||||||
private readonly DiskProvider _diskProvider;
|
private readonly DiskProvider _diskProvider;
|
||||||
private readonly UpgradeHistorySpecification _upgradeHistorySpecification;
|
private readonly UpgradeHistorySpecification _upgradeHistorySpecification;
|
||||||
|
|
||||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
public PneumaticProvider(ConfigProvider configProvider, HttpProvider httpProvider,
|
public PneumaticProvider(IConfigService configService, HttpProvider httpProvider,
|
||||||
DiskProvider diskProvider, UpgradeHistorySpecification upgradeHistorySpecification)
|
DiskProvider diskProvider, UpgradeHistorySpecification upgradeHistorySpecification)
|
||||||
{
|
{
|
||||||
_configProvider = configProvider;
|
_configService = configService;
|
||||||
_httpProvider = httpProvider;
|
_httpProvider = httpProvider;
|
||||||
_diskProvider = diskProvider;
|
_diskProvider = diskProvider;
|
||||||
_upgradeHistorySpecification = upgradeHistorySpecification;
|
_upgradeHistorySpecification = upgradeHistorySpecification;
|
||||||
|
@ -45,7 +46,7 @@ namespace NzbDrone.Core.Providers.DownloadClients
|
||||||
title = MediaFileProvider.CleanFilename(title);
|
title = MediaFileProvider.CleanFilename(title);
|
||||||
|
|
||||||
//Save to the Pneumatic directory (The user will need to ensure its accessible by XBMC)
|
//Save to the Pneumatic directory (The user will need to ensure its accessible by XBMC)
|
||||||
var filename = Path.Combine(_configProvider.PneumaticDirectory, title + ".nzb");
|
var filename = Path.Combine(_configService.PneumaticDirectory, title + ".nzb");
|
||||||
|
|
||||||
if (_diskProvider.FileExists(filename))
|
if (_diskProvider.FileExists(filename))
|
||||||
{
|
{
|
||||||
|
@ -60,7 +61,7 @@ namespace NzbDrone.Core.Providers.DownloadClients
|
||||||
logger.Trace("NZB Download succeeded, saved to: {0}", filename);
|
logger.Trace("NZB Download succeeded, saved to: {0}", filename);
|
||||||
|
|
||||||
var contents = String.Format("plugin://plugin.program.pneumatic/?mode=strm&type=add_file&nzb={0}&nzbname={1}", filename, title);
|
var contents = String.Format("plugin://plugin.program.pneumatic/?mode=strm&type=add_file&nzb={0}&nzbname={1}", filename, title);
|
||||||
_diskProvider.WriteAllText(Path.Combine(_configProvider.DownloadClientTvDirectory, title + ".strm"), contents);
|
_diskProvider.WriteAllText(Path.Combine(_configService.DownloadClientTvDirectory, title + ".strm"), contents);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
using NzbDrone.Core.Model.Sabnzbd;
|
using NzbDrone.Core.Model.Sabnzbd;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
|
@ -18,12 +19,12 @@ namespace NzbDrone.Core.Providers.DownloadClients
|
||||||
public class SabProvider : IDownloadClient
|
public class SabProvider : IDownloadClient
|
||||||
{
|
{
|
||||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||||
private readonly ConfigProvider _configProvider;
|
private readonly IConfigService _configService;
|
||||||
private readonly HttpProvider _httpProvider;
|
private readonly HttpProvider _httpProvider;
|
||||||
|
|
||||||
public SabProvider(ConfigProvider configProvider, HttpProvider httpProvider)
|
public SabProvider(IConfigService configService, HttpProvider httpProvider)
|
||||||
{
|
{
|
||||||
_configProvider = configProvider;
|
_configService = configService;
|
||||||
_httpProvider = httpProvider;
|
_httpProvider = httpProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,8 +68,8 @@ namespace NzbDrone.Core.Providers.DownloadClients
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string cat = _configProvider.SabTvCategory;
|
string cat = _configService.SabTvCategory;
|
||||||
int priority = recentlyAired ? (int)_configProvider.SabRecentTvPriority : (int)_configProvider.SabBacklogTvPriority;
|
int priority = recentlyAired ? (int)_configService.SabRecentTvPriority : (int)_configService.SabBacklogTvPriority;
|
||||||
|
|
||||||
string name = url.Replace("&", "%26");
|
string name = url.Replace("&", "%26");
|
||||||
string nzbName = HttpUtility.UrlEncode(title);
|
string nzbName = HttpUtility.UrlEncode(title);
|
||||||
|
@ -122,19 +123,19 @@ namespace NzbDrone.Core.Providers.DownloadClients
|
||||||
{
|
{
|
||||||
//Get saved values if any of these are defaults
|
//Get saved values if any of these are defaults
|
||||||
if (host == null)
|
if (host == null)
|
||||||
host = _configProvider.SabHost;
|
host = _configService.SabHost;
|
||||||
|
|
||||||
if (port == 0)
|
if (port == 0)
|
||||||
port = _configProvider.SabPort;
|
port = _configService.SabPort;
|
||||||
|
|
||||||
if (apiKey == null)
|
if (apiKey == null)
|
||||||
apiKey = _configProvider.SabApiKey;
|
apiKey = _configService.SabApiKey;
|
||||||
|
|
||||||
if (username == null)
|
if (username == null)
|
||||||
username = _configProvider.SabUsername;
|
username = _configService.SabUsername;
|
||||||
|
|
||||||
if (password == null)
|
if (password == null)
|
||||||
password = _configProvider.SabPassword;
|
password = _configService.SabPassword;
|
||||||
|
|
||||||
const string action = "mode=get_cats&output=json";
|
const string action = "mode=get_cats&output=json";
|
||||||
|
|
||||||
|
@ -155,19 +156,19 @@ namespace NzbDrone.Core.Providers.DownloadClients
|
||||||
{
|
{
|
||||||
//Get saved values if any of these are defaults
|
//Get saved values if any of these are defaults
|
||||||
if (host == null)
|
if (host == null)
|
||||||
host = _configProvider.SabHost;
|
host = _configService.SabHost;
|
||||||
|
|
||||||
if (port == 0)
|
if (port == 0)
|
||||||
port = _configProvider.SabPort;
|
port = _configService.SabPort;
|
||||||
|
|
||||||
if (apiKey == null)
|
if (apiKey == null)
|
||||||
apiKey = _configProvider.SabApiKey;
|
apiKey = _configService.SabApiKey;
|
||||||
|
|
||||||
if (username == null)
|
if (username == null)
|
||||||
username = _configProvider.SabUsername;
|
username = _configService.SabUsername;
|
||||||
|
|
||||||
if (password == null)
|
if (password == null)
|
||||||
password = _configProvider.SabPassword;
|
password = _configService.SabPassword;
|
||||||
|
|
||||||
const string action = "mode=version&output=json";
|
const string action = "mode=version&output=json";
|
||||||
|
|
||||||
|
@ -202,12 +203,12 @@ namespace NzbDrone.Core.Providers.DownloadClients
|
||||||
private string GetSabRequest(string action)
|
private string GetSabRequest(string action)
|
||||||
{
|
{
|
||||||
return string.Format(@"http://{0}:{1}/api?{2}&apikey={3}&ma_username={4}&ma_password={5}",
|
return string.Format(@"http://{0}:{1}/api?{2}&apikey={3}&ma_username={4}&ma_password={5}",
|
||||||
_configProvider.SabHost,
|
_configService.SabHost,
|
||||||
_configProvider.SabPort,
|
_configService.SabPort,
|
||||||
action,
|
action,
|
||||||
_configProvider.SabApiKey,
|
_configService.SabApiKey,
|
||||||
_configProvider.SabUsername,
|
_configService.SabUsername,
|
||||||
_configProvider.SabPassword);
|
_configService.SabPassword);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CheckForError(string response)
|
private void CheckForError(string response)
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.History;
|
using NzbDrone.Core.History;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
|
@ -17,7 +18,7 @@ namespace NzbDrone.Core.Providers
|
||||||
private readonly HistoryService _historyService;
|
private readonly HistoryService _historyService;
|
||||||
private readonly IEpisodeService _episodeService;
|
private readonly IEpisodeService _episodeService;
|
||||||
private readonly ExternalNotificationProvider _externalNotificationProvider;
|
private readonly ExternalNotificationProvider _externalNotificationProvider;
|
||||||
private readonly ConfigProvider _configProvider;
|
private readonly IConfigService _configService;
|
||||||
private readonly BlackholeProvider _blackholeProvider;
|
private readonly BlackholeProvider _blackholeProvider;
|
||||||
private readonly SignalRProvider _signalRProvider;
|
private readonly SignalRProvider _signalRProvider;
|
||||||
private readonly PneumaticProvider _pneumaticProvider;
|
private readonly PneumaticProvider _pneumaticProvider;
|
||||||
|
@ -27,7 +28,7 @@ namespace NzbDrone.Core.Providers
|
||||||
|
|
||||||
public DownloadProvider(SabProvider sabProvider, HistoryService historyService,
|
public DownloadProvider(SabProvider sabProvider, HistoryService historyService,
|
||||||
IEpisodeService episodeService, ExternalNotificationProvider externalNotificationProvider,
|
IEpisodeService episodeService, ExternalNotificationProvider externalNotificationProvider,
|
||||||
ConfigProvider configProvider, BlackholeProvider blackholeProvider,
|
IConfigService configService, BlackholeProvider blackholeProvider,
|
||||||
SignalRProvider signalRProvider, PneumaticProvider pneumaticProvider,
|
SignalRProvider signalRProvider, PneumaticProvider pneumaticProvider,
|
||||||
NzbgetProvider nzbgetProvider)
|
NzbgetProvider nzbgetProvider)
|
||||||
{
|
{
|
||||||
|
@ -35,7 +36,7 @@ namespace NzbDrone.Core.Providers
|
||||||
_historyService = historyService;
|
_historyService = historyService;
|
||||||
_episodeService = episodeService;
|
_episodeService = episodeService;
|
||||||
_externalNotificationProvider = externalNotificationProvider;
|
_externalNotificationProvider = externalNotificationProvider;
|
||||||
_configProvider = configProvider;
|
_configService = configService;
|
||||||
_blackholeProvider = blackholeProvider;
|
_blackholeProvider = blackholeProvider;
|
||||||
_signalRProvider = signalRProvider;
|
_signalRProvider = signalRProvider;
|
||||||
_pneumaticProvider = pneumaticProvider;
|
_pneumaticProvider = pneumaticProvider;
|
||||||
|
@ -85,7 +86,7 @@ namespace NzbDrone.Core.Providers
|
||||||
|
|
||||||
public virtual IDownloadClient GetActiveDownloadClient()
|
public virtual IDownloadClient GetActiveDownloadClient()
|
||||||
{
|
{
|
||||||
switch (_configProvider.DownloadClient)
|
switch (_configService.DownloadClient)
|
||||||
{
|
{
|
||||||
case DownloadClientType.Blackhole:
|
case DownloadClientType.Blackhole:
|
||||||
return _blackholeProvider;
|
return _blackholeProvider;
|
||||||
|
@ -103,7 +104,7 @@ namespace NzbDrone.Core.Providers
|
||||||
|
|
||||||
public virtual String GetDownloadTitle(EpisodeParseResult parseResult)
|
public virtual String GetDownloadTitle(EpisodeParseResult parseResult)
|
||||||
{
|
{
|
||||||
if(_configProvider.DownloadClientUseSceneName)
|
if(_configService.DownloadClientUseSceneName)
|
||||||
{
|
{
|
||||||
logger.Trace("Using scene name: {0}", parseResult.OriginalString);
|
logger.Trace("Using scene name: {0}", parseResult.OriginalString);
|
||||||
return parseResult.OriginalString;
|
return parseResult.OriginalString;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using NLog;
|
using NLog;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
using NzbDrone.Core.Repository;
|
using NzbDrone.Core.Repository;
|
||||||
|
@ -8,11 +9,11 @@ namespace NzbDrone.Core.Providers.ExternalNotification
|
||||||
public abstract class ExternalNotificationBase
|
public abstract class ExternalNotificationBase
|
||||||
{
|
{
|
||||||
protected readonly Logger _logger;
|
protected readonly Logger _logger;
|
||||||
protected readonly ConfigProvider _configProvider;
|
protected readonly IConfigService _configService;
|
||||||
|
|
||||||
protected ExternalNotificationBase(ConfigProvider configProvider)
|
protected ExternalNotificationBase(IConfigService configService)
|
||||||
{
|
{
|
||||||
_configProvider = configProvider;
|
_configService = configService;
|
||||||
_logger = LogManager.GetLogger(GetType().ToString());
|
_logger = LogManager.GetLogger(GetType().ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using NLog;
|
using NLog;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
using NzbDrone.Core.Repository;
|
using NzbDrone.Core.Repository;
|
||||||
|
@ -10,8 +11,8 @@ namespace NzbDrone.Core.Providers.ExternalNotification
|
||||||
{
|
{
|
||||||
private readonly GrowlProvider _growlProvider;
|
private readonly GrowlProvider _growlProvider;
|
||||||
|
|
||||||
public Growl(ConfigProvider configProvider, GrowlProvider growlProvider)
|
public Growl(IConfigService configService, GrowlProvider growlProvider)
|
||||||
: base(configProvider)
|
: base(configService)
|
||||||
{
|
{
|
||||||
_growlProvider = growlProvider;
|
_growlProvider = growlProvider;
|
||||||
}
|
}
|
||||||
|
@ -25,16 +26,16 @@ namespace NzbDrone.Core.Providers.ExternalNotification
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if(_configProvider.GrowlNotifyOnGrab)
|
if(_configService.GrowlNotifyOnGrab)
|
||||||
{
|
{
|
||||||
_logger.Trace("Sending Notification to Growl");
|
_logger.Trace("Sending Notification to Growl");
|
||||||
const string title = "Episode Grabbed";
|
const string title = "Episode Grabbed";
|
||||||
|
|
||||||
var growlHost = _configProvider.GrowlHost.Split(':');
|
var growlHost = _configService.GrowlHost.Split(':');
|
||||||
var host = growlHost[0];
|
var host = growlHost[0];
|
||||||
var port = Convert.ToInt32(growlHost[1]);
|
var port = Convert.ToInt32(growlHost[1]);
|
||||||
|
|
||||||
_growlProvider.SendNotification(title, message, "GRAB", host, port, _configProvider.GrowlPassword);
|
_growlProvider.SendNotification(title, message, "GRAB", host, port, _configService.GrowlPassword);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,16 +49,16 @@ namespace NzbDrone.Core.Providers.ExternalNotification
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (_configProvider.GrowlNotifyOnDownload)
|
if (_configService.GrowlNotifyOnDownload)
|
||||||
{
|
{
|
||||||
_logger.Trace("Sending Notification to Growl");
|
_logger.Trace("Sending Notification to Growl");
|
||||||
const string title = "Episode Downloaded";
|
const string title = "Episode Downloaded";
|
||||||
|
|
||||||
var growlHost = _configProvider.GrowlHost.Split(':');
|
var growlHost = _configService.GrowlHost.Split(':');
|
||||||
var host = growlHost[0];
|
var host = growlHost[0];
|
||||||
var port = Convert.ToInt32(growlHost[1]);
|
var port = Convert.ToInt32(growlHost[1]);
|
||||||
|
|
||||||
_growlProvider.SendNotification(title, message, "DOWNLOAD", host, port, _configProvider.GrowlPassword);
|
_growlProvider.SendNotification(title, message, "DOWNLOAD", host, port, _configService.GrowlPassword);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using NLog;
|
using NLog;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
using NzbDrone.Core.Repository;
|
using NzbDrone.Core.Repository;
|
||||||
|
@ -10,8 +11,8 @@ namespace NzbDrone.Core.Providers.ExternalNotification
|
||||||
{
|
{
|
||||||
private readonly PlexProvider _plexProvider;
|
private readonly PlexProvider _plexProvider;
|
||||||
|
|
||||||
public Plex(ConfigProvider configProvider, PlexProvider plexProvider)
|
public Plex(IConfigService configService, PlexProvider plexProvider)
|
||||||
: base(configProvider)
|
: base(configService)
|
||||||
{
|
{
|
||||||
_plexProvider = plexProvider;
|
_plexProvider = plexProvider;
|
||||||
}
|
}
|
||||||
|
@ -25,7 +26,7 @@ namespace NzbDrone.Core.Providers.ExternalNotification
|
||||||
{
|
{
|
||||||
const string header = "NzbDrone [TV] - Grabbed";
|
const string header = "NzbDrone [TV] - Grabbed";
|
||||||
|
|
||||||
if (_configProvider.PlexNotifyOnGrab)
|
if (_configService.PlexNotifyOnGrab)
|
||||||
{
|
{
|
||||||
_logger.Trace("Sending Notification to Plex Clients");
|
_logger.Trace("Sending Notification to Plex Clients");
|
||||||
_plexProvider.Notify(header, message);
|
_plexProvider.Notify(header, message);
|
||||||
|
@ -36,7 +37,7 @@ namespace NzbDrone.Core.Providers.ExternalNotification
|
||||||
{
|
{
|
||||||
const string header = "NzbDrone [TV] - Downloaded";
|
const string header = "NzbDrone [TV] - Downloaded";
|
||||||
|
|
||||||
if (_configProvider.PlexNotifyOnDownload)
|
if (_configService.PlexNotifyOnDownload)
|
||||||
{
|
{
|
||||||
_logger.Trace("Sending Notification to Plex Clients");
|
_logger.Trace("Sending Notification to Plex Clients");
|
||||||
_plexProvider.Notify(header, message);
|
_plexProvider.Notify(header, message);
|
||||||
|
@ -57,7 +58,7 @@ namespace NzbDrone.Core.Providers.ExternalNotification
|
||||||
|
|
||||||
private void UpdateIfEnabled()
|
private void UpdateIfEnabled()
|
||||||
{
|
{
|
||||||
if (_configProvider.PlexUpdateLibrary)
|
if (_configService.PlexUpdateLibrary)
|
||||||
{
|
{
|
||||||
_logger.Trace("Sending Update Request to Plex Server");
|
_logger.Trace("Sending Update Request to Plex Server");
|
||||||
_plexProvider.UpdateLibrary();
|
_plexProvider.UpdateLibrary();
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using NLog;
|
using NLog;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
using NzbDrone.Core.Repository;
|
using NzbDrone.Core.Repository;
|
||||||
|
@ -11,8 +12,8 @@ namespace NzbDrone.Core.Providers.ExternalNotification
|
||||||
{
|
{
|
||||||
private readonly ProwlProvider _prowlProvider;
|
private readonly ProwlProvider _prowlProvider;
|
||||||
|
|
||||||
public Prowl(ConfigProvider configProvider, ProwlProvider prowlProvider)
|
public Prowl(IConfigService configService, ProwlProvider prowlProvider)
|
||||||
: base(configProvider)
|
: base(configService)
|
||||||
{
|
{
|
||||||
_prowlProvider = prowlProvider;
|
_prowlProvider = prowlProvider;
|
||||||
}
|
}
|
||||||
|
@ -26,13 +27,13 @@ namespace NzbDrone.Core.Providers.ExternalNotification
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if(_configProvider.GrowlNotifyOnGrab)
|
if(_configService.GrowlNotifyOnGrab)
|
||||||
{
|
{
|
||||||
_logger.Trace("Sending Notification to Prowl");
|
_logger.Trace("Sending Notification to Prowl");
|
||||||
const string title = "Episode Grabbed";
|
const string title = "Episode Grabbed";
|
||||||
|
|
||||||
var apiKeys = _configProvider.ProwlApiKeys;
|
var apiKeys = _configService.ProwlApiKeys;
|
||||||
var priority = _configProvider.ProwlPriority;
|
var priority = _configService.ProwlPriority;
|
||||||
|
|
||||||
_prowlProvider.SendNotification(title, message, apiKeys, (NotificationPriority)priority);
|
_prowlProvider.SendNotification(title, message, apiKeys, (NotificationPriority)priority);
|
||||||
}
|
}
|
||||||
|
@ -48,13 +49,13 @@ namespace NzbDrone.Core.Providers.ExternalNotification
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (_configProvider.GrowlNotifyOnDownload)
|
if (_configService.GrowlNotifyOnDownload)
|
||||||
{
|
{
|
||||||
_logger.Trace("Sending Notification to Prowl");
|
_logger.Trace("Sending Notification to Prowl");
|
||||||
const string title = "Episode Downloaded";
|
const string title = "Episode Downloaded";
|
||||||
|
|
||||||
var apiKeys = _configProvider.ProwlApiKeys;
|
var apiKeys = _configService.ProwlApiKeys;
|
||||||
var priority = _configProvider.ProwlPriority;
|
var priority = _configService.ProwlPriority;
|
||||||
|
|
||||||
_prowlProvider.SendNotification(title, message, apiKeys, (NotificationPriority)priority);
|
_prowlProvider.SendNotification(title, message, apiKeys, (NotificationPriority)priority);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
using NzbDrone.Core.Repository;
|
using NzbDrone.Core.Repository;
|
||||||
|
@ -9,8 +10,8 @@ namespace NzbDrone.Core.Providers.ExternalNotification
|
||||||
{
|
{
|
||||||
private readonly SmtpProvider _smtpProvider;
|
private readonly SmtpProvider _smtpProvider;
|
||||||
|
|
||||||
public Smtp(ConfigProvider configProvider, SmtpProvider smtpProvider)
|
public Smtp(IConfigService configService, SmtpProvider smtpProvider)
|
||||||
: base(configProvider)
|
: base(configService)
|
||||||
{
|
{
|
||||||
_smtpProvider = smtpProvider;
|
_smtpProvider = smtpProvider;
|
||||||
}
|
}
|
||||||
|
@ -25,7 +26,7 @@ namespace NzbDrone.Core.Providers.ExternalNotification
|
||||||
const string subject = "NzbDrone [TV] - Grabbed";
|
const string subject = "NzbDrone [TV] - Grabbed";
|
||||||
var body = String.Format("{0} sent to SABnzbd queue.", message);
|
var body = String.Format("{0} sent to SABnzbd queue.", message);
|
||||||
|
|
||||||
if (_configProvider.SmtpNotifyOnGrab)
|
if (_configService.SmtpNotifyOnGrab)
|
||||||
{
|
{
|
||||||
_logger.Trace("Sending SMTP Notification");
|
_logger.Trace("Sending SMTP Notification");
|
||||||
_smtpProvider.SendEmail(subject, body);
|
_smtpProvider.SendEmail(subject, body);
|
||||||
|
@ -37,7 +38,7 @@ namespace NzbDrone.Core.Providers.ExternalNotification
|
||||||
const string subject = "NzbDrone [TV] - Downloaded";
|
const string subject = "NzbDrone [TV] - Downloaded";
|
||||||
var body = String.Format("{0} Downloaded and sorted.", message);
|
var body = String.Format("{0} Downloaded and sorted.", message);
|
||||||
|
|
||||||
if (_configProvider.SmtpNotifyOnDownload)
|
if (_configService.SmtpNotifyOnDownload)
|
||||||
{
|
{
|
||||||
_logger.Trace("Sending SMTP Notification");
|
_logger.Trace("Sending SMTP Notification");
|
||||||
_smtpProvider.SendEmail(subject, body);
|
_smtpProvider.SendEmail(subject, body);
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
using NzbDrone.Core.Repository;
|
using NzbDrone.Core.Repository;
|
||||||
|
@ -9,8 +10,8 @@ namespace NzbDrone.Core.Providers.ExternalNotification
|
||||||
{
|
{
|
||||||
private readonly TwitterProvider _twitterProvider;
|
private readonly TwitterProvider _twitterProvider;
|
||||||
|
|
||||||
public Twitter(ConfigProvider configProvider, TwitterProvider twitterProvider)
|
public Twitter(IConfigService configService, TwitterProvider twitterProvider)
|
||||||
: base(configProvider)
|
: base(configService)
|
||||||
{
|
{
|
||||||
_twitterProvider = twitterProvider;
|
_twitterProvider = twitterProvider;
|
||||||
}
|
}
|
||||||
|
@ -22,7 +23,7 @@ namespace NzbDrone.Core.Providers.ExternalNotification
|
||||||
|
|
||||||
public override void OnGrab(string message)
|
public override void OnGrab(string message)
|
||||||
{
|
{
|
||||||
if (_configProvider.TwitterNotifyOnGrab)
|
if (_configService.TwitterNotifyOnGrab)
|
||||||
{
|
{
|
||||||
_logger.Trace("Sending Notification to Twitter (On Grab)");
|
_logger.Trace("Sending Notification to Twitter (On Grab)");
|
||||||
_twitterProvider.SendTweet("Download Started: " + message);
|
_twitterProvider.SendTweet("Download Started: " + message);
|
||||||
|
@ -31,7 +32,7 @@ namespace NzbDrone.Core.Providers.ExternalNotification
|
||||||
|
|
||||||
public override void OnDownload(string message, Series series)
|
public override void OnDownload(string message, Series series)
|
||||||
{
|
{
|
||||||
if (_configProvider.TwitterNotifyOnDownload)
|
if (_configService.TwitterNotifyOnDownload)
|
||||||
{
|
{
|
||||||
_logger.Trace("Sending Notification to Twitter (On Grab)");
|
_logger.Trace("Sending Notification to Twitter (On Grab)");
|
||||||
_twitterProvider.SendTweet("Download Completed: " + message);
|
_twitterProvider.SendTweet("Download Completed: " + message);
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
using NzbDrone.Core.Repository;
|
using NzbDrone.Core.Repository;
|
||||||
|
@ -9,8 +10,8 @@ namespace NzbDrone.Core.Providers.ExternalNotification
|
||||||
{
|
{
|
||||||
private readonly XbmcProvider _xbmcProvider;
|
private readonly XbmcProvider _xbmcProvider;
|
||||||
|
|
||||||
public Xbmc(ConfigProvider configProvider, XbmcProvider xbmcProvider)
|
public Xbmc(IConfigService configService, XbmcProvider xbmcProvider)
|
||||||
: base(configProvider)
|
: base(configService)
|
||||||
{
|
{
|
||||||
_xbmcProvider = xbmcProvider;
|
_xbmcProvider = xbmcProvider;
|
||||||
}
|
}
|
||||||
|
@ -24,7 +25,7 @@ namespace NzbDrone.Core.Providers.ExternalNotification
|
||||||
{
|
{
|
||||||
const string header = "NzbDrone [TV] - Grabbed";
|
const string header = "NzbDrone [TV] - Grabbed";
|
||||||
|
|
||||||
if (_configProvider.XbmcNotifyOnGrab)
|
if (_configService.XbmcNotifyOnGrab)
|
||||||
{
|
{
|
||||||
_logger.Trace("Sending Notification to XBMC");
|
_logger.Trace("Sending Notification to XBMC");
|
||||||
_xbmcProvider.Notify(header, message);
|
_xbmcProvider.Notify(header, message);
|
||||||
|
@ -35,7 +36,7 @@ namespace NzbDrone.Core.Providers.ExternalNotification
|
||||||
{
|
{
|
||||||
const string header = "NzbDrone [TV] - Downloaded";
|
const string header = "NzbDrone [TV] - Downloaded";
|
||||||
|
|
||||||
if (_configProvider.XbmcNotifyOnDownload)
|
if (_configService.XbmcNotifyOnDownload)
|
||||||
{
|
{
|
||||||
_logger.Trace("Sending Notification to XBMC");
|
_logger.Trace("Sending Notification to XBMC");
|
||||||
_xbmcProvider.Notify(header, message);
|
_xbmcProvider.Notify(header, message);
|
||||||
|
@ -56,13 +57,13 @@ namespace NzbDrone.Core.Providers.ExternalNotification
|
||||||
|
|
||||||
private void UpdateAndClean(Series series)
|
private void UpdateAndClean(Series series)
|
||||||
{
|
{
|
||||||
if (_configProvider.XbmcUpdateLibrary)
|
if (_configService.XbmcUpdateLibrary)
|
||||||
{
|
{
|
||||||
_logger.Trace("Sending Update Request to XBMC");
|
_logger.Trace("Sending Update Request to XBMC");
|
||||||
_xbmcProvider.Update(series);
|
_xbmcProvider.Update(series);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_configProvider.XbmcCleanLibrary)
|
if (_configService.XbmcCleanLibrary)
|
||||||
{
|
{
|
||||||
_logger.Trace("Sending Clean DB Request to XBMC");
|
_logger.Trace("Sending Clean DB Request to XBMC");
|
||||||
_xbmcProvider.Clean();
|
_xbmcProvider.Clean();
|
||||||
|
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
using NzbDrone.Core.Helpers;
|
using NzbDrone.Core.Helpers;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
|
@ -16,14 +17,14 @@ namespace NzbDrone.Core.Providers
|
||||||
public class MediaFileProvider
|
public class MediaFileProvider
|
||||||
{
|
{
|
||||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||||
private readonly ConfigProvider _configProvider;
|
private readonly IConfigService _configService;
|
||||||
private readonly IDatabase _database;
|
private readonly IDatabase _database;
|
||||||
private readonly IEpisodeService _episodeService;
|
private readonly IEpisodeService _episodeService;
|
||||||
|
|
||||||
public MediaFileProvider(IEpisodeService episodeService, ConfigProvider configProvider, IDatabase database)
|
public MediaFileProvider(IEpisodeService episodeService, IConfigService configService, IDatabase database)
|
||||||
{
|
{
|
||||||
_episodeService = episodeService;
|
_episodeService = episodeService;
|
||||||
_configProvider = configProvider;
|
_configService = configService;
|
||||||
_database = database;
|
_database = database;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +92,7 @@ namespace NzbDrone.Core.Providers
|
||||||
string path = series.Path;
|
string path = series.Path;
|
||||||
if (series.SeasonFolder)
|
if (series.SeasonFolder)
|
||||||
{
|
{
|
||||||
var seasonFolder = _configProvider.SortingSeasonFolderFormat
|
var seasonFolder = _configService.SortingSeasonFolderFormat
|
||||||
.Replace("%0s", seasonNumber.ToString("00"))
|
.Replace("%0s", seasonNumber.ToString("00"))
|
||||||
.Replace("%s", seasonNumber.ToString());
|
.Replace("%s", seasonNumber.ToString());
|
||||||
|
|
||||||
|
@ -109,7 +110,7 @@ namespace NzbDrone.Core.Providers
|
||||||
|
|
||||||
string updateString = "UPDATE Episodes SET EpisodeFileId = 0, GrabDate = NULL, PostDownloadStatus = 0";
|
string updateString = "UPDATE Episodes SET EpisodeFileId = 0, GrabDate = NULL, PostDownloadStatus = 0";
|
||||||
|
|
||||||
if (_configProvider.AutoIgnorePreviouslyDownloadedEpisodes)
|
if (_configService.AutoIgnorePreviouslyDownloadedEpisodes)
|
||||||
{
|
{
|
||||||
updateString += ", Ignored = 1";
|
updateString += ", Ignored = 1";
|
||||||
}
|
}
|
||||||
|
@ -143,7 +144,7 @@ namespace NzbDrone.Core.Providers
|
||||||
|
|
||||||
public virtual string GetNewFilename(IList<Episode> episodes, Series series, QualityTypes quality, bool proper, EpisodeFile episodeFile)
|
public virtual string GetNewFilename(IList<Episode> episodes, Series series, QualityTypes quality, bool proper, EpisodeFile episodeFile)
|
||||||
{
|
{
|
||||||
if (_configProvider.SortingUseSceneName)
|
if (_configService.SortingUseSceneName)
|
||||||
{
|
{
|
||||||
Logger.Trace("Attempting to use scene name");
|
Logger.Trace("Attempting to use scene name");
|
||||||
if (String.IsNullOrWhiteSpace(episodeFile.SceneName))
|
if (String.IsNullOrWhiteSpace(episodeFile.SceneName))
|
||||||
|
@ -159,8 +160,8 @@ namespace NzbDrone.Core.Providers
|
||||||
|
|
||||||
var sortedEpisodes = episodes.OrderBy(e => e.EpisodeNumber);
|
var sortedEpisodes = episodes.OrderBy(e => e.EpisodeNumber);
|
||||||
|
|
||||||
var separatorStyle = EpisodeSortingHelper.GetSeparatorStyle(_configProvider.SortingSeparatorStyle);
|
var separatorStyle = EpisodeSortingHelper.GetSeparatorStyle(_configService.SortingSeparatorStyle);
|
||||||
var numberStyle = EpisodeSortingHelper.GetNumberStyle(_configProvider.SortingNumberStyle);
|
var numberStyle = EpisodeSortingHelper.GetNumberStyle(_configService.SortingNumberStyle);
|
||||||
|
|
||||||
var episodeNames = new List<String>();
|
var episodeNames = new List<String>();
|
||||||
|
|
||||||
|
@ -168,7 +169,7 @@ namespace NzbDrone.Core.Providers
|
||||||
|
|
||||||
string result = String.Empty;
|
string result = String.Empty;
|
||||||
|
|
||||||
if (_configProvider.SortingIncludeSeriesName)
|
if (_configService.SortingIncludeSeriesName)
|
||||||
{
|
{
|
||||||
result += series.Title + separatorStyle.Pattern;
|
result += series.Title + separatorStyle.Pattern;
|
||||||
}
|
}
|
||||||
|
@ -181,7 +182,7 @@ namespace NzbDrone.Core.Providers
|
||||||
if(episodes.Count > 1)
|
if(episodes.Count > 1)
|
||||||
{
|
{
|
||||||
var multiEpisodeStyle =
|
var multiEpisodeStyle =
|
||||||
EpisodeSortingHelper.GetMultiEpisodeStyle(_configProvider.SortingMultiEpisodeStyle);
|
EpisodeSortingHelper.GetMultiEpisodeStyle(_configService.SortingMultiEpisodeStyle);
|
||||||
|
|
||||||
foreach(var episode in sortedEpisodes.Skip(1))
|
foreach(var episode in sortedEpisodes.Skip(1))
|
||||||
{
|
{
|
||||||
|
@ -215,7 +216,7 @@ namespace NzbDrone.Core.Providers
|
||||||
result += "Unknown";
|
result += "Unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_configProvider.SortingIncludeEpisodeTitle)
|
if (_configService.SortingIncludeEpisodeTitle)
|
||||||
{
|
{
|
||||||
if (episodeNames.Distinct().Count() == 1)
|
if (episodeNames.Distinct().Count() == 1)
|
||||||
result += separatorStyle.Pattern + episodeNames.First();
|
result += separatorStyle.Pattern + episodeNames.First();
|
||||||
|
@ -224,7 +225,7 @@ namespace NzbDrone.Core.Providers
|
||||||
result += separatorStyle.Pattern + String.Join(" + ", episodeNames.Distinct());
|
result += separatorStyle.Pattern + String.Join(" + ", episodeNames.Distinct());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_configProvider.SortingAppendQuality)
|
if (_configService.SortingAppendQuality)
|
||||||
{
|
{
|
||||||
result += String.Format(" [{0}]", quality);
|
result += String.Format(" [{0}]", quality);
|
||||||
|
|
||||||
|
@ -232,7 +233,7 @@ namespace NzbDrone.Core.Providers
|
||||||
result += " [Proper]";
|
result += " [Proper]";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_configProvider.SortingReplaceSpaces)
|
if (_configService.SortingReplaceSpaces)
|
||||||
result = result.Replace(' ', '.');
|
result = result.Replace(' ', '.');
|
||||||
|
|
||||||
Logger.Trace("New File Name is: [{0}]", result.Trim());
|
Logger.Trace("New File Name is: [{0}]", result.Trim());
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
|
@ -12,15 +13,15 @@ namespace NzbDrone.Core.Providers.Metadata
|
||||||
public abstract class MetadataBase
|
public abstract class MetadataBase
|
||||||
{
|
{
|
||||||
protected readonly Logger _logger;
|
protected readonly Logger _logger;
|
||||||
protected readonly ConfigProvider _configProvider;
|
protected readonly IConfigService _configService;
|
||||||
protected readonly DiskProvider _diskProvider;
|
protected readonly DiskProvider _diskProvider;
|
||||||
protected readonly BannerProvider _bannerProvider;
|
protected readonly BannerProvider _bannerProvider;
|
||||||
protected readonly IEpisodeService _episodeService;
|
protected readonly IEpisodeService _episodeService;
|
||||||
|
|
||||||
protected MetadataBase(ConfigProvider configProvider, DiskProvider diskProvider,
|
protected MetadataBase(IConfigService configService, DiskProvider diskProvider,
|
||||||
BannerProvider bannerProvider, IEpisodeService episodeService)
|
BannerProvider bannerProvider, IEpisodeService episodeService)
|
||||||
{
|
{
|
||||||
_configProvider = configProvider;
|
_configService = configService;
|
||||||
_diskProvider = diskProvider;
|
_diskProvider = diskProvider;
|
||||||
_bannerProvider = bannerProvider;
|
_bannerProvider = bannerProvider;
|
||||||
_episodeService = episodeService;
|
_episodeService = episodeService;
|
||||||
|
|
|
@ -5,6 +5,7 @@ using System.Text;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
|
@ -16,9 +17,9 @@ namespace NzbDrone.Core.Providers.Metadata
|
||||||
{
|
{
|
||||||
public class Xbmc : MetadataBase
|
public class Xbmc : MetadataBase
|
||||||
{
|
{
|
||||||
public Xbmc(ConfigProvider configProvider, DiskProvider diskProvider,
|
public Xbmc(IConfigService configService, DiskProvider diskProvider,
|
||||||
BannerProvider bannerProvider, IEpisodeService episodeService)
|
BannerProvider bannerProvider, IEpisodeService episodeService)
|
||||||
: base(configProvider, diskProvider, bannerProvider, episodeService)
|
: base(configService, diskProvider, bannerProvider, episodeService)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +85,7 @@ namespace NzbDrone.Core.Providers.Metadata
|
||||||
|
|
||||||
if (!_diskProvider.FileExists(Path.Combine(series.Path, "folder.jpg")))
|
if (!_diskProvider.FileExists(Path.Combine(series.Path, "folder.jpg")))
|
||||||
{
|
{
|
||||||
if(_configProvider.MetadataUseBanners)
|
if(_configService.MetadataUseBanners)
|
||||||
{
|
{
|
||||||
if(!String.IsNullOrWhiteSpace(tvDbSeries.BannerPath))
|
if(!String.IsNullOrWhiteSpace(tvDbSeries.BannerPath))
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,6 +6,7 @@ using System.Text;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Providers
|
namespace NzbDrone.Core.Providers
|
||||||
|
@ -13,13 +14,13 @@ namespace NzbDrone.Core.Providers
|
||||||
public class PlexProvider
|
public class PlexProvider
|
||||||
{
|
{
|
||||||
private readonly HttpProvider _httpProvider;
|
private readonly HttpProvider _httpProvider;
|
||||||
private readonly ConfigProvider _configProvider;
|
private readonly IConfigService _configService;
|
||||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
public PlexProvider(HttpProvider httpProvider, ConfigProvider configProvider)
|
public PlexProvider(HttpProvider httpProvider, IConfigService configService)
|
||||||
{
|
{
|
||||||
_httpProvider = httpProvider;
|
_httpProvider = httpProvider;
|
||||||
_configProvider = configProvider;
|
_configService = configService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlexProvider()
|
public PlexProvider()
|
||||||
|
@ -30,12 +31,12 @@ namespace NzbDrone.Core.Providers
|
||||||
public virtual void Notify(string header, string message)
|
public virtual void Notify(string header, string message)
|
||||||
{
|
{
|
||||||
//Foreach plex client send a notification
|
//Foreach plex client send a notification
|
||||||
foreach(var host in _configProvider.PlexClientHosts.Split(','))
|
foreach(var host in _configService.PlexClientHosts.Split(','))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var command = String.Format("ExecBuiltIn(Notification({0}, {1}))", header, message);
|
var command = String.Format("ExecBuiltIn(Notification({0}, {1}))", header, message);
|
||||||
SendCommand(host.Trim(), command, _configProvider.PlexUsername, _configProvider.PlexPassword);
|
SendCommand(host.Trim(), command, _configService.PlexUsername, _configService.PlexPassword);
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -46,7 +47,7 @@ namespace NzbDrone.Core.Providers
|
||||||
|
|
||||||
public virtual void UpdateLibrary()
|
public virtual void UpdateLibrary()
|
||||||
{
|
{
|
||||||
var host = _configProvider.PlexServerHost;
|
var host = _configService.PlexServerHost;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -98,7 +99,7 @@ namespace NzbDrone.Core.Providers
|
||||||
{
|
{
|
||||||
logger.Trace("Sending Test Notifcation to XBMC Host: {0}", host);
|
logger.Trace("Sending Test Notifcation to XBMC Host: {0}", host);
|
||||||
var command = String.Format("ExecBuiltIn(Notification({0}, {1}))", "Test Notification", "Success! Notifications are setup correctly");
|
var command = String.Format("ExecBuiltIn(Notification({0}, {1}))", "Test Notification", "Success! Notifications are setup correctly");
|
||||||
SendCommand(host.Trim(), command, _configProvider.PlexUsername, _configProvider.PlexPassword);
|
SendCommand(host.Trim(), command, _configService.PlexUsername, _configService.PlexPassword);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Providers
|
namespace NzbDrone.Core.Providers
|
||||||
|
@ -12,14 +13,14 @@ namespace NzbDrone.Core.Providers
|
||||||
public class RecycleBinProvider
|
public class RecycleBinProvider
|
||||||
{
|
{
|
||||||
private readonly DiskProvider _diskProvider;
|
private readonly DiskProvider _diskProvider;
|
||||||
private readonly ConfigProvider _configProvider;
|
private readonly IConfigService _configService;
|
||||||
|
|
||||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
public RecycleBinProvider(DiskProvider diskProvider, ConfigProvider configProvider)
|
public RecycleBinProvider(DiskProvider diskProvider, IConfigService configService)
|
||||||
{
|
{
|
||||||
_diskProvider = diskProvider;
|
_diskProvider = diskProvider;
|
||||||
_configProvider = configProvider;
|
_configService = configService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RecycleBinProvider()
|
public RecycleBinProvider()
|
||||||
|
@ -29,7 +30,7 @@ namespace NzbDrone.Core.Providers
|
||||||
public virtual void DeleteDirectory(string path)
|
public virtual void DeleteDirectory(string path)
|
||||||
{
|
{
|
||||||
logger.Trace("Attempting to send '{0}' to recycling bin", path);
|
logger.Trace("Attempting to send '{0}' to recycling bin", path);
|
||||||
var recyclingBin = _configProvider.RecycleBin;
|
var recyclingBin = _configService.RecycleBin;
|
||||||
|
|
||||||
if (String.IsNullOrWhiteSpace(recyclingBin))
|
if (String.IsNullOrWhiteSpace(recyclingBin))
|
||||||
{
|
{
|
||||||
|
@ -59,7 +60,7 @@ namespace NzbDrone.Core.Providers
|
||||||
public virtual void DeleteFile(string path)
|
public virtual void DeleteFile(string path)
|
||||||
{
|
{
|
||||||
logger.Trace("Attempting to send '{0}' to recycling bin", path);
|
logger.Trace("Attempting to send '{0}' to recycling bin", path);
|
||||||
var recyclingBin = _configProvider.RecycleBin;
|
var recyclingBin = _configService.RecycleBin;
|
||||||
|
|
||||||
if (String.IsNullOrWhiteSpace(recyclingBin))
|
if (String.IsNullOrWhiteSpace(recyclingBin))
|
||||||
{
|
{
|
||||||
|
@ -81,7 +82,7 @@ namespace NzbDrone.Core.Providers
|
||||||
|
|
||||||
public virtual void Empty()
|
public virtual void Empty()
|
||||||
{
|
{
|
||||||
if (String.IsNullOrWhiteSpace(_configProvider.RecycleBin))
|
if (String.IsNullOrWhiteSpace(_configService.RecycleBin))
|
||||||
{
|
{
|
||||||
logger.Info("Recycle Bin has not been configured, cannot empty.");
|
logger.Info("Recycle Bin has not been configured, cannot empty.");
|
||||||
return;
|
return;
|
||||||
|
@ -89,12 +90,12 @@ namespace NzbDrone.Core.Providers
|
||||||
|
|
||||||
logger.Info("Removing all items from the recycling bin");
|
logger.Info("Removing all items from the recycling bin");
|
||||||
|
|
||||||
foreach (var folder in _diskProvider.GetDirectories(_configProvider.RecycleBin))
|
foreach (var folder in _diskProvider.GetDirectories(_configService.RecycleBin))
|
||||||
{
|
{
|
||||||
_diskProvider.DeleteFolder(folder, true);
|
_diskProvider.DeleteFolder(folder, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var file in _diskProvider.GetFiles(_configProvider.RecycleBin, SearchOption.TopDirectoryOnly))
|
foreach (var file in _diskProvider.GetFiles(_configService.RecycleBin, SearchOption.TopDirectoryOnly))
|
||||||
{
|
{
|
||||||
_diskProvider.DeleteFile(file);
|
_diskProvider.DeleteFile(file);
|
||||||
}
|
}
|
||||||
|
@ -104,7 +105,7 @@ namespace NzbDrone.Core.Providers
|
||||||
|
|
||||||
public virtual void Cleanup()
|
public virtual void Cleanup()
|
||||||
{
|
{
|
||||||
if (String.IsNullOrWhiteSpace(_configProvider.RecycleBin))
|
if (String.IsNullOrWhiteSpace(_configService.RecycleBin))
|
||||||
{
|
{
|
||||||
logger.Info("Recycle Bin has not been configured, cannot cleanup.");
|
logger.Info("Recycle Bin has not been configured, cannot cleanup.");
|
||||||
return;
|
return;
|
||||||
|
@ -112,7 +113,7 @@ namespace NzbDrone.Core.Providers
|
||||||
|
|
||||||
logger.Info("Removing items older than 7 days from the recycling bin");
|
logger.Info("Removing items older than 7 days from the recycling bin");
|
||||||
|
|
||||||
foreach (var folder in _diskProvider.GetDirectories(_configProvider.RecycleBin))
|
foreach (var folder in _diskProvider.GetDirectories(_configService.RecycleBin))
|
||||||
{
|
{
|
||||||
if (_diskProvider.GetLastDirectoryWrite(folder).AddDays(7) > DateTime.UtcNow)
|
if (_diskProvider.GetLastDirectoryWrite(folder).AddDays(7) > DateTime.UtcNow)
|
||||||
{
|
{
|
||||||
|
@ -123,7 +124,7 @@ namespace NzbDrone.Core.Providers
|
||||||
_diskProvider.DeleteFolder(folder, true);
|
_diskProvider.DeleteFolder(folder, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var file in _diskProvider.GetFiles(_configProvider.RecycleBin, SearchOption.TopDirectoryOnly))
|
foreach (var file in _diskProvider.GetFiles(_configService.RecycleBin, SearchOption.TopDirectoryOnly))
|
||||||
{
|
{
|
||||||
if (_diskProvider.GetLastFileWrite(file).AddDays(7) > DateTime.UtcNow)
|
if (_diskProvider.GetLastFileWrite(file).AddDays(7) > DateTime.UtcNow)
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,6 +6,7 @@ using System.Text;
|
||||||
using NLog;
|
using NLog;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
using NzbDrone.Core.Repository;
|
using NzbDrone.Core.Repository;
|
||||||
using PetaPoco;
|
using PetaPoco;
|
||||||
|
@ -16,15 +17,15 @@ namespace NzbDrone.Core.Providers
|
||||||
{
|
{
|
||||||
private readonly IDatabase _database;
|
private readonly IDatabase _database;
|
||||||
private readonly HttpProvider _httpProvider;
|
private readonly HttpProvider _httpProvider;
|
||||||
private readonly ConfigProvider _configProvider;
|
private readonly IConfigService _configService;
|
||||||
|
|
||||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
public ReferenceDataProvider(IDatabase database, HttpProvider httpProvider, ConfigProvider configProvider)
|
public ReferenceDataProvider(IDatabase database, HttpProvider httpProvider, IConfigService configService)
|
||||||
{
|
{
|
||||||
_database = database;
|
_database = database;
|
||||||
_httpProvider = httpProvider;
|
_httpProvider = httpProvider;
|
||||||
_configProvider = configProvider;
|
_configService = configService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void UpdateDailySeries()
|
public virtual void UpdateDailySeries()
|
||||||
|
@ -52,7 +53,7 @@ namespace NzbDrone.Core.Providers
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var dailySeriesIds = _httpProvider.DownloadString(_configProvider.ServiceRootUrl + "/DailySeries/AllIds");
|
var dailySeriesIds = _httpProvider.DownloadString(_configService.ServiceRootUrl + "/DailySeries/AllIds");
|
||||||
|
|
||||||
var seriesIds = JsonConvert.DeserializeObject<List<int>>(dailySeriesIds);
|
var seriesIds = JsonConvert.DeserializeObject<List<int>>(dailySeriesIds);
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ using System.IO;
|
||||||
using NLog;
|
using NLog;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
using NzbDrone.Core.Repository;
|
using NzbDrone.Core.Repository;
|
||||||
using PetaPoco;
|
using PetaPoco;
|
||||||
|
@ -15,13 +16,13 @@ namespace NzbDrone.Core.Providers
|
||||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||||
private readonly IDatabase _database;
|
private readonly IDatabase _database;
|
||||||
private readonly HttpProvider _httpProvider;
|
private readonly HttpProvider _httpProvider;
|
||||||
private readonly ConfigProvider _configProvider;
|
private readonly IConfigService _configService;
|
||||||
|
|
||||||
public SceneMappingProvider(IDatabase database, HttpProvider httpProvider, ConfigProvider configProvider)
|
public SceneMappingProvider(IDatabase database, HttpProvider httpProvider, IConfigService configService)
|
||||||
{
|
{
|
||||||
_database = database;
|
_database = database;
|
||||||
_httpProvider = httpProvider;
|
_httpProvider = httpProvider;
|
||||||
_configProvider = configProvider;
|
_configService = configService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SceneMappingProvider()
|
public SceneMappingProvider()
|
||||||
|
@ -33,7 +34,7 @@ namespace NzbDrone.Core.Providers
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var mappingsJson = _httpProvider.DownloadString(_configProvider.ServiceRootUrl + "/SceneMapping/Active");
|
var mappingsJson = _httpProvider.DownloadString(_configService.ServiceRootUrl + "/SceneMapping/Active");
|
||||||
var mappings = JsonConvert.DeserializeObject<List<SceneMapping>>(mappingsJson);
|
var mappings = JsonConvert.DeserializeObject<List<SceneMapping>>(mappingsJson);
|
||||||
|
|
||||||
Logger.Debug("Deleting all existing Scene Mappings.");
|
Logger.Debug("Deleting all existing Scene Mappings.");
|
||||||
|
@ -92,7 +93,7 @@ namespace NzbDrone.Core.Providers
|
||||||
Logger.Trace("Example post parsed. CleanTitle: {0}, Title: {1}", cleanTitle, title);
|
Logger.Trace("Example post parsed. CleanTitle: {0}, Title: {1}", cleanTitle, title);
|
||||||
|
|
||||||
var newMapping = String.Format("/SceneMapping/AddPending?cleanTitle={0}&id={1}&title={2}", cleanTitle, id, title);
|
var newMapping = String.Format("/SceneMapping/AddPending?cleanTitle={0}&id={1}&title={2}", cleanTitle, id, title);
|
||||||
var response = _httpProvider.DownloadString(_configProvider.ServiceRootUrl + newMapping);
|
var response = _httpProvider.DownloadString(_configService.ServiceRootUrl + newMapping);
|
||||||
|
|
||||||
if (JsonConvert.DeserializeObject<String>(response).Equals("Ok"))
|
if (JsonConvert.DeserializeObject<String>(response).Equals("Ok"))
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -5,6 +5,7 @@ using System.Net;
|
||||||
using System.Net.Mail;
|
using System.Net.Mail;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using NLog;
|
using NLog;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Providers
|
namespace NzbDrone.Core.Providers
|
||||||
|
@ -12,11 +13,11 @@ namespace NzbDrone.Core.Providers
|
||||||
public class SmtpProvider
|
public class SmtpProvider
|
||||||
{
|
{
|
||||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||||
private readonly ConfigProvider _configProvider;
|
private readonly IConfigService _configService;
|
||||||
|
|
||||||
public SmtpProvider(ConfigProvider configProvider)
|
public SmtpProvider(IConfigService configService)
|
||||||
{
|
{
|
||||||
_configProvider = configProvider;
|
_configService = configService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void SendEmail(string subject, string body, bool htmlBody = false)
|
public virtual void SendEmail(string subject, string body, bool htmlBody = false)
|
||||||
|
@ -25,10 +26,10 @@ namespace NzbDrone.Core.Providers
|
||||||
var email = new MailMessage();
|
var email = new MailMessage();
|
||||||
|
|
||||||
//Set the addresses
|
//Set the addresses
|
||||||
email.From = new MailAddress(_configProvider.SmtpFromAddress);
|
email.From = new MailAddress(_configService.SmtpFromAddress);
|
||||||
|
|
||||||
//Allow multiple to addresses (split on each comma)
|
//Allow multiple to addresses (split on each comma)
|
||||||
foreach (var toAddress in _configProvider.SmtpToAddresses.Split(','))
|
foreach (var toAddress in _configService.SmtpToAddresses.Split(','))
|
||||||
{
|
{
|
||||||
email.To.Add(toAddress.Trim());
|
email.To.Add(toAddress.Trim());
|
||||||
}
|
}
|
||||||
|
@ -43,8 +44,8 @@ namespace NzbDrone.Core.Providers
|
||||||
email.IsBodyHtml = htmlBody;
|
email.IsBodyHtml = htmlBody;
|
||||||
|
|
||||||
//Handle credentials
|
//Handle credentials
|
||||||
var username = _configProvider.SmtpUsername;
|
var username = _configService.SmtpUsername;
|
||||||
var password = _configProvider.SmtpPassword;
|
var password = _configService.SmtpPassword;
|
||||||
|
|
||||||
NetworkCredential credentials = null;
|
NetworkCredential credentials = null;
|
||||||
|
|
||||||
|
@ -54,7 +55,7 @@ namespace NzbDrone.Core.Providers
|
||||||
//Send the email
|
//Send the email
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Send(email, _configProvider.SmtpServer, _configProvider.SmtpPort, _configProvider.SmtpUseSsl, credentials);
|
Send(email, _configService.SmtpServer, _configService.SmtpPort, _configService.SmtpUseSsl, credentials);
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using NLog;
|
using NLog;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
using NzbDrone.Core.Model.Twitter;
|
using NzbDrone.Core.Model.Twitter;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
|
@ -12,16 +13,16 @@ namespace NzbDrone.Core.Providers
|
||||||
{
|
{
|
||||||
public class TwitterProvider
|
public class TwitterProvider
|
||||||
{
|
{
|
||||||
private readonly ConfigProvider _configProvider;
|
private readonly IConfigService _configService;
|
||||||
|
|
||||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
private const string ConsumerKey = "umKU6jBWpFbHTuqQbW2VlQ";
|
private const string ConsumerKey = "umKU6jBWpFbHTuqQbW2VlQ";
|
||||||
private const string ConsumerSecret = "e30OXkI6qrZWS35hbUUnrQQ8J2R9XNpccQNWAVK10";
|
private const string ConsumerSecret = "e30OXkI6qrZWS35hbUUnrQQ8J2R9XNpccQNWAVK10";
|
||||||
|
|
||||||
public TwitterProvider(ConfigProvider configProvider)
|
public TwitterProvider(IConfigService configService)
|
||||||
{
|
{
|
||||||
_configProvider = configProvider;
|
_configService = configService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual TwitterAuthorizationModel GetAuthorization()
|
public virtual TwitterAuthorizationModel GetAuthorization()
|
||||||
|
@ -55,8 +56,8 @@ namespace NzbDrone.Core.Providers
|
||||||
|
|
||||||
OAuthTokenResponse accessToken = OAuthUtility.GetAccessToken(ConsumerKey, ConsumerSecret, authToken, verifier);
|
OAuthTokenResponse accessToken = OAuthUtility.GetAccessToken(ConsumerKey, ConsumerSecret, authToken, verifier);
|
||||||
|
|
||||||
_configProvider.TwitterAccessToken = accessToken.Token;
|
_configService.TwitterAccessToken = accessToken.Token;
|
||||||
_configProvider.TwitterAccessTokenSecret = accessToken.TokenSecret;
|
_configService.TwitterAccessTokenSecret = accessToken.TokenSecret;
|
||||||
|
|
||||||
//Send a tweet to test!
|
//Send a tweet to test!
|
||||||
SendTweet("I have just setup tweet notifications for NzbDrone!");
|
SendTweet("I have just setup tweet notifications for NzbDrone!");
|
||||||
|
@ -77,8 +78,8 @@ namespace NzbDrone.Core.Providers
|
||||||
{
|
{
|
||||||
Logger.Trace("Sending status update to twitter: {0}", message);
|
Logger.Trace("Sending status update to twitter: {0}", message);
|
||||||
|
|
||||||
var accessToken = _configProvider.TwitterAccessToken;
|
var accessToken = _configService.TwitterAccessToken;
|
||||||
var accessTokenSecret = _configProvider.TwitterAccessTokenSecret;
|
var accessTokenSecret = _configService.TwitterAccessTokenSecret;
|
||||||
|
|
||||||
//If the access token or access token secret are not configured, log an error and return
|
//If the access token or access token secret are not configured, log an error and return
|
||||||
if (String.IsNullOrWhiteSpace(accessToken) || String.IsNullOrWhiteSpace(accessTokenSecret))
|
if (String.IsNullOrWhiteSpace(accessToken) || String.IsNullOrWhiteSpace(accessTokenSecret))
|
||||||
|
|
|
@ -7,6 +7,7 @@ using System.Linq;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
|
|
||||||
|
@ -16,7 +17,7 @@ namespace NzbDrone.Core.Providers
|
||||||
public class UpdateProvider
|
public class UpdateProvider
|
||||||
{
|
{
|
||||||
private readonly HttpProvider _httpProvider;
|
private readonly HttpProvider _httpProvider;
|
||||||
private readonly ConfigProvider _configProvider;
|
private readonly IConfigService _configService;
|
||||||
private readonly EnvironmentProvider _environmentProvider;
|
private readonly EnvironmentProvider _environmentProvider;
|
||||||
|
|
||||||
private readonly DiskProvider _diskProvider;
|
private readonly DiskProvider _diskProvider;
|
||||||
|
@ -26,11 +27,11 @@ namespace NzbDrone.Core.Providers
|
||||||
public const string DEFAULT_UPDATE_URL = @"http://update.nzbdrone.com/_release/";
|
public const string DEFAULT_UPDATE_URL = @"http://update.nzbdrone.com/_release/";
|
||||||
|
|
||||||
|
|
||||||
public UpdateProvider(HttpProvider httpProvider, ConfigProvider configProvider,
|
public UpdateProvider(HttpProvider httpProvider, IConfigService configService,
|
||||||
EnvironmentProvider environmentProvider, DiskProvider diskProvider)
|
EnvironmentProvider environmentProvider, DiskProvider diskProvider)
|
||||||
{
|
{
|
||||||
_httpProvider = httpProvider;
|
_httpProvider = httpProvider;
|
||||||
_configProvider = configProvider;
|
_configService = configService;
|
||||||
_environmentProvider = environmentProvider;
|
_environmentProvider = environmentProvider;
|
||||||
_diskProvider = diskProvider;
|
_diskProvider = diskProvider;
|
||||||
}
|
}
|
||||||
|
@ -43,7 +44,7 @@ namespace NzbDrone.Core.Providers
|
||||||
private List<UpdatePackage> GetAvailablePackages()
|
private List<UpdatePackage> GetAvailablePackages()
|
||||||
{
|
{
|
||||||
var updateList = new List<UpdatePackage>();
|
var updateList = new List<UpdatePackage>();
|
||||||
var updateUrl = _configProvider.UpdateUrl;
|
var updateUrl = _configService.UpdateUrl;
|
||||||
var rawUpdateList = _httpProvider.DownloadString(updateUrl);
|
var rawUpdateList = _httpProvider.DownloadString(updateUrl);
|
||||||
var matches = parseRegex.Matches(rawUpdateList);
|
var matches = parseRegex.Matches(rawUpdateList);
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
using NzbDrone.Core.Model.Xbmc;
|
using NzbDrone.Core.Model.Xbmc;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
|
@ -19,13 +20,13 @@ namespace NzbDrone.Core.Providers
|
||||||
public class XbmcProvider
|
public class XbmcProvider
|
||||||
{
|
{
|
||||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||||
private readonly ConfigProvider _configProvider;
|
private readonly IConfigService _configService;
|
||||||
private readonly HttpProvider _httpProvider;
|
private readonly HttpProvider _httpProvider;
|
||||||
private readonly EventClientProvider _eventClientProvider;
|
private readonly EventClientProvider _eventClientProvider;
|
||||||
|
|
||||||
public XbmcProvider(ConfigProvider configProvider, HttpProvider httpProvider, EventClientProvider eventClientProvider)
|
public XbmcProvider(IConfigService configService, HttpProvider httpProvider, EventClientProvider eventClientProvider)
|
||||||
{
|
{
|
||||||
_configProvider = configProvider;
|
_configService = configService;
|
||||||
_httpProvider = httpProvider;
|
_httpProvider = httpProvider;
|
||||||
_eventClientProvider = eventClientProvider;
|
_eventClientProvider = eventClientProvider;
|
||||||
}
|
}
|
||||||
|
@ -38,7 +39,7 @@ namespace NzbDrone.Core.Providers
|
||||||
public virtual void Notify(string header, string message)
|
public virtual void Notify(string header, string message)
|
||||||
{
|
{
|
||||||
//Always use EventServer, until Json has real support for it
|
//Always use EventServer, until Json has real support for it
|
||||||
foreach (var host in _configProvider.XbmcHosts.Split(','))
|
foreach (var host in _configService.XbmcHosts.Split(','))
|
||||||
{
|
{
|
||||||
Logger.Trace("Sending Notifcation to XBMC Host: {0}", host);
|
Logger.Trace("Sending Notifcation to XBMC Host: {0}", host);
|
||||||
_eventClientProvider.SendNotification(header, message, IconType.Jpeg, "NzbDrone.jpg", GetHostWithoutPort(host));
|
_eventClientProvider.SendNotification(header, message, IconType.Jpeg, "NzbDrone.jpg", GetHostWithoutPort(host));
|
||||||
|
@ -50,10 +51,10 @@ namespace NzbDrone.Core.Providers
|
||||||
//Use Json for Eden/Nightly or depricated HTTP for 10.x (Dharma) to get the proper path
|
//Use Json for Eden/Nightly or depricated HTTP for 10.x (Dharma) to get the proper path
|
||||||
//Perform update with EventServer (Json currently doesn't support updating a specific path only - July 2011)
|
//Perform update with EventServer (Json currently doesn't support updating a specific path only - July 2011)
|
||||||
|
|
||||||
var username = _configProvider.XbmcUsername;
|
var username = _configService.XbmcUsername;
|
||||||
var password = _configProvider.XbmcPassword;
|
var password = _configService.XbmcPassword;
|
||||||
|
|
||||||
foreach (var host in _configProvider.XbmcHosts.Split(','))
|
foreach (var host in _configService.XbmcHosts.Split(','))
|
||||||
{
|
{
|
||||||
Logger.Trace("Determining version of XBMC Host: {0}", host);
|
Logger.Trace("Determining version of XBMC Host: {0}", host);
|
||||||
var version = GetJsonVersion(host, username, password);
|
var version = GetJsonVersion(host, username, password);
|
||||||
|
@ -62,7 +63,7 @@ namespace NzbDrone.Core.Providers
|
||||||
if (version == new XbmcVersion(2))
|
if (version == new XbmcVersion(2))
|
||||||
{
|
{
|
||||||
//Check for active player only when we should skip updates when playing
|
//Check for active player only when we should skip updates when playing
|
||||||
if (!_configProvider.XbmcUpdateWhenPlaying)
|
if (!_configService.XbmcUpdateWhenPlaying)
|
||||||
{
|
{
|
||||||
Logger.Trace("Determining if there are any active players on XBMC host: {0}", host);
|
Logger.Trace("Determining if there are any active players on XBMC host: {0}", host);
|
||||||
var activePlayers = GetActivePlayersDharma(host, username, password);
|
var activePlayers = GetActivePlayersDharma(host, username, password);
|
||||||
|
@ -82,7 +83,7 @@ namespace NzbDrone.Core.Providers
|
||||||
else if (version == new XbmcVersion(3) || version == new XbmcVersion(4))
|
else if (version == new XbmcVersion(3) || version == new XbmcVersion(4))
|
||||||
{
|
{
|
||||||
//Check for active player only when we should skip updates when playing
|
//Check for active player only when we should skip updates when playing
|
||||||
if (!_configProvider.XbmcUpdateWhenPlaying)
|
if (!_configService.XbmcUpdateWhenPlaying)
|
||||||
{
|
{
|
||||||
Logger.Trace("Determining if there are any active players on XBMC host: {0}", host);
|
Logger.Trace("Determining if there are any active players on XBMC host: {0}", host);
|
||||||
var activePlayers = GetActivePlayersEden(host, username, password);
|
var activePlayers = GetActivePlayersEden(host, username, password);
|
||||||
|
@ -101,7 +102,7 @@ namespace NzbDrone.Core.Providers
|
||||||
else if (version >= new XbmcVersion(5))
|
else if (version >= new XbmcVersion(5))
|
||||||
{
|
{
|
||||||
//Check for active player only when we should skip updates when playing
|
//Check for active player only when we should skip updates when playing
|
||||||
if (!_configProvider.XbmcUpdateWhenPlaying)
|
if (!_configService.XbmcUpdateWhenPlaying)
|
||||||
{
|
{
|
||||||
Logger.Trace("Determining if there are any active players on XBMC host: {0}", host);
|
Logger.Trace("Determining if there are any active players on XBMC host: {0}", host);
|
||||||
var activePlayers = GetActivePlayersEden(host, username, password);
|
var activePlayers = GetActivePlayersEden(host, username, password);
|
||||||
|
@ -251,7 +252,7 @@ namespace NzbDrone.Core.Providers
|
||||||
{
|
{
|
||||||
//Use EventServer, once Dharma is extinct use Json?
|
//Use EventServer, once Dharma is extinct use Json?
|
||||||
|
|
||||||
foreach (var host in _configProvider.XbmcHosts.Split(','))
|
foreach (var host in _configService.XbmcHosts.Split(','))
|
||||||
{
|
{
|
||||||
Logger.Trace("Sending DB Clean Request to XBMC Host: {0}", host);
|
Logger.Trace("Sending DB Clean Request to XBMC Host: {0}", host);
|
||||||
var command = "ExecBuiltIn(CleanLibrary(video))";
|
var command = "ExecBuiltIn(CleanLibrary(video))";
|
||||||
|
|
|
@ -0,0 +1,66 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using NLog;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Providers.Core;
|
||||||
|
using PetaPoco;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.ReferenceData
|
||||||
|
{
|
||||||
|
public class DailySeriesService
|
||||||
|
{
|
||||||
|
private readonly IDatabase _database;
|
||||||
|
private readonly HttpProvider _httpProvider;
|
||||||
|
private readonly ConfigProvider _configProvider;
|
||||||
|
|
||||||
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
|
public DailySeriesService(IDatabase database, HttpProvider httpProvider, ConfigProvider configProvider)
|
||||||
|
{
|
||||||
|
_database = database;
|
||||||
|
_httpProvider = httpProvider;
|
||||||
|
_configProvider = configProvider;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void UpdateDailySeries()
|
||||||
|
{
|
||||||
|
//Update all series in DB
|
||||||
|
//DailySeries.csv
|
||||||
|
|
||||||
|
var seriesIds = GetDailySeriesIds();
|
||||||
|
|
||||||
|
if (seriesIds.Any())
|
||||||
|
{
|
||||||
|
var dailySeriesString = String.Join(", ", seriesIds);
|
||||||
|
var sql = String.Format("UPDATE Series SET IsDaily = 1 WHERE SeriesId in ({0})", dailySeriesString);
|
||||||
|
|
||||||
|
_database.Execute(sql);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual bool IsSeriesDaily(int seriesId)
|
||||||
|
{
|
||||||
|
return GetDailySeriesIds().Contains(seriesId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<int> GetDailySeriesIds()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var dailySeriesIds = _httpProvider.DownloadString(_configProvider.ServiceRootUrl + "/DailySeries/AllIds");
|
||||||
|
|
||||||
|
var seriesIds = JsonConvert.DeserializeObject<List<int>>(dailySeriesIds);
|
||||||
|
|
||||||
|
return seriesIds;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logger.WarnException("Failed to get Daily Series", ex);
|
||||||
|
return new List<int>();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,12 +0,0 @@
|
||||||
using PetaPoco;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Repository
|
|
||||||
{
|
|
||||||
[PrimaryKey("Key", autoIncrement = false)]
|
|
||||||
public class Config
|
|
||||||
{
|
|
||||||
public string Key { get; set; }
|
|
||||||
|
|
||||||
public string Value { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -5,6 +5,7 @@ using System.Text.RegularExpressions;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.EnsureThat;
|
using NzbDrone.Common.EnsureThat;
|
||||||
using NzbDrone.Common.Eventing;
|
using NzbDrone.Common.Eventing;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
using NzbDrone.Core.Providers;
|
using NzbDrone.Core.Providers;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
|
@ -24,7 +25,7 @@ namespace NzbDrone.Core.Tv
|
||||||
public class SeriesService : ISeriesService
|
public class SeriesService : ISeriesService
|
||||||
{
|
{
|
||||||
private readonly ISeriesRepository _seriesRepository;
|
private readonly ISeriesRepository _seriesRepository;
|
||||||
private readonly ConfigProvider _configProvider;
|
private readonly IConfigService _configService;
|
||||||
private readonly TvDbProvider _tvDbProvider;
|
private readonly TvDbProvider _tvDbProvider;
|
||||||
private readonly MetadataProvider _metadataProvider;
|
private readonly MetadataProvider _metadataProvider;
|
||||||
private readonly TvRageMappingProvider _tvRageMappingProvider;
|
private readonly TvRageMappingProvider _tvRageMappingProvider;
|
||||||
|
@ -34,12 +35,12 @@ namespace NzbDrone.Core.Tv
|
||||||
|
|
||||||
private readonly SceneMappingProvider _sceneNameMappingProvider;
|
private readonly SceneMappingProvider _sceneNameMappingProvider;
|
||||||
|
|
||||||
public SeriesService(ISeriesRepository seriesRepository, ConfigProvider configProviderProvider,
|
public SeriesService(ISeriesRepository seriesRepository, ConfigService configServiceService,
|
||||||
TvDbProvider tvDbProviderProvider, SceneMappingProvider sceneNameMappingProvider, MetadataProvider metadataProvider,
|
TvDbProvider tvDbProviderProvider, SceneMappingProvider sceneNameMappingProvider, MetadataProvider metadataProvider,
|
||||||
TvRageMappingProvider tvRageMappingProvider, IEventAggregator eventAggregator)
|
TvRageMappingProvider tvRageMappingProvider, IEventAggregator eventAggregator)
|
||||||
{
|
{
|
||||||
_seriesRepository = seriesRepository;
|
_seriesRepository = seriesRepository;
|
||||||
_configProvider = configProviderProvider;
|
_configService = configServiceService;
|
||||||
_tvDbProvider = tvDbProviderProvider;
|
_tvDbProvider = tvDbProviderProvider;
|
||||||
_sceneNameMappingProvider = sceneNameMappingProvider;
|
_sceneNameMappingProvider = sceneNameMappingProvider;
|
||||||
_metadataProvider = metadataProvider;
|
_metadataProvider = metadataProvider;
|
||||||
|
@ -123,9 +124,9 @@ namespace NzbDrone.Core.Tv
|
||||||
repoSeries.QualityProfileId = qualityProfileId;
|
repoSeries.QualityProfileId = qualityProfileId;
|
||||||
repoSeries.Title = title;
|
repoSeries.Title = title;
|
||||||
if (qualityProfileId == 0)
|
if (qualityProfileId == 0)
|
||||||
repoSeries.QualityProfileId = _configProvider.DefaultQualityProfile;
|
repoSeries.QualityProfileId = _configService.DefaultQualityProfile;
|
||||||
|
|
||||||
repoSeries.SeasonFolder = _configProvider.UseSeasonFolder;
|
repoSeries.SeasonFolder = _configService.UseSeasonFolder;
|
||||||
repoSeries.BacklogSetting = BacklogSettingType.Inherit;
|
repoSeries.BacklogSetting = BacklogSettingType.Inherit;
|
||||||
|
|
||||||
if (airedAfter.HasValue)
|
if (airedAfter.HasValue)
|
||||||
|
|
Loading…
Reference in New Issue