mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-11 20:12:41 +02:00
Removed IConfigProvider, ISeasonProvider, ISyncProvider
This commit is contained in:
parent
7efbfdbb89
commit
fcf51978f9
@ -65,7 +65,7 @@ public void RefreshEpisodeInfo()
|
|||||||
public void IsNeededTrue()
|
public void IsNeededTrue()
|
||||||
{
|
{
|
||||||
//Setup
|
//Setup
|
||||||
var season = new Mock<ISeasonProvider>();
|
var season = new Mock<SeasonProvider>();
|
||||||
var series = new Mock<SeriesProvider>();
|
var series = new Mock<SeriesProvider>();
|
||||||
//var history = new Mock<IHistoryProvider>();
|
//var history = new Mock<IHistoryProvider>();
|
||||||
//var quality = new Mock<IQualityProvider>();
|
//var quality = new Mock<IQualityProvider>();
|
||||||
|
@ -31,7 +31,7 @@ public void AllIndexers()
|
|||||||
list.Add(new Indexer { IndexerName = "Test4", RssUrl = "http://www.test4.com/rss.php", Enabled = false, Order = 2 });
|
list.Add(new Indexer { IndexerName = "Test4", RssUrl = "http://www.test4.com/rss.php", Enabled = false, Order = 2 });
|
||||||
|
|
||||||
var repo = new Mock<IRepository>();
|
var repo = new Mock<IRepository>();
|
||||||
var config = new Mock<IConfigProvider>();
|
var config = new Mock<ConfigProvider>();
|
||||||
repo.Setup(r => r.All<Indexer>()).Returns(list.AsQueryable());
|
repo.Setup(r => r.All<Indexer>()).Returns(list.AsQueryable());
|
||||||
|
|
||||||
var target = new IndexerProvider(repo.Object, config.Object);
|
var target = new IndexerProvider(repo.Object, config.Object);
|
||||||
@ -59,7 +59,7 @@ public void EnabledIndexers()
|
|||||||
list.Add(new Indexer { IndexerName = "Test4", RssUrl = "http://www.test4.com/rss.php", Enabled = false, Order = 2 });
|
list.Add(new Indexer { IndexerName = "Test4", RssUrl = "http://www.test4.com/rss.php", Enabled = false, Order = 2 });
|
||||||
|
|
||||||
var repo = new Mock<IRepository>();
|
var repo = new Mock<IRepository>();
|
||||||
var config = new Mock<IConfigProvider>();
|
var config = new Mock<ConfigProvider>();
|
||||||
repo.Setup(r => r.All<Indexer>()).Returns(list.AsQueryable());
|
repo.Setup(r => r.All<Indexer>()).Returns(list.AsQueryable());
|
||||||
|
|
||||||
var target = new IndexerProvider(repo.Object, config.Object);
|
var target = new IndexerProvider(repo.Object, config.Object);
|
||||||
|
@ -42,11 +42,11 @@ public static IRepository GetEmptyRepository(bool enableLogging)
|
|||||||
return new SimpleRepository(provider, SimpleRepositoryOptions.RunMigrations);
|
return new SimpleRepository(provider, SimpleRepositoryOptions.RunMigrations);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IConfigProvider StandardConfig
|
public static ConfigProvider StandardConfig
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
var mock = new Mock<IConfigProvider>();
|
var mock = new Mock<ConfigProvider>();
|
||||||
mock.SetupGet(c => c.SeriesRoot).Returns("C:\\");
|
mock.SetupGet(c => c.SeriesRoot).Returns("C:\\");
|
||||||
return mock.Object;
|
return mock.Object;
|
||||||
}
|
}
|
||||||
|
@ -70,10 +70,10 @@ public void quality_parse(string path, object quality)
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
[Row("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD", 3, 1, 2, 3, 4, 5, 6)]
|
[Row("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD", 3, new[] { 2, 3, 4, 5, 6 })]
|
||||||
[Row("Two.and.a.Half.Me.103.104.720p.HDTV.X264-DIMENSION", 1, 3, 4)]
|
[Row("Two.and.a.Half.Me.103.104.720p.HDTV.X264-DIMENSION", 1, new[] { 3, 4 })]
|
||||||
[Row("The.Kennedys.Part.1.and.Part.2.DSR.XviD-SYS", 1, 1, 2)]
|
[Row("The.Kennedys.Part.1.and.Part.2.DSR.XviD-SYS", 1, new[] { 1, 2 })]
|
||||||
public void episode_multipart_parse(string path, int season, params int[] episodes)
|
public void episode_multipart_parse(string path, int season, int[] episodes)
|
||||||
{
|
{
|
||||||
var result = Parser.ParseEpisodeInfo(path);
|
var result = Parser.ParseEpisodeInfo(path);
|
||||||
Assert.AreEqual(season, result.SeasonNumber);
|
Assert.AreEqual(season, result.SeasonNumber);
|
||||||
|
@ -43,7 +43,7 @@ public void Download_feed_test()
|
|||||||
|
|
||||||
public class MockFeedProvider : FeedProviderBase
|
public class MockFeedProvider : FeedProviderBase
|
||||||
{
|
{
|
||||||
public MockFeedProvider(SeriesProvider seriesProvider, ISeasonProvider seasonProvider, EpisodeProvider episodeProvider, IConfigProvider configProvider, HttpProvider httpProvider)
|
public MockFeedProvider(SeriesProvider seriesProvider, SeasonProvider seasonProvider, EpisodeProvider episodeProvider, ConfigProvider configProvider, HttpProvider httpProvider)
|
||||||
: base(seriesProvider, seasonProvider, episodeProvider, configProvider, httpProvider)
|
: base(seriesProvider, seasonProvider, episodeProvider, configProvider, httpProvider)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ public void AddByUrlSuccess()
|
|||||||
|
|
||||||
var mocker = new AutoMoqer();
|
var mocker = new AutoMoqer();
|
||||||
|
|
||||||
var fakeConfig = mocker.GetMock<IConfigProvider>();
|
var fakeConfig = mocker.GetMock<ConfigProvider>();
|
||||||
fakeConfig.Setup(c => c.GetValue("SabHost", String.Empty, false))
|
fakeConfig.Setup(c => c.GetValue("SabHost", String.Empty, false))
|
||||||
.Returns(sabHost);
|
.Returns(sabHost);
|
||||||
fakeConfig.Setup(c => c.GetValue("SabPort", String.Empty, false))
|
fakeConfig.Setup(c => c.GetValue("SabPort", String.Empty, false))
|
||||||
@ -73,7 +73,7 @@ public void AddByUrlError()
|
|||||||
|
|
||||||
var mocker = new AutoMoqer();
|
var mocker = new AutoMoqer();
|
||||||
|
|
||||||
var fakeConfig = mocker.GetMock<IConfigProvider>();
|
var fakeConfig = mocker.GetMock<ConfigProvider>();
|
||||||
fakeConfig.Setup(c => c.GetValue("SabHost", String.Empty, false)).Returns(sabHost);
|
fakeConfig.Setup(c => c.GetValue("SabHost", String.Empty, false)).Returns(sabHost);
|
||||||
fakeConfig.Setup(c => c.GetValue("SabPort", String.Empty, false)).Returns(sabPort);
|
fakeConfig.Setup(c => c.GetValue("SabPort", String.Empty, false)).Returns(sabPort);
|
||||||
fakeConfig.Setup(c => c.GetValue("SabApiKey", String.Empty, false)).Returns(apikey);
|
fakeConfig.Setup(c => c.GetValue("SabApiKey", String.Empty, false)).Returns(apikey);
|
||||||
@ -105,7 +105,7 @@ public void IsInQueue_True()
|
|||||||
|
|
||||||
var mocker = new AutoMoqer();
|
var mocker = new AutoMoqer();
|
||||||
|
|
||||||
var fakeConfig = mocker.GetMock<IConfigProvider>();
|
var fakeConfig = mocker.GetMock<ConfigProvider>();
|
||||||
fakeConfig.Setup(c => c.GetValue("SabHost", String.Empty, false)).Returns(sabHost);
|
fakeConfig.Setup(c => c.GetValue("SabHost", String.Empty, false)).Returns(sabHost);
|
||||||
fakeConfig.Setup(c => c.GetValue("SabPort", String.Empty, false)).Returns(sabPort);
|
fakeConfig.Setup(c => c.GetValue("SabPort", String.Empty, false)).Returns(sabPort);
|
||||||
fakeConfig.Setup(c => c.GetValue("SabApiKey", String.Empty, false)).Returns(apikey);
|
fakeConfig.Setup(c => c.GetValue("SabApiKey", String.Empty, false)).Returns(apikey);
|
||||||
@ -135,7 +135,7 @@ public void IsInQueue_False_Empty()
|
|||||||
|
|
||||||
var mocker = new AutoMoqer();
|
var mocker = new AutoMoqer();
|
||||||
|
|
||||||
var fakeConfig = mocker.GetMock<IConfigProvider>();
|
var fakeConfig = mocker.GetMock<ConfigProvider>();
|
||||||
fakeConfig.Setup(c => c.GetValue("SabHost", String.Empty, false)).Returns(sabHost);
|
fakeConfig.Setup(c => c.GetValue("SabHost", String.Empty, false)).Returns(sabHost);
|
||||||
fakeConfig.Setup(c => c.GetValue("SabPort", String.Empty, false)).Returns(sabPort);
|
fakeConfig.Setup(c => c.GetValue("SabPort", String.Empty, false)).Returns(sabPort);
|
||||||
fakeConfig.Setup(c => c.GetValue("SabApiKey", String.Empty, false)).Returns(apikey);
|
fakeConfig.Setup(c => c.GetValue("SabApiKey", String.Empty, false)).Returns(apikey);
|
||||||
@ -165,7 +165,7 @@ public void IsInQueue_False_Error()
|
|||||||
|
|
||||||
var mocker = new AutoMoqer();
|
var mocker = new AutoMoqer();
|
||||||
|
|
||||||
var fakeConfig = mocker.GetMock<IConfigProvider>();
|
var fakeConfig = mocker.GetMock<ConfigProvider>();
|
||||||
fakeConfig.Setup(c => c.GetValue("SabHost", String.Empty, false)).Returns(sabHost);
|
fakeConfig.Setup(c => c.GetValue("SabHost", String.Empty, false)).Returns(sabHost);
|
||||||
fakeConfig.Setup(c => c.GetValue("SabPort", String.Empty, false)).Returns(sabPort);
|
fakeConfig.Setup(c => c.GetValue("SabPort", String.Empty, false)).Returns(sabPort);
|
||||||
fakeConfig.Setup(c => c.GetValue("SabApiKey", String.Empty, false)).Returns(apikey);
|
fakeConfig.Setup(c => c.GetValue("SabApiKey", String.Empty, false)).Returns(apikey);
|
||||||
|
@ -61,7 +61,7 @@ public static void BindKernel()
|
|||||||
_kernel.Bind<TvDbProvider>().ToSelf().InSingletonScope();
|
_kernel.Bind<TvDbProvider>().ToSelf().InSingletonScope();
|
||||||
_kernel.Bind<HttpProvider>().ToSelf().InSingletonScope();
|
_kernel.Bind<HttpProvider>().ToSelf().InSingletonScope();
|
||||||
_kernel.Bind<SeriesProvider>().ToSelf().InSingletonScope();
|
_kernel.Bind<SeriesProvider>().ToSelf().InSingletonScope();
|
||||||
_kernel.Bind<ISeasonProvider>().To<SeasonProvider>().InSingletonScope();
|
_kernel.Bind<SeasonProvider>().ToSelf().InSingletonScope();
|
||||||
_kernel.Bind<RssSyncProvider>().ToSelf().InSingletonScope();
|
_kernel.Bind<RssSyncProvider>().ToSelf().InSingletonScope();
|
||||||
_kernel.Bind<EpisodeProvider>().ToSelf().InSingletonScope();
|
_kernel.Bind<EpisodeProvider>().ToSelf().InSingletonScope();
|
||||||
_kernel.Bind<UpcomingEpisodesProvider>().ToSelf().InSingletonScope();
|
_kernel.Bind<UpcomingEpisodesProvider>().ToSelf().InSingletonScope();
|
||||||
@ -72,13 +72,13 @@ public static void BindKernel()
|
|||||||
_kernel.Bind<ExternalNotificationProvider>().ToSelf().InSingletonScope();
|
_kernel.Bind<ExternalNotificationProvider>().ToSelf().InSingletonScope();
|
||||||
_kernel.Bind<XbmcProvider>().ToSelf().InSingletonScope();
|
_kernel.Bind<XbmcProvider>().ToSelf().InSingletonScope();
|
||||||
_kernel.Bind<PostProcessingProvider>().ToSelf().InSingletonScope();
|
_kernel.Bind<PostProcessingProvider>().ToSelf().InSingletonScope();
|
||||||
_kernel.Bind<IConfigProvider>().To<ConfigProvider>().InSingletonScope();
|
_kernel.Bind<ConfigProvider>().To<ConfigProvider>().InSingletonScope();
|
||||||
_kernel.Bind<ISyncProvider>().To<SyncProvider>().InSingletonScope();
|
_kernel.Bind<SyncProvider>().ToSelf().InSingletonScope();
|
||||||
_kernel.Bind<IndexerProvider>().ToSelf().InSingletonScope();
|
_kernel.Bind<IndexerProvider>().ToSelf().InSingletonScope();
|
||||||
_kernel.Bind<RenameProvider>().ToSelf().InSingletonScope();
|
_kernel.Bind<RenameProvider>().ToSelf().InSingletonScope();
|
||||||
_kernel.Bind<NotificationProvider>().ToSelf().InSingletonScope();
|
_kernel.Bind<NotificationProvider>().ToSelf().InSingletonScope();
|
||||||
_kernel.Bind<LogProvider>().ToSelf().InSingletonScope();
|
_kernel.Bind<LogProvider>().ToSelf().InSingletonScope();
|
||||||
_kernel.Bind<IMediaFileProvider>().To<MediaFileProvider>().InSingletonScope();
|
_kernel.Bind<MediaFileProvider>().ToSelf().InSingletonScope();
|
||||||
_kernel.Bind<TimerProvider>().ToSelf().InSingletonScope();
|
_kernel.Bind<TimerProvider>().ToSelf().InSingletonScope();
|
||||||
_kernel.Bind<IRepository>().ToMethod(c => new SimpleRepository(dbProvider, SimpleRepositoryOptions.RunMigrations)).InSingletonScope();
|
_kernel.Bind<IRepository>().ToMethod(c => new SimpleRepository(dbProvider, SimpleRepositoryOptions.RunMigrations)).InSingletonScope();
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ public static void BindKernel()
|
|||||||
SetupDefaultQualityProfiles(_kernel.Get<IRepository>()); //Setup the default QualityProfiles on start-up
|
SetupDefaultQualityProfiles(_kernel.Get<IRepository>()); //Setup the default QualityProfiles on start-up
|
||||||
|
|
||||||
//Get the Timers going
|
//Get the Timers going
|
||||||
var config = _kernel.Get<IConfigProvider>();
|
var config = _kernel.Get<ConfigProvider>();
|
||||||
var timer = _kernel.Get<TimerProvider>();
|
var timer = _kernel.Get<TimerProvider>();
|
||||||
timer.SetRssSyncTimer(Convert.ToInt32(config.GetValue("SyncFrequency", "15", true)));
|
timer.SetRssSyncTimer(Convert.ToInt32(config.GetValue("SyncFrequency", "15", true)));
|
||||||
timer.StartRssSyncTimer();
|
timer.StartRssSyncTimer();
|
||||||
|
@ -198,8 +198,6 @@
|
|||||||
<Compile Include="Instrumentation\LogConfiguration.cs" />
|
<Compile Include="Instrumentation\LogConfiguration.cs" />
|
||||||
<Compile Include="Parser.cs" />
|
<Compile Include="Parser.cs" />
|
||||||
<Compile Include="Providers\Fakes\FakeNotificationProvider.cs" />
|
<Compile Include="Providers\Fakes\FakeNotificationProvider.cs" />
|
||||||
<Compile Include="Providers\IMediaFileProvider.cs" />
|
|
||||||
<Compile Include="Providers\ISyncProvider.cs" />
|
|
||||||
<Compile Include="Providers\MediaFileProvider.cs" />
|
<Compile Include="Providers\MediaFileProvider.cs" />
|
||||||
<Compile Include="Providers\SyncProvider.cs" />
|
<Compile Include="Providers\SyncProvider.cs" />
|
||||||
<Compile Include="Model\Notification\ProgressNotification.cs" />
|
<Compile Include="Model\Notification\ProgressNotification.cs" />
|
||||||
@ -207,7 +205,6 @@
|
|||||||
<Compile Include="Providers\Core\ConfigProvider.cs" />
|
<Compile Include="Providers\Core\ConfigProvider.cs" />
|
||||||
<Compile Include="Providers\EpisodeProvider.cs" />
|
<Compile Include="Providers\EpisodeProvider.cs" />
|
||||||
<Compile Include="Providers\Core\HttpProvider.cs" />
|
<Compile Include="Providers\Core\HttpProvider.cs" />
|
||||||
<Compile Include="Providers\ISeasonProvider.cs" />
|
|
||||||
<Compile Include="Providers\SabProvider.cs" />
|
<Compile Include="Providers\SabProvider.cs" />
|
||||||
<Compile Include="Providers\SeasonProvider.cs" />
|
<Compile Include="Providers\SeasonProvider.cs" />
|
||||||
<Compile Include="Repository\Episode.cs" />
|
<Compile Include="Repository\Episode.cs" />
|
||||||
@ -223,7 +220,6 @@
|
|||||||
<Compile Include="CentralDispatch.cs" />
|
<Compile Include="CentralDispatch.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Providers\Core\DiskProvider.cs" />
|
<Compile Include="Providers\Core\DiskProvider.cs" />
|
||||||
<Compile Include="Providers\Core\IConfigProvider.cs" />
|
|
||||||
<Compile Include="Providers\SeriesProvider.cs" />
|
<Compile Include="Providers\SeriesProvider.cs" />
|
||||||
<Compile Include="Providers\TvDbProvider.cs" />
|
<Compile Include="Providers\TvDbProvider.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
namespace NzbDrone.Core.Providers.Core
|
namespace NzbDrone.Core.Providers.Core
|
||||||
{
|
{
|
||||||
public class ConfigProvider : IConfigProvider
|
public class ConfigProvider
|
||||||
{
|
{
|
||||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||||
private readonly IRepository _sonicRepo;
|
private readonly IRepository _sonicRepo;
|
||||||
@ -15,7 +15,11 @@ public ConfigProvider(IRepository dataRepository)
|
|||||||
_sonicRepo = dataRepository;
|
_sonicRepo = dataRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String ApiKey
|
public ConfigProvider()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual String ApiKey
|
||||||
{
|
{
|
||||||
get { return GetValue("ApiKey"); }
|
get { return GetValue("ApiKey"); }
|
||||||
|
|
||||||
@ -23,154 +27,154 @@ public String ApiKey
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String EpisodeNameFormat
|
public virtual String EpisodeNameFormat
|
||||||
{
|
{
|
||||||
get { return GetValue("EpisodeNameFormat"); }
|
get { return GetValue("EpisodeNameFormat"); }
|
||||||
|
|
||||||
set { SetValue("EpisodeNameFormat", value); }
|
set { SetValue("EpisodeNameFormat", value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public String SeriesRoot
|
public virtual String SeriesRoot
|
||||||
{
|
{
|
||||||
get { return GetValue("SeriesRoots"); }
|
get { return GetValue("SeriesRoots"); }
|
||||||
|
|
||||||
set { SetValue("SeriesRoots", value); }
|
set { SetValue("SeriesRoots", value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public String NzbMatrixUsername
|
public virtual String NzbMatrixUsername
|
||||||
{
|
{
|
||||||
get { return GetValue("NzbMatrixUsername"); }
|
get { return GetValue("NzbMatrixUsername"); }
|
||||||
|
|
||||||
set { SetValue("NzbMatrixUsername", value); }
|
set { SetValue("NzbMatrixUsername", value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public String NzbMatrixApiKey
|
public virtual String NzbMatrixApiKey
|
||||||
{
|
{
|
||||||
get { return GetValue("NzbMatrixApiKey"); }
|
get { return GetValue("NzbMatrixApiKey"); }
|
||||||
|
|
||||||
set { SetValue("NzbMatrixApiKey", value); }
|
set { SetValue("NzbMatrixApiKey", value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public String NzbsOrgUId
|
public virtual String NzbsOrgUId
|
||||||
{
|
{
|
||||||
get { return GetValue("NzbsOrgUId"); }
|
get { return GetValue("NzbsOrgUId"); }
|
||||||
|
|
||||||
set { SetValue("NzbsOrgUId", value); }
|
set { SetValue("NzbsOrgUId", value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public String NzbsOrgHash
|
public virtual String NzbsOrgHash
|
||||||
{
|
{
|
||||||
get { return GetValue("NzbsOrgHash"); }
|
get { return GetValue("NzbsOrgHash"); }
|
||||||
|
|
||||||
set { SetValue("NzbsOrgHash", value); }
|
set { SetValue("NzbsOrgHash", value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public String NzbsrusUId
|
public virtual String NzbsrusUId
|
||||||
{
|
{
|
||||||
get { return GetValue("NzbsrusUId"); }
|
get { return GetValue("NzbsrusUId"); }
|
||||||
|
|
||||||
set { SetValue("NzbsrusUId", value); }
|
set { SetValue("NzbsrusUId", value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public String NzbsrusHash
|
public virtual String NzbsrusHash
|
||||||
{
|
{
|
||||||
get { return GetValue("NzbsrusHash"); }
|
get { return GetValue("NzbsrusHash"); }
|
||||||
|
|
||||||
set { SetValue("NzbsrusHash", value); }
|
set { SetValue("NzbsrusHash", value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public String SyncFrequency
|
public virtual String SyncFrequency
|
||||||
{
|
{
|
||||||
get { return GetValue("SyncFrequency"); }
|
get { return GetValue("SyncFrequency"); }
|
||||||
|
|
||||||
set { SetValue("SyncFrequency", value); }
|
set { SetValue("SyncFrequency", value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public String DownloadPropers
|
public virtual String DownloadPropers
|
||||||
{
|
{
|
||||||
get { return GetValue("DownloadPropers"); }
|
get { return GetValue("DownloadPropers"); }
|
||||||
|
|
||||||
set { SetValue("DownloadPropers", value); }
|
set { SetValue("DownloadPropers", value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public String Retention
|
public virtual String Retention
|
||||||
{
|
{
|
||||||
get { return GetValue("Retention"); }
|
get { return GetValue("Retention"); }
|
||||||
|
|
||||||
set { SetValue("Retention", value); }
|
set { SetValue("Retention", value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public String SabHost
|
public virtual String SabHost
|
||||||
{
|
{
|
||||||
get { return GetValue("SabHost"); }
|
get { return GetValue("SabHost"); }
|
||||||
|
|
||||||
set { SetValue("SabHost", value); }
|
set { SetValue("SabHost", value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public String SabPort
|
public virtual String SabPort
|
||||||
{
|
{
|
||||||
get { return GetValue("SabPort"); }
|
get { return GetValue("SabPort"); }
|
||||||
|
|
||||||
set { SetValue("SabPort", value); }
|
set { SetValue("SabPort", value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public String SabApiKey
|
public virtual String SabApiKey
|
||||||
{
|
{
|
||||||
get { return GetValue("SabApiKey"); }
|
get { return GetValue("SabApiKey"); }
|
||||||
|
|
||||||
set { SetValue("SabApiKey", value); }
|
set { SetValue("SabApiKey", value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public String SabUsername
|
public virtual String SabUsername
|
||||||
{
|
{
|
||||||
get { return GetValue("SabUsername"); }
|
get { return GetValue("SabUsername"); }
|
||||||
|
|
||||||
set { SetValue("SabUsername", value); }
|
set { SetValue("SabUsername", value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public String SabPassword
|
public virtual String SabPassword
|
||||||
{
|
{
|
||||||
get { return GetValue("SabPassword"); }
|
get { return GetValue("SabPassword"); }
|
||||||
|
|
||||||
set { SetValue("SabPassword", value); }
|
set { SetValue("SabPassword", value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public String SabTvCategory
|
public virtual String SabTvCategory
|
||||||
{
|
{
|
||||||
get { return GetValue("SabTvCategory"); }
|
get { return GetValue("SabTvCategory"); }
|
||||||
|
|
||||||
set { SetValue("SabTvCategory", value); }
|
set { SetValue("SabTvCategory", value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public String SabTvPriority
|
public virtual String SabTvPriority
|
||||||
{
|
{
|
||||||
get { return GetValue("SabTvPriority"); }
|
get { return GetValue("SabTvPriority"); }
|
||||||
|
|
||||||
set { SetValue("SabTvPriority", value); }
|
set { SetValue("SabTvPriority", value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public String UseBlackhole
|
public virtual String UseBlackhole
|
||||||
{
|
{
|
||||||
get { return GetValue("UseBlackhole"); }
|
get { return GetValue("UseBlackhole"); }
|
||||||
|
|
||||||
set { SetValue("UseBlackhole", value); }
|
set { SetValue("UseBlackhole", value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public String BlackholeDirectory
|
public virtual String BlackholeDirectory
|
||||||
{
|
{
|
||||||
get { return GetValue("BlackholeDirectory"); }
|
get { return GetValue("BlackholeDirectory"); }
|
||||||
|
|
||||||
set { SetValue("BlackholeDirectory", value); }
|
set { SetValue("BlackholeDirectory", value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool UseSeasonFolder
|
public virtual bool UseSeasonFolder
|
||||||
{
|
{
|
||||||
get { return GetValueBoolean("Sorting_SeasonFolder", true); }
|
get { return GetValueBoolean("Sorting_SeasonFolder", true); }
|
||||||
|
|
||||||
set { SetValue("Sorting_SeasonFolder", value); }
|
set { SetValue("Sorting_SeasonFolder", value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public int DefaultQualityProfile
|
public virtual int DefaultQualityProfile
|
||||||
{
|
{
|
||||||
get { return GetValueInt("DefaultQualityProfile", 1); }
|
get { return GetValueInt("DefaultQualityProfile", 1); }
|
||||||
|
|
||||||
@ -193,7 +197,7 @@ private int GetValueInt(string key, int defaultValue = 0)
|
|||||||
return Convert.ToInt16(GetValue(key, defaultValue, false));
|
return Convert.ToInt16(GetValue(key, defaultValue, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetValue(string key, object defaultValue, bool makePermanent)
|
public virtual string GetValue(string key, object defaultValue, bool makePermanent)
|
||||||
{
|
{
|
||||||
string value;
|
string value;
|
||||||
|
|
||||||
@ -210,17 +214,17 @@ public string GetValue(string key, object defaultValue, bool makePermanent)
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetValue(string key, Boolean value)
|
public virtual void SetValue(string key, Boolean value)
|
||||||
{
|
{
|
||||||
SetValue(key, value.ToString());
|
SetValue(key, value.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetValue(string key, int value)
|
public virtual void SetValue(string key, int value)
|
||||||
{
|
{
|
||||||
SetValue(key, value.ToString());
|
SetValue(key, value.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetValue(string key, string value)
|
public virtual void SetValue(string key, string value)
|
||||||
{
|
{
|
||||||
if (String.IsNullOrEmpty(key))
|
if (String.IsNullOrEmpty(key))
|
||||||
throw new ArgumentOutOfRangeException("key");
|
throw new ArgumentOutOfRangeException("key");
|
||||||
|
@ -1,34 +0,0 @@
|
|||||||
using System;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Providers.Core
|
|
||||||
{
|
|
||||||
public interface IConfigProvider
|
|
||||||
{
|
|
||||||
String SeriesRoot { get; set; }
|
|
||||||
String EpisodeNameFormat { get; set; }
|
|
||||||
String NzbMatrixUsername { get; set; }
|
|
||||||
String NzbMatrixApiKey { get; set; }
|
|
||||||
String NzbsOrgUId { get; set; }
|
|
||||||
String NzbsOrgHash { get; set; }
|
|
||||||
String NzbsrusUId { get; set; }
|
|
||||||
String NzbsrusHash { get; set; }
|
|
||||||
String DownloadPropers { get; set; }
|
|
||||||
String Retention { get; set; }
|
|
||||||
String SabHost { get; set; }
|
|
||||||
String SabPort { get; set; }
|
|
||||||
String SabApiKey { get; set; }
|
|
||||||
String SabUsername { get; set; }
|
|
||||||
String SabPassword { get; set; }
|
|
||||||
String SabTvCategory { get; set; }
|
|
||||||
String UseBlackhole { get; set; }
|
|
||||||
String BlackholeDirectory { get; set; }
|
|
||||||
String SyncFrequency { get; set; }
|
|
||||||
String SabTvPriority { get; set; }
|
|
||||||
String ApiKey { get; set; }
|
|
||||||
bool UseSeasonFolder { get; set; }
|
|
||||||
int DefaultQualityProfile { get; set; }
|
|
||||||
|
|
||||||
string GetValue(string key, object defaultValue, bool makePermanent);
|
|
||||||
void SetValue(string key, string value);
|
|
||||||
}
|
|
||||||
}
|
|
@ -15,14 +15,14 @@ public class EpisodeProvider
|
|||||||
|
|
||||||
private readonly IRepository _sonicRepo;
|
private readonly IRepository _sonicRepo;
|
||||||
private readonly SeriesProvider _series;
|
private readonly SeriesProvider _series;
|
||||||
private readonly ISeasonProvider _seasons;
|
private readonly SeasonProvider _seasons;
|
||||||
private readonly TvDbProvider _tvDb;
|
private readonly TvDbProvider _tvDb;
|
||||||
private readonly HistoryProvider _history;
|
private readonly HistoryProvider _history;
|
||||||
private readonly QualityProvider _quality;
|
private readonly QualityProvider _quality;
|
||||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
public EpisodeProvider(IRepository sonicRepo, SeriesProvider seriesProvider,
|
public EpisodeProvider(IRepository sonicRepo, SeriesProvider seriesProvider,
|
||||||
ISeasonProvider seasonProvider, TvDbProvider tvDbProvider,
|
SeasonProvider seasonProvider, TvDbProvider tvDbProvider,
|
||||||
HistoryProvider history, QualityProvider quality)
|
HistoryProvider history, QualityProvider quality)
|
||||||
{
|
{
|
||||||
_sonicRepo = sonicRepo;
|
_sonicRepo = sonicRepo;
|
||||||
|
@ -12,12 +12,12 @@ namespace NzbDrone.Core.Providers
|
|||||||
{
|
{
|
||||||
public class ExternalNotificationProvider
|
public class ExternalNotificationProvider
|
||||||
{
|
{
|
||||||
private readonly IConfigProvider _configProvider;
|
private readonly ConfigProvider _configProvider;
|
||||||
private readonly XbmcProvider _xbmcProvider;
|
private readonly XbmcProvider _xbmcProvider;
|
||||||
|
|
||||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
public ExternalNotificationProvider(IConfigProvider configProvider, XbmcProvider xbmcProvider)
|
public ExternalNotificationProvider(ConfigProvider configProvider, XbmcProvider xbmcProvider)
|
||||||
{
|
{
|
||||||
_configProvider = configProvider;
|
_configProvider = configProvider;
|
||||||
_xbmcProvider = xbmcProvider;
|
_xbmcProvider = xbmcProvider;
|
||||||
|
@ -9,14 +9,14 @@ namespace NzbDrone.Core.Providers.Feed
|
|||||||
public abstract class FeedProviderBase
|
public abstract class FeedProviderBase
|
||||||
{
|
{
|
||||||
protected readonly SeriesProvider _seriesProvider;
|
protected readonly SeriesProvider _seriesProvider;
|
||||||
protected readonly ISeasonProvider _seasonProvider;
|
protected readonly SeasonProvider _seasonProvider;
|
||||||
protected readonly EpisodeProvider _episodeProvider;
|
protected readonly EpisodeProvider _episodeProvider;
|
||||||
protected readonly IConfigProvider _configProvider;
|
protected readonly ConfigProvider _configProvider;
|
||||||
private readonly HttpProvider _httpProvider;
|
private readonly HttpProvider _httpProvider;
|
||||||
protected static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
protected static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
public FeedProviderBase(SeriesProvider seriesProvider, ISeasonProvider seasonProvider,
|
public FeedProviderBase(SeriesProvider seriesProvider, SeasonProvider seasonProvider,
|
||||||
EpisodeProvider episodeProvider, IConfigProvider configProvider, HttpProvider httpProvider)
|
EpisodeProvider episodeProvider, ConfigProvider configProvider, HttpProvider httpProvider)
|
||||||
{
|
{
|
||||||
_seriesProvider = seriesProvider;
|
_seriesProvider = seriesProvider;
|
||||||
_seasonProvider = seasonProvider;
|
_seasonProvider = seasonProvider;
|
||||||
|
@ -9,7 +9,7 @@ namespace NzbDrone.Core.Providers.Feed
|
|||||||
{
|
{
|
||||||
class NzbsOrgFeedProvider : FeedProviderBase
|
class NzbsOrgFeedProvider : FeedProviderBase
|
||||||
{
|
{
|
||||||
public NzbsOrgFeedProvider(SeriesProvider seriesProvider, ISeasonProvider seasonProvider, EpisodeProvider episodeProvider, IConfigProvider configProvider, HttpProvider httpProvider)
|
public NzbsOrgFeedProvider(SeriesProvider seriesProvider, SeasonProvider seasonProvider, EpisodeProvider episodeProvider, ConfigProvider configProvider, HttpProvider httpProvider)
|
||||||
: base(seriesProvider, seasonProvider, episodeProvider, configProvider, httpProvider)
|
: base(seriesProvider, seasonProvider, episodeProvider, configProvider, httpProvider)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using NzbDrone.Core.Model;
|
|
||||||
using NzbDrone.Core.Repository;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Providers
|
|
||||||
{
|
|
||||||
public interface IMediaFileProvider
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Scans the specified series folder for media files
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="series">The series to be scanned</param>
|
|
||||||
List<EpisodeFile> Scan(Series series);
|
|
||||||
List<EpisodeFile> Scan(Series series, string path);
|
|
||||||
EpisodeFile ImportFile(Series series, string filePath);
|
|
||||||
void CleanUp(List<EpisodeFile> files);
|
|
||||||
void DeleteFromDb(int fileId);
|
|
||||||
void DeleteFromDisk(int fileId, string path);
|
|
||||||
void Update(EpisodeFile episodeFile);
|
|
||||||
EpisodeFile GetEpisodeFile(int episodeFileId);
|
|
||||||
List<EpisodeFile> GetEpisodeFiles();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using NzbDrone.Core.Model;
|
|
||||||
using NzbDrone.Core.Repository;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Providers
|
|
||||||
{
|
|
||||||
public interface ISeasonProvider
|
|
||||||
{
|
|
||||||
Season GetSeason(int seasonId);
|
|
||||||
Season GetSeason(int seriesId, int seasonNumber);
|
|
||||||
List<Season> GetSeasons(int seriesId);
|
|
||||||
Season GetLatestSeason(int seriesId);
|
|
||||||
void EnsureSeason(int seriesId, int seasonId, int seasonNumber);
|
|
||||||
int SaveSeason(Season season);
|
|
||||||
bool IsIgnored(int seasonId);
|
|
||||||
bool IsIgnored(int seriesId, int seasonNumber);
|
|
||||||
void DeleteSeason(int seasonId);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using NzbDrone.Core.Model;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Providers
|
|
||||||
{
|
|
||||||
public interface ISyncProvider
|
|
||||||
{
|
|
||||||
|
|
||||||
List<String> GetUnmappedFolders(string path);
|
|
||||||
bool BeginUpdateNewSeries();
|
|
||||||
}
|
|
||||||
}
|
|
@ -15,9 +15,9 @@ public class IndexerProvider
|
|||||||
{
|
{
|
||||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||||
private readonly IRepository _sonicRepo;
|
private readonly IRepository _sonicRepo;
|
||||||
private readonly IConfigProvider _configProvider;
|
private readonly ConfigProvider _configProvider;
|
||||||
|
|
||||||
public IndexerProvider(IRepository sonicRepo, IConfigProvider configProvider)
|
public IndexerProvider(IRepository sonicRepo, ConfigProvider configProvider)
|
||||||
{
|
{
|
||||||
_sonicRepo = sonicRepo;
|
_sonicRepo = sonicRepo;
|
||||||
_configProvider = configProvider;
|
_configProvider = configProvider;
|
||||||
|
@ -12,17 +12,17 @@
|
|||||||
|
|
||||||
namespace NzbDrone.Core.Providers
|
namespace NzbDrone.Core.Providers
|
||||||
{
|
{
|
||||||
public class MediaFileProvider : IMediaFileProvider
|
public class MediaFileProvider
|
||||||
{
|
{
|
||||||
private readonly IRepository _repository;
|
private readonly IRepository _repository;
|
||||||
private readonly IConfigProvider _configProvider;
|
private readonly ConfigProvider _configProvider;
|
||||||
private readonly DiskProvider _diskProvider;
|
private readonly DiskProvider _diskProvider;
|
||||||
private readonly EpisodeProvider _episodeProvider;
|
private readonly EpisodeProvider _episodeProvider;
|
||||||
|
|
||||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||||
private static readonly string[] MediaExtentions = new[] { "*.mkv", "*.avi", "*.wmv" };
|
private static readonly string[] MediaExtentions = new[] { "*.mkv", "*.avi", "*.wmv" };
|
||||||
|
|
||||||
public MediaFileProvider(IRepository repository, IConfigProvider configProvider, DiskProvider diskProvider, EpisodeProvider episodeProvider)
|
public MediaFileProvider(IRepository repository, ConfigProvider configProvider, DiskProvider diskProvider, EpisodeProvider episodeProvider)
|
||||||
{
|
{
|
||||||
_repository = repository;
|
_repository = repository;
|
||||||
_configProvider = configProvider;
|
_configProvider = configProvider;
|
||||||
|
@ -12,11 +12,11 @@ namespace NzbDrone.Core.Providers
|
|||||||
public class PostProcessingProvider
|
public class PostProcessingProvider
|
||||||
{
|
{
|
||||||
private readonly SeriesProvider _seriesProvider;
|
private readonly SeriesProvider _seriesProvider;
|
||||||
private readonly IMediaFileProvider _mediaFileProvider;
|
private readonly MediaFileProvider _mediaFileProvider;
|
||||||
private readonly RenameProvider _renameProvider;
|
private readonly RenameProvider _renameProvider;
|
||||||
|
|
||||||
public PostProcessingProvider(SeriesProvider seriesProvider,
|
public PostProcessingProvider(SeriesProvider seriesProvider,
|
||||||
IMediaFileProvider mediaFileProvider, RenameProvider renameProvider)
|
MediaFileProvider mediaFileProvider, RenameProvider renameProvider)
|
||||||
{
|
{
|
||||||
_seriesProvider = seriesProvider;
|
_seriesProvider = seriesProvider;
|
||||||
_mediaFileProvider = mediaFileProvider;
|
_mediaFileProvider = mediaFileProvider;
|
||||||
|
@ -15,11 +15,11 @@ namespace NzbDrone.Core.Providers
|
|||||||
public class RenameProvider
|
public class RenameProvider
|
||||||
{
|
{
|
||||||
private readonly SeriesProvider _seriesProvider;
|
private readonly SeriesProvider _seriesProvider;
|
||||||
private readonly ISeasonProvider _seasonProvider;
|
private readonly SeasonProvider _seasonProvider;
|
||||||
private readonly EpisodeProvider _episodeProvider;
|
private readonly EpisodeProvider _episodeProvider;
|
||||||
private readonly IMediaFileProvider _mediaFileProvider;
|
private readonly MediaFileProvider _mediaFileProvider;
|
||||||
private readonly DiskProvider _diskProvider;
|
private readonly DiskProvider _diskProvider;
|
||||||
private readonly IConfigProvider _configProvider;
|
private readonly ConfigProvider _configProvider;
|
||||||
private readonly ExternalNotificationProvider _externalNotificationProvider;
|
private readonly ExternalNotificationProvider _externalNotificationProvider;
|
||||||
|
|
||||||
private Thread _renameThread;
|
private Thread _renameThread;
|
||||||
@ -27,9 +27,9 @@ public class RenameProvider
|
|||||||
|
|
||||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
public RenameProvider(SeriesProvider seriesProvider, ISeasonProvider seasonProvider,
|
public RenameProvider(SeriesProvider seriesProvider, SeasonProvider seasonProvider,
|
||||||
EpisodeProvider episodeProvider, IMediaFileProvider mediaFileProvider,
|
EpisodeProvider episodeProvider, MediaFileProvider mediaFileProvider,
|
||||||
DiskProvider diskProvider, IConfigProvider configProvider,
|
DiskProvider diskProvider, ConfigProvider configProvider,
|
||||||
ExternalNotificationProvider extenalNotificationProvider)
|
ExternalNotificationProvider extenalNotificationProvider)
|
||||||
{
|
{
|
||||||
_seriesProvider = seriesProvider;
|
_seriesProvider = seriesProvider;
|
||||||
|
@ -9,12 +9,12 @@ namespace NzbDrone.Core.Providers
|
|||||||
{
|
{
|
||||||
public class SabProvider
|
public class SabProvider
|
||||||
{
|
{
|
||||||
private readonly IConfigProvider _config;
|
private readonly ConfigProvider _config;
|
||||||
private readonly HttpProvider _http;
|
private readonly HttpProvider _http;
|
||||||
|
|
||||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
public SabProvider(IConfigProvider config, HttpProvider http)
|
public SabProvider(ConfigProvider config, HttpProvider http)
|
||||||
{
|
{
|
||||||
_config = config;
|
_config = config;
|
||||||
_http = http;
|
_http = http;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
namespace NzbDrone.Core.Providers
|
namespace NzbDrone.Core.Providers
|
||||||
{
|
{
|
||||||
public class SeasonProvider : ISeasonProvider
|
public class SeasonProvider
|
||||||
{
|
{
|
||||||
private readonly IRepository _sonicRepo;
|
private readonly IRepository _sonicRepo;
|
||||||
private readonly SeriesProvider _seriesProvider;
|
private readonly SeriesProvider _seriesProvider;
|
||||||
@ -21,27 +21,32 @@ public SeasonProvider(IRepository dataRepository, SeriesProvider seriesProvider)
|
|||||||
_seriesProvider = seriesProvider;
|
_seriesProvider = seriesProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Season GetSeason(int seasonId)
|
public SeasonProvider()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual Season GetSeason(int seasonId)
|
||||||
{
|
{
|
||||||
return _sonicRepo.Single<Season>(seasonId);
|
return _sonicRepo.Single<Season>(seasonId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Season GetSeason(int seriesId, int seasonNumber)
|
public virtual Season GetSeason(int seriesId, int seasonNumber)
|
||||||
{
|
{
|
||||||
return _sonicRepo.Single<Season>(s => s.SeriesId == seriesId && s.SeasonNumber == seasonNumber);
|
return _sonicRepo.Single<Season>(s => s.SeriesId == seriesId && s.SeasonNumber == seasonNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Season> GetSeasons(int seriesId)
|
public virtual List<Season> GetSeasons(int seriesId)
|
||||||
{
|
{
|
||||||
return _sonicRepo.All<Season>().Where(s => s.SeriesId == seriesId).ToList();
|
return _sonicRepo.All<Season>().Where(s => s.SeriesId == seriesId).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Season GetLatestSeason(int seriesId)
|
public virtual Season GetLatestSeason(int seriesId)
|
||||||
{
|
{
|
||||||
return _sonicRepo.All<Season>().Where(s => s.SeriesId == seriesId).OrderBy(s => s.SeasonNumber).Last();
|
return _sonicRepo.All<Season>().Where(s => s.SeriesId == seriesId).OrderBy(s => s.SeasonNumber).Last();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void EnsureSeason(int seriesId, int seasonId, int seasonNumber)
|
public virtual void EnsureSeason(int seriesId, int seasonId, int seasonNumber)
|
||||||
{
|
{
|
||||||
if (_sonicRepo.Exists<Season>(s => s.SeasonId == seasonId))
|
if (_sonicRepo.Exists<Season>(s => s.SeasonId == seasonId))
|
||||||
return;
|
return;
|
||||||
@ -58,12 +63,12 @@ public void EnsureSeason(int seriesId, int seasonId, int seasonNumber)
|
|||||||
_sonicRepo.Add<Season>(newSeason);
|
_sonicRepo.Add<Season>(newSeason);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int SaveSeason(Season season)
|
public virtual int SaveSeason(Season season)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsIgnored(int seasonId)
|
public virtual bool IsIgnored(int seasonId)
|
||||||
{
|
{
|
||||||
if (_sonicRepo.Single<Season>(seasonId).Monitored)
|
if (_sonicRepo.Single<Season>(seasonId).Monitored)
|
||||||
return false;
|
return false;
|
||||||
@ -72,7 +77,7 @@ public bool IsIgnored(int seasonId)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsIgnored(int seriesId, int seasonNumber)
|
public virtual bool IsIgnored(int seriesId, int seasonNumber)
|
||||||
{
|
{
|
||||||
var season = _sonicRepo.Single<Season>(s => s.SeriesId == seriesId && s.SeasonNumber == seasonNumber);
|
var season = _sonicRepo.Single<Season>(s => s.SeriesId == seriesId && s.SeasonNumber == seasonNumber);
|
||||||
|
|
||||||
|
@ -19,13 +19,13 @@ public class SeriesProvider
|
|||||||
|
|
||||||
//Trims all white spaces and separators from the end of the title.
|
//Trims all white spaces and separators from the end of the title.
|
||||||
|
|
||||||
private readonly IConfigProvider _config;
|
private readonly ConfigProvider _config;
|
||||||
private readonly IRepository _sonioRepo;
|
private readonly IRepository _sonioRepo;
|
||||||
private readonly TvDbProvider _tvDb;
|
private readonly TvDbProvider _tvDb;
|
||||||
private readonly QualityProvider _quality;
|
private readonly QualityProvider _quality;
|
||||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
public SeriesProvider(IConfigProvider configProvider,
|
public SeriesProvider(ConfigProvider configProvider,
|
||||||
IRepository dataRepository, TvDbProvider tvDbProvider, QualityProvider quality)
|
IRepository dataRepository, TvDbProvider tvDbProvider, QualityProvider quality)
|
||||||
{
|
{
|
||||||
_config = configProvider;
|
_config = configProvider;
|
||||||
|
@ -11,11 +11,11 @@
|
|||||||
|
|
||||||
namespace NzbDrone.Core.Providers
|
namespace NzbDrone.Core.Providers
|
||||||
{
|
{
|
||||||
public class SyncProvider : ISyncProvider
|
public class SyncProvider
|
||||||
{
|
{
|
||||||
private readonly SeriesProvider _seriesProvider;
|
private readonly SeriesProvider _seriesProvider;
|
||||||
private readonly EpisodeProvider _episodeProvider;
|
private readonly EpisodeProvider _episodeProvider;
|
||||||
private readonly IMediaFileProvider _mediaFileProvider;
|
private readonly MediaFileProvider _mediaFileProvider;
|
||||||
private readonly NotificationProvider _notificationProvider;
|
private readonly NotificationProvider _notificationProvider;
|
||||||
private readonly DiskProvider _diskProvider;
|
private readonly DiskProvider _diskProvider;
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ public class SyncProvider : ISyncProvider
|
|||||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
public SyncProvider(SeriesProvider seriesProvider, EpisodeProvider episodeProvider,
|
public SyncProvider(SeriesProvider seriesProvider, EpisodeProvider episodeProvider,
|
||||||
IMediaFileProvider mediaFileProvider, NotificationProvider notificationProvider,
|
MediaFileProvider mediaFileProvider, NotificationProvider notificationProvider,
|
||||||
DiskProvider diskProvider)
|
DiskProvider diskProvider)
|
||||||
{
|
{
|
||||||
_seriesProvider = seriesProvider;
|
_seriesProvider = seriesProvider;
|
||||||
|
@ -12,16 +12,16 @@ public class TimerProvider
|
|||||||
{
|
{
|
||||||
private readonly RssSyncProvider _rssSyncProvider;
|
private readonly RssSyncProvider _rssSyncProvider;
|
||||||
private readonly SeriesProvider _seriesProvider;
|
private readonly SeriesProvider _seriesProvider;
|
||||||
private readonly ISeasonProvider _seasonProvider;
|
private readonly SeasonProvider _seasonProvider;
|
||||||
private readonly EpisodeProvider _episodeProvider;
|
private readonly EpisodeProvider _episodeProvider;
|
||||||
private readonly IMediaFileProvider _mediaFileProvider;
|
private readonly MediaFileProvider _mediaFileProvider;
|
||||||
|
|
||||||
private Timer _rssSyncTimer;
|
private Timer _rssSyncTimer;
|
||||||
private Timer _minuteTimer;
|
private Timer _minuteTimer;
|
||||||
private DateTime _rssSyncNextInterval;
|
private DateTime _rssSyncNextInterval;
|
||||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
public TimerProvider(RssSyncProvider rssSyncProvider, SeriesProvider seriesProvider, ISeasonProvider seasonProvider, EpisodeProvider episodeProvider, IMediaFileProvider mediaFileProvider)
|
public TimerProvider(RssSyncProvider rssSyncProvider, SeriesProvider seriesProvider, SeasonProvider seasonProvider, EpisodeProvider episodeProvider, MediaFileProvider mediaFileProvider)
|
||||||
{
|
{
|
||||||
_rssSyncProvider = rssSyncProvider;
|
_rssSyncProvider = rssSyncProvider;
|
||||||
_seriesProvider = seriesProvider;
|
_seriesProvider = seriesProvider;
|
||||||
|
@ -12,12 +12,12 @@ namespace NzbDrone.Core.Providers
|
|||||||
{
|
{
|
||||||
public class XbmcProvider
|
public class XbmcProvider
|
||||||
{
|
{
|
||||||
private readonly IConfigProvider _configProvider;
|
private readonly ConfigProvider _configProvider;
|
||||||
private readonly HttpProvider _httpProvider;
|
private readonly HttpProvider _httpProvider;
|
||||||
|
|
||||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
public XbmcProvider(IConfigProvider configProvider, HttpProvider httpProvider)
|
public XbmcProvider(ConfigProvider configProvider, HttpProvider httpProvider)
|
||||||
{
|
{
|
||||||
_configProvider = configProvider;
|
_configProvider = configProvider;
|
||||||
_httpProvider = httpProvider;
|
_httpProvider = httpProvider;
|
||||||
|
@ -0,0 +1,134 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Web;
|
||||||
|
using System.Web.Mvc;
|
||||||
|
using NzbDrone.Core.Providers;
|
||||||
|
using NzbDrone.Core.Providers.Core;
|
||||||
|
using NzbDrone.Web.Models;
|
||||||
|
|
||||||
|
namespace NzbDrone.Web.Controllers
|
||||||
|
{
|
||||||
|
public class AddSeriesController : Controller
|
||||||
|
{
|
||||||
|
public IConfigProvider ConfigProvider { get; set; }
|
||||||
|
private readonly SyncProvider _syncProvider;
|
||||||
|
private readonly RootDirProvider _rootFolderProvider;
|
||||||
|
private readonly IConfigProvider _configProvider;
|
||||||
|
private readonly QualityProvider _qualityProvider;
|
||||||
|
private readonly TvDbProvider _tvDbProvider;
|
||||||
|
private readonly SeriesProvider _seriesProvider;
|
||||||
|
|
||||||
|
public AddSeriesController(SyncProvider syncProvider, RootDirProvider rootFolderProvider, IConfigProvider configProvider,
|
||||||
|
QualityProvider qualityProvider, TvDbProvider tvDbProvider, SeriesProvider seriesProvider)
|
||||||
|
{
|
||||||
|
ConfigProvider = configProvider;
|
||||||
|
_syncProvider = syncProvider;
|
||||||
|
_rootFolderProvider = rootFolderProvider;
|
||||||
|
_configProvider = configProvider;
|
||||||
|
_qualityProvider = qualityProvider;
|
||||||
|
_tvDbProvider = tvDbProvider;
|
||||||
|
_seriesProvider = seriesProvider;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public JsonResult ScanNewSeries()
|
||||||
|
{
|
||||||
|
_syncProvider.BeginUpdateNewSeries();
|
||||||
|
return new JsonResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionResult AddNew()
|
||||||
|
{
|
||||||
|
ViewData["RootDirs"] = _rootFolderProvider.GetAll();
|
||||||
|
ViewData["DirSep"] = Path.DirectorySeparatorChar;
|
||||||
|
|
||||||
|
var profiles = _qualityProvider.GetAllProfiles();
|
||||||
|
var selectList = new SelectList(profiles, "QualityProfileId", "Name");
|
||||||
|
var defaultQuality = Convert.ToInt32(_configProvider.DefaultQualityProfile);
|
||||||
|
|
||||||
|
var model = new AddNewSeriesModel
|
||||||
|
{
|
||||||
|
DirectorySeparatorChar = Path.DirectorySeparatorChar.ToString(),
|
||||||
|
RootDirectories = _rootFolderProvider.GetAll(),
|
||||||
|
QualityProfileId = defaultQuality,
|
||||||
|
QualitySelectList = selectList
|
||||||
|
};
|
||||||
|
|
||||||
|
return View(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionResult AddExisting()
|
||||||
|
{
|
||||||
|
var unmappedList = new List<String>();
|
||||||
|
|
||||||
|
var profiles = _qualityProvider.GetAllProfiles();
|
||||||
|
var defaultQuality = Convert.ToInt32(_configProvider.DefaultQualityProfile);
|
||||||
|
var selectList = new SelectList(profiles, "QualityProfileId", "Name", defaultQuality);
|
||||||
|
|
||||||
|
ViewData["qualities"] = selectList;
|
||||||
|
|
||||||
|
foreach (var folder in _rootFolderProvider.GetAll())
|
||||||
|
{
|
||||||
|
unmappedList.AddRange(_syncProvider.GetUnmappedFolders(folder.Path));
|
||||||
|
}
|
||||||
|
|
||||||
|
return View(unmappedList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionResult RenderPartial(string path)
|
||||||
|
{
|
||||||
|
|
||||||
|
var suggestions = GetSuggestionList(new DirectoryInfo(path).Name);
|
||||||
|
|
||||||
|
ViewData["guid"] = Guid.NewGuid();
|
||||||
|
ViewData["path"] = path;
|
||||||
|
ViewData["javaPath"] = path.Replace(Path.DirectorySeparatorChar, '|').Replace(Path.VolumeSeparatorChar, '^');
|
||||||
|
|
||||||
|
var defaultQuality = _configProvider.DefaultQualityProfile;
|
||||||
|
var qualityProfiles = _qualityProvider.GetAllProfiles();
|
||||||
|
|
||||||
|
ViewData["quality"] = new SelectList(
|
||||||
|
qualityProfiles,
|
||||||
|
"QualityProfileId",
|
||||||
|
"Name",
|
||||||
|
defaultQuality); ;
|
||||||
|
|
||||||
|
return PartialView("AddSeriesItem", suggestions);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public JsonResult AddSeries(string path, int seriesId, int qualityProfileId)
|
||||||
|
{
|
||||||
|
//Get TVDB Series Name
|
||||||
|
//Create new folder for series
|
||||||
|
//Add the new series to the Database
|
||||||
|
|
||||||
|
_seriesProvider.AddSeries(path.Replace('|', Path.DirectorySeparatorChar).Replace('^', Path.VolumeSeparatorChar), seriesId, qualityProfileId);
|
||||||
|
ScanNewSeries();
|
||||||
|
return new JsonResult() { Data = "ok" };
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public ActionResult _textLookUp(string text, int? filterMode)
|
||||||
|
{
|
||||||
|
var suggestions = GetSuggestionList(text);
|
||||||
|
|
||||||
|
return new JsonResult
|
||||||
|
{
|
||||||
|
JsonRequestBehavior = JsonRequestBehavior.AllowGet,
|
||||||
|
Data = suggestions
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public SelectList GetSuggestionList(string searchString)
|
||||||
|
{
|
||||||
|
var dataVal = _tvDbProvider.SearchSeries(searchString);
|
||||||
|
//var bestResult = _tvDbProvider.GetBestMatch(dataVal.ToList(), searchString);
|
||||||
|
|
||||||
|
return new SelectList(dataVal, "Id", "SeriesName", dataVal[0].Id);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -12,18 +12,17 @@ namespace NzbDrone.Web.Controllers
|
|||||||
{
|
{
|
||||||
public class AddSeriesController : Controller
|
public class AddSeriesController : Controller
|
||||||
{
|
{
|
||||||
public IConfigProvider ConfigProvider { get; set; }
|
|
||||||
private readonly ISyncProvider _syncProvider;
|
private readonly SyncProvider _syncProvider;
|
||||||
private readonly RootDirProvider _rootFolderProvider;
|
private readonly RootDirProvider _rootFolderProvider;
|
||||||
private readonly IConfigProvider _configProvider;
|
private readonly ConfigProvider _configProvider;
|
||||||
private readonly QualityProvider _qualityProvider;
|
private readonly QualityProvider _qualityProvider;
|
||||||
private readonly TvDbProvider _tvDbProvider;
|
private readonly TvDbProvider _tvDbProvider;
|
||||||
private readonly SeriesProvider _seriesProvider;
|
private readonly SeriesProvider _seriesProvider;
|
||||||
|
|
||||||
public AddSeriesController(ISyncProvider syncProvider, RootDirProvider rootFolderProvider, IConfigProvider configProvider,
|
public AddSeriesController(SyncProvider syncProvider, RootDirProvider rootFolderProvider, ConfigProvider configProvider,
|
||||||
QualityProvider qualityProvider, TvDbProvider tvDbProvider, SeriesProvider seriesProvider)
|
QualityProvider qualityProvider, TvDbProvider tvDbProvider, SeriesProvider seriesProvider)
|
||||||
{
|
{
|
||||||
ConfigProvider = configProvider;
|
|
||||||
_syncProvider = syncProvider;
|
_syncProvider = syncProvider;
|
||||||
_rootFolderProvider = rootFolderProvider;
|
_rootFolderProvider = rootFolderProvider;
|
||||||
_configProvider = configProvider;
|
_configProvider = configProvider;
|
||||||
@ -125,9 +124,14 @@ public ActionResult _textLookUp(string text, int? filterMode)
|
|||||||
public SelectList GetSuggestionList(string searchString)
|
public SelectList GetSuggestionList(string searchString)
|
||||||
{
|
{
|
||||||
var dataVal = _tvDbProvider.SearchSeries(searchString);
|
var dataVal = _tvDbProvider.SearchSeries(searchString);
|
||||||
//var bestResult = _tvDbProvider.GetBestMatch(dataVal.ToList(), searchString);
|
|
||||||
|
|
||||||
return new SelectList(dataVal, "Id", "SeriesName", dataVal[0].Id);
|
int selectId = 0;
|
||||||
|
if (dataVal.Count != 0)
|
||||||
|
{
|
||||||
|
selectId = dataVal[0].Id;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new SelectList(dataVal, "Id", "SeriesName", selectId);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -14,11 +14,11 @@ namespace NzbDrone.Web.Controllers
|
|||||||
public class ApiController : Controller
|
public class ApiController : Controller
|
||||||
{
|
{
|
||||||
private readonly PostProcessingProvider _postProcessingProvider;
|
private readonly PostProcessingProvider _postProcessingProvider;
|
||||||
private readonly IConfigProvider _configProvider;
|
private readonly ConfigProvider _configProvider;
|
||||||
|
|
||||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
public ApiController(PostProcessingProvider postProcessingProvider, IConfigProvider configProvider)
|
public ApiController(PostProcessingProvider postProcessingProvider, ConfigProvider configProvider)
|
||||||
{
|
{
|
||||||
_postProcessingProvider = postProcessingProvider;
|
_postProcessingProvider = postProcessingProvider;
|
||||||
_configProvider = configProvider;
|
_configProvider = configProvider;
|
||||||
|
@ -23,19 +23,19 @@ public class SeriesController : Controller
|
|||||||
{
|
{
|
||||||
private readonly SeriesProvider _seriesProvider;
|
private readonly SeriesProvider _seriesProvider;
|
||||||
private readonly EpisodeProvider _episodeProvider;
|
private readonly EpisodeProvider _episodeProvider;
|
||||||
private readonly ISyncProvider _syncProvider;
|
private readonly SyncProvider _syncProvider;
|
||||||
private readonly RssSyncProvider _rssSyncProvider;
|
private readonly RssSyncProvider _rssSyncProvider;
|
||||||
private readonly QualityProvider _qualityProvider;
|
private readonly QualityProvider _qualityProvider;
|
||||||
private readonly IMediaFileProvider _mediaFileProvider;
|
private readonly MediaFileProvider _mediaFileProvider;
|
||||||
private readonly RenameProvider _renameProvider;
|
private readonly RenameProvider _renameProvider;
|
||||||
private readonly RootDirProvider _rootDirProvider;
|
private readonly RootDirProvider _rootDirProvider;
|
||||||
private readonly TvDbProvider _tvDbProvider;
|
private readonly TvDbProvider _tvDbProvider;
|
||||||
//
|
//
|
||||||
// GET: /Series/
|
// GET: /Series/
|
||||||
|
|
||||||
public SeriesController(ISyncProvider syncProvider, SeriesProvider seriesProvider,
|
public SeriesController(SyncProvider syncProvider, SeriesProvider seriesProvider,
|
||||||
EpisodeProvider episodeProvider, RssSyncProvider rssSyncProvider,
|
EpisodeProvider episodeProvider, RssSyncProvider rssSyncProvider,
|
||||||
QualityProvider qualityProvider, IMediaFileProvider mediaFileProvider,
|
QualityProvider qualityProvider, MediaFileProvider mediaFileProvider,
|
||||||
RenameProvider renameProvider, RootDirProvider rootDirProvider,
|
RenameProvider renameProvider, RootDirProvider rootDirProvider,
|
||||||
TvDbProvider tvDbProvider)
|
TvDbProvider tvDbProvider)
|
||||||
{
|
{
|
||||||
|
@ -19,7 +19,7 @@ namespace NzbDrone.Web.Controllers
|
|||||||
[HandleError]
|
[HandleError]
|
||||||
public class SettingsController : Controller
|
public class SettingsController : Controller
|
||||||
{
|
{
|
||||||
private IConfigProvider _configProvider;
|
private ConfigProvider _configProvider;
|
||||||
private IndexerProvider _indexerProvider;
|
private IndexerProvider _indexerProvider;
|
||||||
private QualityProvider _qualityProvider;
|
private QualityProvider _qualityProvider;
|
||||||
private RootDirProvider _rootDirProvider;
|
private RootDirProvider _rootDirProvider;
|
||||||
@ -28,7 +28,7 @@ public class SettingsController : Controller
|
|||||||
private const string SETTINGS_SAVED = "Settings Saved.";
|
private const string SETTINGS_SAVED = "Settings Saved.";
|
||||||
private const string SETTINGS_FAILED = "Error Saving Settings, please fix any errors";
|
private const string SETTINGS_FAILED = "Error Saving Settings, please fix any errors";
|
||||||
|
|
||||||
public SettingsController(IConfigProvider configProvider, IndexerProvider indexerProvider,
|
public SettingsController(ConfigProvider configProvider, IndexerProvider indexerProvider,
|
||||||
QualityProvider qualityProvider, RootDirProvider rootDirProvider)
|
QualityProvider qualityProvider, RootDirProvider rootDirProvider)
|
||||||
{
|
{
|
||||||
_configProvider = configProvider;
|
_configProvider = configProvider;
|
||||||
|
Loading…
Reference in New Issue
Block a user