mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-04 10:02:40 +01:00
Merge branch 'mark-fork'
This commit is contained in:
commit
8fbc79c50d
@ -66,7 +66,7 @@ public void IsNeededTrue()
|
|||||||
{
|
{
|
||||||
//Setup
|
//Setup
|
||||||
var season = new Mock<ISeasonProvider>();
|
var season = new Mock<ISeasonProvider>();
|
||||||
var series = new Mock<ISeriesProvider>();
|
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>();
|
||||||
var repo = new Mock<IRepository>();
|
var repo = new Mock<IRepository>();
|
||||||
|
@ -48,14 +48,14 @@ public void import_new_file()
|
|||||||
var episodeProvider = new Mock<IEpisodeProvider>();
|
var episodeProvider = new Mock<IEpisodeProvider>();
|
||||||
episodeProvider.Setup(e => e.GetEpisode(fakeSeries.SeriesId, seasonNumber, episodeNumner)).Returns(fakeEpisode).Verifiable();
|
episodeProvider.Setup(e => e.GetEpisode(fakeSeries.SeriesId, seasonNumber, episodeNumner)).Returns(fakeEpisode).Verifiable();
|
||||||
|
|
||||||
var diskProvider = new Mock<IDiskProvider>();
|
var diskProvider = new Mock<DiskProvider>();
|
||||||
diskProvider.Setup(e => e.GetSize(fileName)).Returns(12345).Verifiable();
|
diskProvider.Setup(e => e.GetSize(fileName)).Returns(12345).Verifiable();
|
||||||
|
|
||||||
var kernel = new MockingKernel();
|
var kernel = new MockingKernel();
|
||||||
kernel.Bind<IRepository>().ToConstant(repository.Object);
|
kernel.Bind<IRepository>().ToConstant(repository.Object);
|
||||||
|
|
||||||
kernel.Bind<IEpisodeProvider>().ToConstant(episodeProvider.Object);
|
kernel.Bind<IEpisodeProvider>().ToConstant(episodeProvider.Object);
|
||||||
kernel.Bind<IDiskProvider>().ToConstant(diskProvider.Object);
|
kernel.Bind<DiskProvider>().ToConstant(diskProvider.Object);
|
||||||
kernel.Bind<IMediaFileProvider>().To<MediaFileProvider>();
|
kernel.Bind<IMediaFileProvider>().To<MediaFileProvider>();
|
||||||
|
|
||||||
//Act
|
//Act
|
||||||
@ -100,13 +100,13 @@ public void import_existing_file()
|
|||||||
repository.Setup(r => r.Exists<EpisodeFile>(It.IsAny<Expression<Func<EpisodeFile, Boolean>>>())).Returns(true).Verifiable();
|
repository.Setup(r => r.Exists<EpisodeFile>(It.IsAny<Expression<Func<EpisodeFile, Boolean>>>())).Returns(true).Verifiable();
|
||||||
|
|
||||||
var episodeProvider = new Mock<IEpisodeProvider>(MockBehavior.Strict);
|
var episodeProvider = new Mock<IEpisodeProvider>(MockBehavior.Strict);
|
||||||
var diskProvider = new Mock<IDiskProvider>(MockBehavior.Strict);
|
var diskProvider = new Mock<DiskProvider>(MockBehavior.Strict);
|
||||||
|
|
||||||
var kernel = new MockingKernel();
|
var kernel = new MockingKernel();
|
||||||
kernel.Bind<IRepository>().ToConstant(repository.Object);
|
kernel.Bind<IRepository>().ToConstant(repository.Object);
|
||||||
|
|
||||||
kernel.Bind<IEpisodeProvider>().ToConstant(episodeProvider.Object);
|
kernel.Bind<IEpisodeProvider>().ToConstant(episodeProvider.Object);
|
||||||
kernel.Bind<IDiskProvider>().ToConstant(diskProvider.Object);
|
kernel.Bind<DiskProvider>().ToConstant(diskProvider.Object);
|
||||||
kernel.Bind<IMediaFileProvider>().To<MediaFileProvider>();
|
kernel.Bind<IMediaFileProvider>().To<MediaFileProvider>();
|
||||||
|
|
||||||
//Act
|
//Act
|
||||||
@ -142,13 +142,13 @@ public void import_file_with_no_episode()
|
|||||||
var episodeProvider = new Mock<IEpisodeProvider>(MockBehavior.Strict);
|
var episodeProvider = new Mock<IEpisodeProvider>(MockBehavior.Strict);
|
||||||
episodeProvider.Setup(e => e.GetEpisode(fakeSeries.SeriesId, seasonNumber, episodeNumner)).Returns<Episode>(null).Verifiable();
|
episodeProvider.Setup(e => e.GetEpisode(fakeSeries.SeriesId, seasonNumber, episodeNumner)).Returns<Episode>(null).Verifiable();
|
||||||
|
|
||||||
var diskProvider = new Mock<IDiskProvider>(MockBehavior.Strict);
|
var diskProvider = new Mock<DiskProvider>(MockBehavior.Strict);
|
||||||
|
|
||||||
|
|
||||||
var kernel = new MockingKernel();
|
var kernel = new MockingKernel();
|
||||||
kernel.Bind<IRepository>().ToConstant(repository.Object);
|
kernel.Bind<IRepository>().ToConstant(repository.Object);
|
||||||
kernel.Bind<IEpisodeProvider>().ToConstant(episodeProvider.Object);
|
kernel.Bind<IEpisodeProvider>().ToConstant(episodeProvider.Object);
|
||||||
kernel.Bind<IDiskProvider>().ToConstant(diskProvider.Object);
|
kernel.Bind<DiskProvider>().ToConstant(diskProvider.Object);
|
||||||
kernel.Bind<IMediaFileProvider>().To<MediaFileProvider>();
|
kernel.Bind<IMediaFileProvider>().To<MediaFileProvider>();
|
||||||
|
|
||||||
//Act
|
//Act
|
||||||
|
@ -52,9 +52,9 @@ public static IConfigProvider StandardConfig
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IDiskProvider GetStandardDisk(int seasons, int episodes)
|
public static DiskProvider GetStandardDisk(int seasons, int episodes)
|
||||||
{
|
{
|
||||||
var mock = new Mock<IDiskProvider>();
|
var mock = new Mock<DiskProvider>();
|
||||||
mock.Setup(c => c.GetDirectories(It.IsAny<String>())).Returns(StandardSeries);
|
mock.Setup(c => c.GetDirectories(It.IsAny<String>())).Returns(StandardSeries);
|
||||||
mock.Setup(c => c.FolderExists(It.Is<String>(d => StandardSeries.Contains(d)))).Returns(true);
|
mock.Setup(c => c.FolderExists(It.Is<String>(d => StandardSeries.Contains(d)))).Returns(true);
|
||||||
|
|
||||||
|
@ -93,6 +93,7 @@
|
|||||||
<Compile Include="AutoMoq\Unity\AutoMockingContainerExtension.cs">
|
<Compile Include="AutoMoq\Unity\AutoMockingContainerExtension.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="RootDirProviderTest.cs" />
|
||||||
<Compile Include="RssProviderTest.cs" />
|
<Compile Include="RssProviderTest.cs" />
|
||||||
<Compile Include="HistoryProviderTest.cs" />
|
<Compile Include="HistoryProviderTest.cs" />
|
||||||
<Compile Include="MediaFileProviderTests.cs" />
|
<Compile Include="MediaFileProviderTests.cs" />
|
||||||
|
121
NzbDrone.Core.Test/RootDirProviderTest.cs
Normal file
121
NzbDrone.Core.Test/RootDirProviderTest.cs
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using AutoMoq;
|
||||||
|
using Gallio.Framework;
|
||||||
|
using MbUnit.Framework;
|
||||||
|
using MbUnit.Framework.ContractVerifiers;
|
||||||
|
using Moq;
|
||||||
|
using NzbDrone.Core.Providers;
|
||||||
|
using NzbDrone.Core.Repository;
|
||||||
|
using SubSonic.Repository;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.Test
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class RootDirProviderTest
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void GetRootDirs()
|
||||||
|
{
|
||||||
|
//Setup
|
||||||
|
var sonicRepo = MockLib.GetEmptyRepository();
|
||||||
|
sonicRepo.Add(new RootDir { Path = @"C:\TV" });
|
||||||
|
sonicRepo.Add(new RootDir { Path = @"C:\TV2" });
|
||||||
|
|
||||||
|
var mocker = new AutoMoqer();
|
||||||
|
|
||||||
|
mocker.GetMock<IRepository>()
|
||||||
|
.Setup(f => f.All<RootDir>())
|
||||||
|
.Returns(sonicRepo.All<RootDir>);
|
||||||
|
|
||||||
|
//Act
|
||||||
|
var result = mocker.Resolve<RootDirProvider>().GetAll();
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
Assert.AreEqual(result.Count, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void AddRootDir()
|
||||||
|
{
|
||||||
|
//Setup
|
||||||
|
var mocker = new AutoMoqer();
|
||||||
|
mocker.SetConstant(MockLib.GetEmptyRepository());
|
||||||
|
|
||||||
|
string path = @"C:\TV\";
|
||||||
|
|
||||||
|
//Act
|
||||||
|
var rootDirProvider = mocker.Resolve<RootDirProvider>();
|
||||||
|
rootDirProvider.Add(new RootDir{ Path = path });
|
||||||
|
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
var rootDirs = rootDirProvider.GetAll();
|
||||||
|
Assert.IsNotEmpty(rootDirs);
|
||||||
|
Assert.Count(1, rootDirs);
|
||||||
|
Assert.AreEqual(path, rootDirs.First().Path);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void UpdateRootDir()
|
||||||
|
{
|
||||||
|
//Setup
|
||||||
|
var mocker = new AutoMoqer();
|
||||||
|
mocker.SetConstant(MockLib.GetEmptyRepository());
|
||||||
|
|
||||||
|
string path = @"C:\TV2";
|
||||||
|
|
||||||
|
//Act
|
||||||
|
var rootDirProvider = mocker.Resolve<RootDirProvider>();
|
||||||
|
rootDirProvider.Add(new RootDir { Path = @"C:\TV" });
|
||||||
|
rootDirProvider.Update(new RootDir { Id = 1, Path = path });
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
var rootDirs = rootDirProvider.GetAll();
|
||||||
|
Assert.IsNotEmpty(rootDirs);
|
||||||
|
Assert.Count(1, rootDirs);
|
||||||
|
Assert.AreEqual(path, rootDirs.First().Path);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void RemoveRootDir()
|
||||||
|
{
|
||||||
|
//Setup
|
||||||
|
var mocker = new AutoMoqer();
|
||||||
|
mocker.SetConstant(MockLib.GetEmptyRepository());
|
||||||
|
|
||||||
|
string path = @"C:\TV2";
|
||||||
|
|
||||||
|
//Act
|
||||||
|
var rootDirProvider = mocker.Resolve<RootDirProvider>();
|
||||||
|
rootDirProvider.Add(new RootDir { Path = @"C:\TV" });
|
||||||
|
rootDirProvider.Remove(1);
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
var rootDirs = rootDirProvider.GetAll();
|
||||||
|
Assert.Count(0, rootDirs);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void GetRootDir()
|
||||||
|
{
|
||||||
|
//Setup
|
||||||
|
var mocker = new AutoMoqer();
|
||||||
|
mocker.SetConstant(MockLib.GetEmptyRepository());
|
||||||
|
|
||||||
|
int id = 1;
|
||||||
|
string path = @"C:\TV";
|
||||||
|
|
||||||
|
//Act
|
||||||
|
var rootDirProvider = mocker.Resolve<RootDirProvider>();
|
||||||
|
rootDirProvider.Add(new RootDir { Id = id, Path = path });
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
var rootDir = rootDirProvider.GetRootDir(id);
|
||||||
|
Assert.AreEqual(1, rootDir.Id);
|
||||||
|
Assert.AreEqual(path, rootDir.Path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -43,7 +43,7 @@ public void Download_feed_test()
|
|||||||
|
|
||||||
public class MockFeedProvider : FeedProviderBase
|
public class MockFeedProvider : FeedProviderBase
|
||||||
{
|
{
|
||||||
public MockFeedProvider(ISeriesProvider seriesProvider, ISeasonProvider seasonProvider, IEpisodeProvider episodeProvider, IConfigProvider configProvider, HttpProvider httpProvider)
|
public MockFeedProvider(SeriesProvider seriesProvider, ISeasonProvider seasonProvider, IEpisodeProvider episodeProvider, IConfigProvider configProvider, HttpProvider httpProvider)
|
||||||
: base(seriesProvider, seasonProvider, episodeProvider, configProvider, httpProvider)
|
: base(seriesProvider, seasonProvider, episodeProvider, configProvider, httpProvider)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -60,26 +60,26 @@ public static void BindKernel()
|
|||||||
_kernel.Bind<QualityProvider>().ToSelf();
|
_kernel.Bind<QualityProvider>().ToSelf();
|
||||||
_kernel.Bind<TvDbProvider>().ToSelf();
|
_kernel.Bind<TvDbProvider>().ToSelf();
|
||||||
_kernel.Bind<HttpProvider>().ToSelf();
|
_kernel.Bind<HttpProvider>().ToSelf();
|
||||||
_kernel.Bind<ISeriesProvider>().To<SeriesProvider>().InSingletonScope();
|
_kernel.Bind<SeriesProvider>().ToSelf().InSingletonScope();
|
||||||
_kernel.Bind<IRssSyncProvider>().To<RssSyncProvider>().InSingletonScope();
|
_kernel.Bind<RssSyncProvider>().ToSelf().InSingletonScope();
|
||||||
_kernel.Bind<ISeasonProvider>().To<SeasonProvider>();
|
_kernel.Bind<ISeasonProvider>().To<SeasonProvider>();
|
||||||
_kernel.Bind<IEpisodeProvider>().To<EpisodeProvider>();
|
_kernel.Bind<IEpisodeProvider>().To<EpisodeProvider>();
|
||||||
_kernel.Bind<UpcomingEpisodesProvider>().To<UpcomingEpisodesProvider>();
|
_kernel.Bind<UpcomingEpisodesProvider>().ToSelf();
|
||||||
_kernel.Bind<IDiskProvider>().To<DiskProvider>();
|
_kernel.Bind<DiskProvider>().ToSelf();
|
||||||
_kernel.Bind<SabProvider>().To<SabProvider>();
|
_kernel.Bind<SabProvider>().ToSelf();
|
||||||
_kernel.Bind<IHistoryProvider>().To<HistoryProvider>();
|
_kernel.Bind<HistoryProvider>().ToSelf();
|
||||||
_kernel.Bind<RootDirProvider>().To<RootDirProvider>();
|
_kernel.Bind<RootDirProvider>().ToSelf();
|
||||||
_kernel.Bind<ExternalNotificationProvider>().To<ExternalNotificationProvider>();
|
_kernel.Bind<ExternalNotificationProvider>().ToSelf();
|
||||||
_kernel.Bind<XbmcProvider>().To<XbmcProvider>();
|
_kernel.Bind<XbmcProvider>().ToSelf();
|
||||||
_kernel.Bind<PostProcessingProvider>().To<PostProcessingProvider>();
|
_kernel.Bind<PostProcessingProvider>().ToSelf();
|
||||||
_kernel.Bind<IConfigProvider>().To<ConfigProvider>().InSingletonScope();
|
_kernel.Bind<IConfigProvider>().To<ConfigProvider>().InSingletonScope();
|
||||||
_kernel.Bind<ISyncProvider>().To<SyncProvider>().InSingletonScope();
|
_kernel.Bind<ISyncProvider>().To<SyncProvider>().InSingletonScope();
|
||||||
_kernel.Bind<IIndexerProvider>().To<IndexerProvider>().InSingletonScope();
|
_kernel.Bind<IndexerProvider>().ToSelf().InSingletonScope();
|
||||||
_kernel.Bind<IRenameProvider>().To<RenameProvider>().InSingletonScope();
|
_kernel.Bind<RenameProvider>().ToSelf().InSingletonScope();
|
||||||
_kernel.Bind<INotificationProvider>().To<NotificationProvider>().InSingletonScope();
|
_kernel.Bind<NotificationProvider>().ToSelf().InSingletonScope();
|
||||||
_kernel.Bind<ILogProvider>().To<LogProvider>().InSingletonScope();
|
_kernel.Bind<ILogProvider>().To<LogProvider>().InSingletonScope();
|
||||||
_kernel.Bind<IMediaFileProvider>().To<MediaFileProvider>().InSingletonScope();
|
_kernel.Bind<IMediaFileProvider>().To<MediaFileProvider>().InSingletonScope();
|
||||||
_kernel.Bind<TimerProvider>().To<TimerProvider>().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();
|
||||||
|
|
||||||
_kernel.Bind<IRepository>().ToConstant(logRepository).WhenInjectedInto<SubsonicTarget>().InSingletonScope();
|
_kernel.Bind<IRepository>().ToConstant(logRepository).WhenInjectedInto<SubsonicTarget>().InSingletonScope();
|
||||||
|
@ -182,12 +182,9 @@
|
|||||||
<Compile Include="Providers\ExternalNotificationProvider.cs" />
|
<Compile Include="Providers\ExternalNotificationProvider.cs" />
|
||||||
<Compile Include="Providers\Feed\NzbsOrgFeedProvider.cs" />
|
<Compile Include="Providers\Feed\NzbsOrgFeedProvider.cs" />
|
||||||
<Compile Include="Providers\HistoryProvider.cs" />
|
<Compile Include="Providers\HistoryProvider.cs" />
|
||||||
<Compile Include="Providers\IBacklogProvider.cs" />
|
<Compile Include="Providers\BacklogProvider.cs" />
|
||||||
<Compile Include="Providers\IHistoryProvider.cs" />
|
|
||||||
<Compile Include="Providers\IIndexerProvider.cs" />
|
|
||||||
<Compile Include="Providers\IndexerProvider.cs" />
|
<Compile Include="Providers\IndexerProvider.cs" />
|
||||||
<Compile Include="Providers\IRenameProvider.cs" />
|
<Compile Include="Providers\RssSyncProvider.cs" />
|
||||||
<Compile Include="Providers\IRssSyncProvider.cs" />
|
|
||||||
<Compile Include="Providers\PostProcessingProvider.cs" />
|
<Compile Include="Providers\PostProcessingProvider.cs" />
|
||||||
<Compile Include="Providers\QualityProvider.cs" />
|
<Compile Include="Providers\QualityProvider.cs" />
|
||||||
<Compile Include="Providers\RenameProvider.cs" />
|
<Compile Include="Providers\RenameProvider.cs" />
|
||||||
@ -203,7 +200,6 @@
|
|||||||
<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\IMediaFileProvider.cs" />
|
||||||
<Compile Include="Providers\INotificationProvider.cs" />
|
|
||||||
<Compile Include="Providers\ISyncProvider.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" />
|
||||||
@ -214,7 +210,6 @@
|
|||||||
<Compile Include="Providers\Core\HttpProvider.cs" />
|
<Compile Include="Providers\Core\HttpProvider.cs" />
|
||||||
<Compile Include="Providers\IEpisodeProvider.cs" />
|
<Compile Include="Providers\IEpisodeProvider.cs" />
|
||||||
<Compile Include="Providers\ISeasonProvider.cs" />
|
<Compile Include="Providers\ISeasonProvider.cs" />
|
||||||
<Compile Include="Providers\ISeriesProvider.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" />
|
||||||
@ -231,7 +226,6 @@
|
|||||||
<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\Core\IConfigProvider.cs" />
|
||||||
<Compile Include="Providers\Core\IDiskProvider.cs" />
|
|
||||||
<Compile Include="Providers\SeriesProvider.cs" />
|
<Compile Include="Providers\SeriesProvider.cs" />
|
||||||
<Compile Include="Providers\TvDbProvider.cs" />
|
<Compile Include="Providers\TvDbProvider.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
21
NzbDrone.Core/Providers/BacklogProvider.cs
Normal file
21
NzbDrone.Core/Providers/BacklogProvider.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.Providers
|
||||||
|
{
|
||||||
|
public class BacklogProvider
|
||||||
|
{
|
||||||
|
//Will provide Backlog Search functionality
|
||||||
|
|
||||||
|
public virtual bool StartSearch()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
public virtual bool StartSearch(int seriesId)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -3,48 +3,48 @@
|
|||||||
|
|
||||||
namespace NzbDrone.Core.Providers.Core
|
namespace NzbDrone.Core.Providers.Core
|
||||||
{
|
{
|
||||||
public class DiskProvider : IDiskProvider
|
public class DiskProvider
|
||||||
{
|
{
|
||||||
#region IDiskProvider Members
|
#region IDiskProvider Members
|
||||||
|
|
||||||
public bool FolderExists(string path)
|
public virtual bool FolderExists(string path)
|
||||||
{
|
{
|
||||||
return Directory.Exists(path);
|
return Directory.Exists(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool FileExists(string path)
|
public virtual bool FileExists(string path)
|
||||||
{
|
{
|
||||||
return File.Exists(path);
|
return File.Exists(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string[] GetDirectories(string path)
|
public virtual string[] GetDirectories(string path)
|
||||||
{
|
{
|
||||||
return Directory.GetDirectories(path);
|
return Directory.GetDirectories(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string[] GetFiles(string path, string pattern, SearchOption searchOption)
|
public virtual string[] GetFiles(string path, string pattern, SearchOption searchOption)
|
||||||
{
|
{
|
||||||
return Directory.GetFiles(path, pattern, searchOption);
|
return Directory.GetFiles(path, pattern, searchOption);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long GetSize(string path)
|
public virtual long GetSize(string path)
|
||||||
{
|
{
|
||||||
var fi = new FileInfo(path);
|
var fi = new FileInfo(path);
|
||||||
return fi.Length;
|
return fi.Length;
|
||||||
//return new FileInfo(path).Length;
|
//return new FileInfo(path).Length;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String CreateDirectory(string path)
|
public virtual String CreateDirectory(string path)
|
||||||
{
|
{
|
||||||
return Directory.CreateDirectory(path).FullName;
|
return Directory.CreateDirectory(path).FullName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DeleteFile(string path)
|
public virtual void DeleteFile(string path)
|
||||||
{
|
{
|
||||||
File.Delete(path);
|
File.Delete(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RenameFile(string sourcePath, string destinationPath)
|
public virtual void RenameFile(string sourcePath, string destinationPath)
|
||||||
{
|
{
|
||||||
File.Move(sourcePath, destinationPath);
|
File.Move(sourcePath, destinationPath);
|
||||||
}
|
}
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Providers.Core
|
|
||||||
{
|
|
||||||
public interface IDiskProvider
|
|
||||||
{
|
|
||||||
bool FolderExists(string path);
|
|
||||||
string[] GetDirectories(string path);
|
|
||||||
String CreateDirectory(string path);
|
|
||||||
string[] GetFiles(string path, string pattern, SearchOption searchOption);
|
|
||||||
bool FileExists(string path);
|
|
||||||
long GetSize(string path);
|
|
||||||
void DeleteFile(string path);
|
|
||||||
void RenameFile(string sourcePath, string destinationPath);
|
|
||||||
}
|
|
||||||
}
|
|
@ -14,16 +14,16 @@ public class EpisodeProvider : IEpisodeProvider
|
|||||||
//TODO: Remove parsing of the series name, it should be done in series provider
|
//TODO: Remove parsing of the series name, it should be done in series provider
|
||||||
|
|
||||||
private readonly IRepository _sonicRepo;
|
private readonly IRepository _sonicRepo;
|
||||||
private readonly ISeriesProvider _series;
|
private readonly SeriesProvider _series;
|
||||||
private readonly ISeasonProvider _seasons;
|
private readonly ISeasonProvider _seasons;
|
||||||
private readonly TvDbProvider _tvDb;
|
private readonly TvDbProvider _tvDb;
|
||||||
private readonly IHistoryProvider _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, ISeriesProvider seriesProvider,
|
public EpisodeProvider(IRepository sonicRepo, SeriesProvider seriesProvider,
|
||||||
ISeasonProvider seasonProvider, TvDbProvider tvDbProvider,
|
ISeasonProvider seasonProvider, TvDbProvider tvDbProvider,
|
||||||
IHistoryProvider history, QualityProvider quality)
|
HistoryProvider history, QualityProvider quality)
|
||||||
{
|
{
|
||||||
_sonicRepo = sonicRepo;
|
_sonicRepo = sonicRepo;
|
||||||
_series = seriesProvider;
|
_series = seriesProvider;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
namespace NzbDrone.Core.Providers.Fakes
|
namespace NzbDrone.Core.Providers.Fakes
|
||||||
{
|
{
|
||||||
class FakeNotificationProvider : INotificationProvider
|
class FakeNotificationProvider
|
||||||
{
|
{
|
||||||
private readonly Dictionary<Guid, BasicNotification> _basicNotifications = new Dictionary<Guid, BasicNotification>();
|
private readonly Dictionary<Guid, BasicNotification> _basicNotifications = new Dictionary<Guid, BasicNotification>();
|
||||||
private readonly Dictionary<Guid, ProgressNotification> _progressNotification = new Dictionary<Guid, ProgressNotification>();
|
private readonly Dictionary<Guid, ProgressNotification> _progressNotification = new Dictionary<Guid, ProgressNotification>();
|
||||||
|
@ -8,14 +8,14 @@ namespace NzbDrone.Core.Providers.Feed
|
|||||||
{
|
{
|
||||||
public abstract class FeedProviderBase
|
public abstract class FeedProviderBase
|
||||||
{
|
{
|
||||||
protected readonly ISeriesProvider _seriesProvider;
|
protected readonly SeriesProvider _seriesProvider;
|
||||||
protected readonly ISeasonProvider _seasonProvider;
|
protected readonly ISeasonProvider _seasonProvider;
|
||||||
protected readonly IEpisodeProvider _episodeProvider;
|
protected readonly IEpisodeProvider _episodeProvider;
|
||||||
protected readonly IConfigProvider _configProvider;
|
protected readonly IConfigProvider _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(ISeriesProvider seriesProvider, ISeasonProvider seasonProvider,
|
public FeedProviderBase(SeriesProvider seriesProvider, ISeasonProvider seasonProvider,
|
||||||
IEpisodeProvider episodeProvider, IConfigProvider configProvider, HttpProvider httpProvider)
|
IEpisodeProvider episodeProvider, IConfigProvider configProvider, HttpProvider httpProvider)
|
||||||
{
|
{
|
||||||
_seriesProvider = seriesProvider;
|
_seriesProvider = seriesProvider;
|
||||||
|
@ -9,7 +9,7 @@ namespace NzbDrone.Core.Providers.Feed
|
|||||||
{
|
{
|
||||||
class NzbsOrgFeedProvider : FeedProviderBase
|
class NzbsOrgFeedProvider : FeedProviderBase
|
||||||
{
|
{
|
||||||
public NzbsOrgFeedProvider(ISeriesProvider seriesProvider, ISeasonProvider seasonProvider, IEpisodeProvider episodeProvider, IConfigProvider configProvider, HttpProvider httpProvider)
|
public NzbsOrgFeedProvider(SeriesProvider seriesProvider, ISeasonProvider seasonProvider, IEpisodeProvider episodeProvider, IConfigProvider configProvider, HttpProvider httpProvider)
|
||||||
: base(seriesProvider, seasonProvider, episodeProvider, configProvider, httpProvider)
|
: base(seriesProvider, seasonProvider, episodeProvider, configProvider, httpProvider)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
namespace NzbDrone.Core.Providers
|
namespace NzbDrone.Core.Providers
|
||||||
{
|
{
|
||||||
public class HistoryProvider : IHistoryProvider
|
public class HistoryProvider
|
||||||
{
|
{
|
||||||
private readonly IRepository _sonicRepo;
|
private readonly IRepository _sonicRepo;
|
||||||
|
|
||||||
@ -20,34 +20,34 @@ public HistoryProvider(IRepository sonicRepo)
|
|||||||
_sonicRepo = sonicRepo;
|
_sonicRepo = sonicRepo;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region IHistoryProvider Members
|
#region HistoryProvider Members
|
||||||
|
|
||||||
public List<History> AllItems()
|
public virtual List<History> AllItems()
|
||||||
{
|
{
|
||||||
return _sonicRepo.All<History>().ToList();
|
return _sonicRepo.All<History>().ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Purge()
|
public virtual void Purge()
|
||||||
{
|
{
|
||||||
var all = _sonicRepo.All<History>();
|
var all = _sonicRepo.All<History>();
|
||||||
_sonicRepo.DeleteMany(all);
|
_sonicRepo.DeleteMany(all);
|
||||||
Logger.Info("History has been Purged");
|
Logger.Info("History has been Purged");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Trim()
|
public virtual void Trim()
|
||||||
{
|
{
|
||||||
var old = _sonicRepo.All<History>().Where(h => h.Date < DateTime.Now.AddDays(-30));
|
var old = _sonicRepo.All<History>().Where(h => h.Date < DateTime.Now.AddDays(-30));
|
||||||
_sonicRepo.DeleteMany(old);
|
_sonicRepo.DeleteMany(old);
|
||||||
Logger.Info("History has been trimmed, items older than 30 days have been removed");
|
Logger.Info("History has been trimmed, items older than 30 days have been removed");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Insert(History item)
|
public virtual void Insert(History item)
|
||||||
{
|
{
|
||||||
_sonicRepo.Add(item);
|
_sonicRepo.Add(item);
|
||||||
//Logger.Info("Item added to history: {0} - {1}x{2:00}", item.Episode.Series.Title, item.Episode.SeasonNumber, item.Episode.EpisodeNumber);
|
//Logger.Info("Item added to history: {0} - {1}x{2:00}", item.Episode.Series.Title, item.Episode.SeasonNumber, item.Episode.EpisodeNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Exists(int episodeId, QualityTypes quality, bool proper)
|
public virtual bool Exists(int episodeId, QualityTypes quality, bool proper)
|
||||||
{
|
{
|
||||||
//Looks for the existance of this episode in History
|
//Looks for the existance of this episode in History
|
||||||
if (_sonicRepo.Exists<History>(h => h.EpisodeId == episodeId && (QualityTypes)h.Quality == quality && h.IsProper == proper))
|
if (_sonicRepo.Exists<History>(h => h.EpisodeId == episodeId && (QualityTypes)h.Quality == quality && h.IsProper == proper))
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Providers
|
|
||||||
{
|
|
||||||
public interface IBacklogProvider
|
|
||||||
{
|
|
||||||
//Will provide Backlog Search functionality
|
|
||||||
|
|
||||||
bool StartSearch();
|
|
||||||
bool StartSearch(int seriesId);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using NzbDrone.Core.Model;
|
|
||||||
using NzbDrone.Core.Repository;
|
|
||||||
using NzbDrone.Core.Repository.Quality;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Providers
|
|
||||||
{
|
|
||||||
public interface IHistoryProvider
|
|
||||||
{
|
|
||||||
List<History> AllItems();
|
|
||||||
void Purge();
|
|
||||||
void Trim();
|
|
||||||
void Insert(History item);
|
|
||||||
bool Exists(int episodeId, QualityTypes quality, bool proper);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using NzbDrone.Core.Model;
|
|
||||||
using NzbDrone.Core.Repository;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Providers
|
|
||||||
{
|
|
||||||
public interface IIndexerProvider
|
|
||||||
{
|
|
||||||
List<Indexer> AllIndexers();
|
|
||||||
List<Indexer> EnabledIndexers();
|
|
||||||
void Update(Indexer indexer);
|
|
||||||
Indexer Single(int indexerId);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using NzbDrone.Core.Model.Notification;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Providers
|
|
||||||
{
|
|
||||||
public interface INotificationProvider
|
|
||||||
{
|
|
||||||
void Register(ProgressNotification notification);
|
|
||||||
void Register(BasicNotification notification);
|
|
||||||
|
|
||||||
List<BasicNotification> BasicNotifications { get; }
|
|
||||||
List<ProgressNotification> GetProgressNotifications { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Dismisses a notification based on its ID.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="notificationId">notification id.</param>
|
|
||||||
void Dismiss(Guid notificationId);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Providers
|
|
||||||
{
|
|
||||||
public interface IRenameProvider
|
|
||||||
{
|
|
||||||
void RenameAll();
|
|
||||||
void RenameSeries(int seriesId);
|
|
||||||
void RenameSeason(int seasonId);
|
|
||||||
void RenameEpisode(int episodeId);
|
|
||||||
void RenameEpisodeFile(int episodeFileId, bool newDownload);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,30 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using NzbDrone.Core.Repository;
|
|
||||||
using NzbDrone.Core.Repository.Quality;
|
|
||||||
using TvdbLib.Data;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Providers
|
|
||||||
{
|
|
||||||
public interface ISeriesProvider
|
|
||||||
{
|
|
||||||
IQueryable<Series> GetAllSeries();
|
|
||||||
Series GetSeries(int seriesId);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Determines if a series is being actively watched.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="id">The TVDB ID of the series</param>
|
|
||||||
/// <returns>Whether or not the show is monitored</returns>
|
|
||||||
bool IsMonitored(long id);
|
|
||||||
TvdbSeries MapPathToSeries(string path);
|
|
||||||
void AddSeries(string path, int tvDbSeriesId, int qualityProfileId);
|
|
||||||
Series FindSeries(string cleanTitle);
|
|
||||||
bool QualityWanted(int seriesId, QualityTypes quality);
|
|
||||||
void UpdateSeries(Series series);
|
|
||||||
void DeleteSeries(int seriesId);
|
|
||||||
bool SeriesPathExists(string cleanPath);
|
|
||||||
Series UpdateSeriesInfo(int seriesId);
|
|
||||||
}
|
|
||||||
}
|
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace NzbDrone.Core.Providers
|
namespace NzbDrone.Core.Providers
|
||||||
{
|
{
|
||||||
public class IndexerProvider : IIndexerProvider
|
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;
|
||||||
@ -23,24 +23,24 @@ public IndexerProvider(IRepository sonicRepo, IConfigProvider configProvider)
|
|||||||
_configProvider = configProvider;
|
_configProvider = configProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region IIndexerProvider Members
|
#region IndexerProvider Members
|
||||||
|
|
||||||
public List<Indexer> AllIndexers()
|
public virtual List<Indexer> AllIndexers()
|
||||||
{
|
{
|
||||||
return _sonicRepo.All<Indexer>().OrderBy(i => i.Order).ToList();
|
return _sonicRepo.All<Indexer>().OrderBy(i => i.Order).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Indexer> EnabledIndexers()
|
public virtual List<Indexer> EnabledIndexers()
|
||||||
{
|
{
|
||||||
return _sonicRepo.All<Indexer>().Where(i => i.Enabled).OrderBy(i => i.Order).ToList();
|
return _sonicRepo.All<Indexer>().Where(i => i.Enabled).OrderBy(i => i.Order).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Update(Indexer indexer)
|
public virtual void Update(Indexer indexer)
|
||||||
{
|
{
|
||||||
_sonicRepo.Update(indexer);
|
_sonicRepo.Update(indexer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Indexer Single(int indexerId)
|
public virtual Indexer Single(int indexerId)
|
||||||
{
|
{
|
||||||
return _sonicRepo.Single<Indexer>(indexerId);
|
return _sonicRepo.Single<Indexer>(indexerId);
|
||||||
}
|
}
|
||||||
|
@ -16,13 +16,13 @@ public class MediaFileProvider : IMediaFileProvider
|
|||||||
{
|
{
|
||||||
private readonly IRepository _repository;
|
private readonly IRepository _repository;
|
||||||
private readonly IConfigProvider _configProvider;
|
private readonly IConfigProvider _configProvider;
|
||||||
private readonly IDiskProvider _diskProvider;
|
private readonly DiskProvider _diskProvider;
|
||||||
private readonly IEpisodeProvider _episodeProvider;
|
private readonly IEpisodeProvider _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, IDiskProvider diskProvider, IEpisodeProvider episodeProvider)
|
public MediaFileProvider(IRepository repository, IConfigProvider configProvider, DiskProvider diskProvider, IEpisodeProvider episodeProvider)
|
||||||
{
|
{
|
||||||
_repository = repository;
|
_repository = repository;
|
||||||
_configProvider = configProvider;
|
_configProvider = configProvider;
|
||||||
|
@ -5,28 +5,28 @@
|
|||||||
|
|
||||||
namespace NzbDrone.Core.Providers
|
namespace NzbDrone.Core.Providers
|
||||||
{
|
{
|
||||||
class NotificationProvider : INotificationProvider
|
public class NotificationProvider
|
||||||
{
|
{
|
||||||
private readonly Dictionary<Guid, BasicNotification> _basicNotifications = new Dictionary<Guid, BasicNotification>();
|
private readonly Dictionary<Guid, BasicNotification> _basicNotifications = new Dictionary<Guid, BasicNotification>();
|
||||||
private Dictionary<Guid, ProgressNotification> _progressNotification = new Dictionary<Guid, ProgressNotification>();
|
private Dictionary<Guid, ProgressNotification> _progressNotification = new Dictionary<Guid, ProgressNotification>();
|
||||||
private readonly Object _lock = new object();
|
private readonly Object _lock = new object();
|
||||||
|
|
||||||
public void Register(ProgressNotification notification)
|
public virtual void Register(ProgressNotification notification)
|
||||||
{
|
{
|
||||||
_progressNotification.Add(notification.Id, notification);
|
_progressNotification.Add(notification.Id, notification);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Register(BasicNotification notification)
|
public virtual void Register(BasicNotification notification)
|
||||||
{
|
{
|
||||||
_basicNotifications.Add(notification.Id, notification);
|
_basicNotifications.Add(notification.Id, notification);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<BasicNotification> BasicNotifications
|
public virtual List<BasicNotification> BasicNotifications
|
||||||
{
|
{
|
||||||
get { return new List<BasicNotification>(_basicNotifications.Values); }
|
get { return new List<BasicNotification>(_basicNotifications.Values); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ProgressNotification> GetProgressNotifications
|
public virtual List<ProgressNotification> GetProgressNotifications
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
@ -34,7 +34,7 @@ public List<ProgressNotification> GetProgressNotifications
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dismiss(Guid notificationId)
|
public virtual void Dismiss(Guid notificationId)
|
||||||
{
|
{
|
||||||
lock (_lock)
|
lock (_lock)
|
||||||
{
|
{
|
||||||
|
@ -11,12 +11,12 @@ namespace NzbDrone.Core.Providers
|
|||||||
{
|
{
|
||||||
public class PostProcessingProvider
|
public class PostProcessingProvider
|
||||||
{
|
{
|
||||||
private readonly ISeriesProvider _seriesProvider;
|
private readonly SeriesProvider _seriesProvider;
|
||||||
private readonly IMediaFileProvider _mediaFileProvider;
|
private readonly IMediaFileProvider _mediaFileProvider;
|
||||||
private readonly IRenameProvider _renameProvider;
|
private readonly RenameProvider _renameProvider;
|
||||||
|
|
||||||
public PostProcessingProvider(ISeriesProvider seriesProvider,
|
public PostProcessingProvider(SeriesProvider seriesProvider,
|
||||||
IMediaFileProvider mediaFileProvider, IRenameProvider renameProvider)
|
IMediaFileProvider mediaFileProvider, RenameProvider renameProvider)
|
||||||
{
|
{
|
||||||
_seriesProvider = seriesProvider;
|
_seriesProvider = seriesProvider;
|
||||||
_mediaFileProvider = mediaFileProvider;
|
_mediaFileProvider = mediaFileProvider;
|
||||||
|
@ -12,13 +12,13 @@
|
|||||||
|
|
||||||
namespace NzbDrone.Core.Providers
|
namespace NzbDrone.Core.Providers
|
||||||
{
|
{
|
||||||
public class RenameProvider : IRenameProvider
|
public class RenameProvider
|
||||||
{
|
{
|
||||||
private readonly ISeriesProvider _seriesProvider;
|
private readonly SeriesProvider _seriesProvider;
|
||||||
private readonly ISeasonProvider _seasonProvider;
|
private readonly ISeasonProvider _seasonProvider;
|
||||||
private readonly IEpisodeProvider _episodeProvider;
|
private readonly IEpisodeProvider _episodeProvider;
|
||||||
private readonly IMediaFileProvider _mediaFileProvider;
|
private readonly IMediaFileProvider _mediaFileProvider;
|
||||||
private readonly IDiskProvider _diskProvider;
|
private readonly DiskProvider _diskProvider;
|
||||||
private readonly IConfigProvider _configProvider;
|
private readonly IConfigProvider _configProvider;
|
||||||
private readonly ExternalNotificationProvider _externalNotificationProvider;
|
private readonly ExternalNotificationProvider _externalNotificationProvider;
|
||||||
|
|
||||||
@ -27,9 +27,9 @@ public class RenameProvider : IRenameProvider
|
|||||||
|
|
||||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
public RenameProvider(ISeriesProvider seriesProvider, ISeasonProvider seasonProvider,
|
public RenameProvider(SeriesProvider seriesProvider, ISeasonProvider seasonProvider,
|
||||||
IEpisodeProvider episodeProvider, IMediaFileProvider mediaFileProvider,
|
IEpisodeProvider episodeProvider, IMediaFileProvider mediaFileProvider,
|
||||||
IDiskProvider diskProvider, IConfigProvider configProvider,
|
DiskProvider diskProvider, IConfigProvider configProvider,
|
||||||
ExternalNotificationProvider extenalNotificationProvider)
|
ExternalNotificationProvider extenalNotificationProvider)
|
||||||
{
|
{
|
||||||
_seriesProvider = seriesProvider;
|
_seriesProvider = seriesProvider;
|
||||||
@ -41,8 +41,8 @@ public RenameProvider(ISeriesProvider seriesProvider, ISeasonProvider seasonProv
|
|||||||
_externalNotificationProvider = extenalNotificationProvider;
|
_externalNotificationProvider = extenalNotificationProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region IRenameProvider Members
|
#region RenameProvider Members
|
||||||
public void RenameAll()
|
public virtual void RenameAll()
|
||||||
{
|
{
|
||||||
//Get a list of all episode files/episodes and rename them
|
//Get a list of all episode files/episodes and rename them
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ public void RenameAll()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RenameSeries(int seriesId)
|
public virtual void RenameSeries(int seriesId)
|
||||||
{
|
{
|
||||||
//Get a list of all applicable episode files/episodes and rename them
|
//Get a list of all applicable episode files/episodes and rename them
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ public void RenameSeries(int seriesId)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RenameSeason(int seasonId)
|
public virtual void RenameSeason(int seasonId)
|
||||||
{
|
{
|
||||||
//Get a list of all applicable episode files/episodes and rename them
|
//Get a list of all applicable episode files/episodes and rename them
|
||||||
var season = _seasonProvider.GetSeason(seasonId);
|
var season = _seasonProvider.GetSeason(seasonId);
|
||||||
@ -106,7 +106,7 @@ public void RenameSeason(int seasonId)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RenameEpisode(int episodeId)
|
public virtual void RenameEpisode(int episodeId)
|
||||||
{
|
{
|
||||||
//This will properly rename multi-episode files if asked to rename either of the episode
|
//This will properly rename multi-episode files if asked to rename either of the episode
|
||||||
var episode = _episodeProvider.GetEpisode(episodeId);
|
var episode = _episodeProvider.GetEpisode(episodeId);
|
||||||
@ -127,7 +127,7 @@ public void RenameEpisode(int episodeId)
|
|||||||
StartRename();
|
StartRename();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RenameEpisodeFile(int episodeFileId, bool newDownload)
|
public virtual void RenameEpisodeFile(int episodeFileId, bool newDownload)
|
||||||
{
|
{
|
||||||
//This will properly rename multi-episode files if asked to rename either of the episode
|
//This will properly rename multi-episode files if asked to rename either of the episode
|
||||||
var episodeFile = _mediaFileProvider.GetEpisodeFile(episodeFileId);
|
var episodeFile = _mediaFileProvider.GetEpisodeFile(episodeFileId);
|
||||||
|
@ -5,14 +5,9 @@
|
|||||||
|
|
||||||
namespace NzbDrone.Core.Providers
|
namespace NzbDrone.Core.Providers
|
||||||
{
|
{
|
||||||
public interface IRssSyncProvider
|
public class RssSyncProvider
|
||||||
{
|
{
|
||||||
void Begin();
|
public virtual void Begin()
|
||||||
}
|
|
||||||
|
|
||||||
public class RssSyncProvider : IRssSyncProvider
|
|
||||||
{
|
|
||||||
public void Begin()
|
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
@ -11,11 +11,11 @@ namespace NzbDrone.Core.Providers
|
|||||||
public class SeasonProvider : ISeasonProvider
|
public class SeasonProvider : ISeasonProvider
|
||||||
{
|
{
|
||||||
private readonly IRepository _sonicRepo;
|
private readonly IRepository _sonicRepo;
|
||||||
private readonly ISeriesProvider _seriesProvider;
|
private readonly SeriesProvider _seriesProvider;
|
||||||
|
|
||||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
public SeasonProvider(IRepository dataRepository, ISeriesProvider seriesProvider)
|
public SeasonProvider(IRepository dataRepository, SeriesProvider seriesProvider)
|
||||||
{
|
{
|
||||||
_sonicRepo = dataRepository;
|
_sonicRepo = dataRepository;
|
||||||
_seriesProvider = seriesProvider;
|
_seriesProvider = seriesProvider;
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
namespace NzbDrone.Core.Providers
|
namespace NzbDrone.Core.Providers
|
||||||
{
|
{
|
||||||
public class SeriesProvider : ISeriesProvider
|
public class SeriesProvider
|
||||||
{
|
{
|
||||||
//TODO: Remove parsing of rest of tv show info we just need the show name
|
//TODO: Remove parsing of rest of tv show info we just need the show name
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ public SeriesProvider(IConfigProvider configProvider,
|
|||||||
_quality = quality;
|
_quality = quality;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region ISeriesProvider Members
|
#region SeriesProvider Members
|
||||||
|
|
||||||
public virtual IQueryable<Series> GetAllSeries()
|
public virtual IQueryable<Series> GetAllSeries()
|
||||||
{
|
{
|
||||||
|
@ -13,20 +13,20 @@ namespace NzbDrone.Core.Providers
|
|||||||
{
|
{
|
||||||
public class SyncProvider : ISyncProvider
|
public class SyncProvider : ISyncProvider
|
||||||
{
|
{
|
||||||
private readonly ISeriesProvider _seriesProvider;
|
private readonly SeriesProvider _seriesProvider;
|
||||||
private readonly IEpisodeProvider _episodeProvider;
|
private readonly IEpisodeProvider _episodeProvider;
|
||||||
private readonly IMediaFileProvider _mediaFileProvider;
|
private readonly IMediaFileProvider _mediaFileProvider;
|
||||||
private readonly INotificationProvider _notificationProvider;
|
private readonly NotificationProvider _notificationProvider;
|
||||||
private readonly IDiskProvider _diskProvider;
|
private readonly DiskProvider _diskProvider;
|
||||||
|
|
||||||
private ProgressNotification _seriesSyncNotification;
|
private ProgressNotification _seriesSyncNotification;
|
||||||
private Thread _seriesSyncThread;
|
private Thread _seriesSyncThread;
|
||||||
|
|
||||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
public SyncProvider(ISeriesProvider seriesProvider, IEpisodeProvider episodeProvider,
|
public SyncProvider(SeriesProvider seriesProvider, IEpisodeProvider episodeProvider,
|
||||||
IMediaFileProvider mediaFileProvider, INotificationProvider notificationProvider,
|
IMediaFileProvider mediaFileProvider, NotificationProvider notificationProvider,
|
||||||
IDiskProvider diskProvider)
|
DiskProvider diskProvider)
|
||||||
{
|
{
|
||||||
_seriesProvider = seriesProvider;
|
_seriesProvider = seriesProvider;
|
||||||
_episodeProvider = episodeProvider;
|
_episodeProvider = episodeProvider;
|
||||||
|
@ -10,8 +10,8 @@ namespace NzbDrone.Core.Providers
|
|||||||
{
|
{
|
||||||
public class TimerProvider
|
public class TimerProvider
|
||||||
{
|
{
|
||||||
private readonly IRssSyncProvider _rssSyncProvider;
|
private readonly RssSyncProvider _rssSyncProvider;
|
||||||
private readonly ISeriesProvider _seriesProvider;
|
private readonly SeriesProvider _seriesProvider;
|
||||||
private readonly ISeasonProvider _seasonProvider;
|
private readonly ISeasonProvider _seasonProvider;
|
||||||
private readonly IEpisodeProvider _episodeProvider;
|
private readonly IEpisodeProvider _episodeProvider;
|
||||||
private readonly IMediaFileProvider _mediaFileProvider;
|
private readonly IMediaFileProvider _mediaFileProvider;
|
||||||
@ -21,7 +21,7 @@ public class TimerProvider
|
|||||||
private DateTime _rssSyncNextInterval;
|
private DateTime _rssSyncNextInterval;
|
||||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
public TimerProvider(IRssSyncProvider rssSyncProvider, ISeriesProvider seriesProvider, ISeasonProvider seasonProvider, IEpisodeProvider episodeProvider, IMediaFileProvider mediaFileProvider)
|
public TimerProvider(RssSyncProvider rssSyncProvider, SeriesProvider seriesProvider, ISeasonProvider seasonProvider, IEpisodeProvider episodeProvider, IMediaFileProvider mediaFileProvider)
|
||||||
{
|
{
|
||||||
_rssSyncProvider = rssSyncProvider;
|
_rssSyncProvider = rssSyncProvider;
|
||||||
_seriesProvider = seriesProvider;
|
_seriesProvider = seriesProvider;
|
||||||
|
@ -18,10 +18,10 @@ public class AddSeriesController : Controller
|
|||||||
private readonly IConfigProvider _configProvider;
|
private readonly IConfigProvider _configProvider;
|
||||||
private readonly QualityProvider _qualityProvider;
|
private readonly QualityProvider _qualityProvider;
|
||||||
private readonly TvDbProvider _tvDbProvider;
|
private readonly TvDbProvider _tvDbProvider;
|
||||||
private readonly ISeriesProvider _seriesProvider;
|
private readonly SeriesProvider _seriesProvider;
|
||||||
|
|
||||||
public AddSeriesController(ISyncProvider syncProvider, RootDirProvider rootFolderProvider, IConfigProvider configProvider,
|
public AddSeriesController(ISyncProvider syncProvider, RootDirProvider rootFolderProvider, IConfigProvider configProvider,
|
||||||
QualityProvider qualityProvider, TvDbProvider tvDbProvider, ISeriesProvider seriesProvider)
|
QualityProvider qualityProvider, TvDbProvider tvDbProvider, SeriesProvider seriesProvider)
|
||||||
{
|
{
|
||||||
ConfigProvider = configProvider;
|
ConfigProvider = configProvider;
|
||||||
_syncProvider = syncProvider;
|
_syncProvider = syncProvider;
|
||||||
|
@ -12,9 +12,9 @@ namespace NzbDrone.Web.Controllers
|
|||||||
{
|
{
|
||||||
public class HistoryController : Controller
|
public class HistoryController : Controller
|
||||||
{
|
{
|
||||||
private IHistoryProvider _historyProvider;
|
private HistoryProvider _historyProvider;
|
||||||
|
|
||||||
public HistoryController(IHistoryProvider historyProvider)
|
public HistoryController(HistoryProvider historyProvider)
|
||||||
{
|
{
|
||||||
_historyProvider = historyProvider;
|
_historyProvider = historyProvider;
|
||||||
}
|
}
|
||||||
|
@ -9,11 +9,11 @@ namespace NzbDrone.Web.Controllers
|
|||||||
{
|
{
|
||||||
public class NotificationController : Controller
|
public class NotificationController : Controller
|
||||||
{
|
{
|
||||||
private readonly INotificationProvider _notifications;
|
private readonly NotificationProvider _notifications;
|
||||||
//
|
//
|
||||||
// GET: /Notification/
|
// GET: /Notification/
|
||||||
|
|
||||||
public NotificationController(INotificationProvider notificationProvider)
|
public NotificationController(NotificationProvider notificationProvider)
|
||||||
{
|
{
|
||||||
_notifications = notificationProvider;
|
_notifications = notificationProvider;
|
||||||
}
|
}
|
||||||
|
@ -21,22 +21,22 @@ namespace NzbDrone.Web.Controllers
|
|||||||
[HandleError]
|
[HandleError]
|
||||||
public class SeriesController : Controller
|
public class SeriesController : Controller
|
||||||
{
|
{
|
||||||
private readonly ISeriesProvider _seriesProvider;
|
private readonly SeriesProvider _seriesProvider;
|
||||||
private readonly IEpisodeProvider _episodeProvider;
|
private readonly IEpisodeProvider _episodeProvider;
|
||||||
private readonly ISyncProvider _syncProvider;
|
private readonly ISyncProvider _syncProvider;
|
||||||
private readonly IRssSyncProvider _rssSyncProvider;
|
private readonly RssSyncProvider _rssSyncProvider;
|
||||||
private readonly QualityProvider _qualityProvider;
|
private readonly QualityProvider _qualityProvider;
|
||||||
private readonly IMediaFileProvider _mediaFileProvider;
|
private readonly IMediaFileProvider _mediaFileProvider;
|
||||||
private readonly IRenameProvider _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, ISeriesProvider seriesProvider,
|
public SeriesController(ISyncProvider syncProvider, SeriesProvider seriesProvider,
|
||||||
IEpisodeProvider episodeProvider, IRssSyncProvider rssSyncProvider,
|
IEpisodeProvider episodeProvider, RssSyncProvider rssSyncProvider,
|
||||||
QualityProvider qualityProvider, IMediaFileProvider mediaFileProvider,
|
QualityProvider qualityProvider, IMediaFileProvider mediaFileProvider,
|
||||||
IRenameProvider renameProvider, RootDirProvider rootDirProvider,
|
RenameProvider renameProvider, RootDirProvider rootDirProvider,
|
||||||
TvDbProvider tvDbProvider)
|
TvDbProvider tvDbProvider)
|
||||||
{
|
{
|
||||||
_seriesProvider = seriesProvider;
|
_seriesProvider = seriesProvider;
|
||||||
|
@ -20,7 +20,7 @@ namespace NzbDrone.Web.Controllers
|
|||||||
public class SettingsController : Controller
|
public class SettingsController : Controller
|
||||||
{
|
{
|
||||||
private IConfigProvider _configProvider;
|
private IConfigProvider _configProvider;
|
||||||
private IIndexerProvider _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, IIndexerProvider indexerProvider,
|
public SettingsController(IConfigProvider configProvider, IndexerProvider indexerProvider,
|
||||||
QualityProvider qualityProvider, RootDirProvider rootDirProvider)
|
QualityProvider qualityProvider, RootDirProvider rootDirProvider)
|
||||||
{
|
{
|
||||||
_configProvider = configProvider;
|
_configProvider = configProvider;
|
||||||
|
Loading…
Reference in New Issue
Block a user