mirror of
https://github.com/Radarr/Radarr.git
synced 2024-08-17 15:59:36 +02:00
Removed IDiskProvider.
Removed IIndexerProvider.
This commit is contained in:
parent
e5413d67d6
commit
1a9948de2f
@ -48,14 +48,14 @@ public void import_new_file()
|
||||
var episodeProvider = new Mock<IEpisodeProvider>();
|
||||
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();
|
||||
|
||||
var kernel = new MockingKernel();
|
||||
kernel.Bind<IRepository>().ToConstant(repository.Object);
|
||||
|
||||
kernel.Bind<IEpisodeProvider>().ToConstant(episodeProvider.Object);
|
||||
kernel.Bind<IDiskProvider>().ToConstant(diskProvider.Object);
|
||||
kernel.Bind<DiskProvider>().ToConstant(diskProvider.Object);
|
||||
kernel.Bind<IMediaFileProvider>().To<MediaFileProvider>();
|
||||
|
||||
//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();
|
||||
|
||||
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();
|
||||
kernel.Bind<IRepository>().ToConstant(repository.Object);
|
||||
|
||||
kernel.Bind<IEpisodeProvider>().ToConstant(episodeProvider.Object);
|
||||
kernel.Bind<IDiskProvider>().ToConstant(diskProvider.Object);
|
||||
kernel.Bind<DiskProvider>().ToConstant(diskProvider.Object);
|
||||
kernel.Bind<IMediaFileProvider>().To<MediaFileProvider>();
|
||||
|
||||
//Act
|
||||
@ -142,13 +142,13 @@ public void import_file_with_no_episode()
|
||||
var episodeProvider = new Mock<IEpisodeProvider>(MockBehavior.Strict);
|
||||
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();
|
||||
kernel.Bind<IRepository>().ToConstant(repository.Object);
|
||||
kernel.Bind<IEpisodeProvider>().ToConstant(episodeProvider.Object);
|
||||
kernel.Bind<IDiskProvider>().ToConstant(diskProvider.Object);
|
||||
kernel.Bind<DiskProvider>().ToConstant(diskProvider.Object);
|
||||
kernel.Bind<IMediaFileProvider>().To<MediaFileProvider>();
|
||||
|
||||
//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.FolderExists(It.Is<String>(d => StandardSeries.Contains(d)))).Returns(true);
|
||||
|
||||
|
@ -64,8 +64,8 @@ public static void BindKernel()
|
||||
_kernel.Bind<RssSyncProvider>().ToSelf().InSingletonScope();
|
||||
_kernel.Bind<ISeasonProvider>().To<SeasonProvider>();
|
||||
_kernel.Bind<IEpisodeProvider>().To<EpisodeProvider>();
|
||||
_kernel.Bind<UpcomingEpisodesProvider>().To<UpcomingEpisodesProvider>();
|
||||
_kernel.Bind<IDiskProvider>().To<DiskProvider>();
|
||||
_kernel.Bind<UpcomingEpisodesProvider>().ToSelf();
|
||||
_kernel.Bind<DiskProvider>().ToSelf();
|
||||
_kernel.Bind<SabProvider>().ToSelf();
|
||||
_kernel.Bind<HistoryProvider>().ToSelf();
|
||||
_kernel.Bind<RootDirProvider>().ToSelf();
|
||||
@ -74,7 +74,7 @@ public static void BindKernel()
|
||||
_kernel.Bind<PostProcessingProvider>().ToSelf();
|
||||
_kernel.Bind<IConfigProvider>().To<ConfigProvider>().InSingletonScope();
|
||||
_kernel.Bind<ISyncProvider>().To<SyncProvider>().InSingletonScope();
|
||||
_kernel.Bind<IIndexerProvider>().To<IndexerProvider>().InSingletonScope();
|
||||
_kernel.Bind<IndexerProvider>().ToSelf().InSingletonScope();
|
||||
_kernel.Bind<RenameProvider>().ToSelf().InSingletonScope();
|
||||
_kernel.Bind<NotificationProvider>().ToSelf().InSingletonScope();
|
||||
_kernel.Bind<ILogProvider>().To<LogProvider>().InSingletonScope();
|
||||
|
@ -183,7 +183,6 @@
|
||||
<Compile Include="Providers\Feed\NzbsOrgFeedProvider.cs" />
|
||||
<Compile Include="Providers\HistoryProvider.cs" />
|
||||
<Compile Include="Providers\BacklogProvider.cs" />
|
||||
<Compile Include="Providers\IIndexerProvider.cs" />
|
||||
<Compile Include="Providers\IndexerProvider.cs" />
|
||||
<Compile Include="Providers\RssSyncProvider.cs" />
|
||||
<Compile Include="Providers\PostProcessingProvider.cs" />
|
||||
@ -227,7 +226,6 @@
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Providers\Core\DiskProvider.cs" />
|
||||
<Compile Include="Providers\Core\IConfigProvider.cs" />
|
||||
<Compile Include="Providers\Core\IDiskProvider.cs" />
|
||||
<Compile Include="Providers\SeriesProvider.cs" />
|
||||
<Compile Include="Providers\TvDbProvider.cs" />
|
||||
</ItemGroup>
|
||||
|
@ -3,48 +3,48 @@
|
||||
|
||||
namespace NzbDrone.Core.Providers.Core
|
||||
{
|
||||
public class DiskProvider : IDiskProvider
|
||||
public class DiskProvider
|
||||
{
|
||||
#region IDiskProvider Members
|
||||
|
||||
public bool FolderExists(string path)
|
||||
public virtual bool FolderExists(string path)
|
||||
{
|
||||
return Directory.Exists(path);
|
||||
}
|
||||
|
||||
public bool FileExists(string path)
|
||||
public virtual bool FileExists(string path)
|
||||
{
|
||||
return File.Exists(path);
|
||||
}
|
||||
|
||||
public string[] GetDirectories(string path)
|
||||
public virtual string[] GetDirectories(string 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);
|
||||
}
|
||||
|
||||
public long GetSize(string path)
|
||||
public virtual long GetSize(string path)
|
||||
{
|
||||
var fi = new FileInfo(path);
|
||||
return fi.Length;
|
||||
//return new FileInfo(path).Length;
|
||||
}
|
||||
|
||||
public String CreateDirectory(string path)
|
||||
public virtual String CreateDirectory(string path)
|
||||
{
|
||||
return Directory.CreateDirectory(path).FullName;
|
||||
}
|
||||
|
||||
public void DeleteFile(string path)
|
||||
public virtual void DeleteFile(string path)
|
||||
{
|
||||
File.Delete(path);
|
||||
}
|
||||
|
||||
public void RenameFile(string sourcePath, string destinationPath)
|
||||
public virtual void RenameFile(string sourcePath, string 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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -11,7 +11,7 @@
|
||||
|
||||
namespace NzbDrone.Core.Providers
|
||||
{
|
||||
public class IndexerProvider : IIndexerProvider
|
||||
public class IndexerProvider
|
||||
{
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
private readonly IRepository _sonicRepo;
|
||||
@ -23,24 +23,24 @@ public IndexerProvider(IRepository sonicRepo, IConfigProvider 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();
|
||||
}
|
||||
|
||||
public List<Indexer> EnabledIndexers()
|
||||
public virtual List<Indexer> EnabledIndexers()
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
public Indexer Single(int indexerId)
|
||||
public virtual Indexer Single(int indexerId)
|
||||
{
|
||||
return _sonicRepo.Single<Indexer>(indexerId);
|
||||
}
|
||||
|
@ -16,13 +16,13 @@ public class MediaFileProvider : IMediaFileProvider
|
||||
{
|
||||
private readonly IRepository _repository;
|
||||
private readonly IConfigProvider _configProvider;
|
||||
private readonly IDiskProvider _diskProvider;
|
||||
private readonly DiskProvider _diskProvider;
|
||||
private readonly IEpisodeProvider _episodeProvider;
|
||||
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
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;
|
||||
_configProvider = configProvider;
|
||||
|
@ -18,7 +18,7 @@ public class RenameProvider
|
||||
private readonly ISeasonProvider _seasonProvider;
|
||||
private readonly IEpisodeProvider _episodeProvider;
|
||||
private readonly IMediaFileProvider _mediaFileProvider;
|
||||
private readonly IDiskProvider _diskProvider;
|
||||
private readonly DiskProvider _diskProvider;
|
||||
private readonly IConfigProvider _configProvider;
|
||||
private readonly ExternalNotificationProvider _externalNotificationProvider;
|
||||
|
||||
@ -29,7 +29,7 @@ public class RenameProvider
|
||||
|
||||
public RenameProvider(SeriesProvider seriesProvider, ISeasonProvider seasonProvider,
|
||||
IEpisodeProvider episodeProvider, IMediaFileProvider mediaFileProvider,
|
||||
IDiskProvider diskProvider, IConfigProvider configProvider,
|
||||
DiskProvider diskProvider, IConfigProvider configProvider,
|
||||
ExternalNotificationProvider extenalNotificationProvider)
|
||||
{
|
||||
_seriesProvider = seriesProvider;
|
||||
|
@ -17,7 +17,7 @@ public class SyncProvider : ISyncProvider
|
||||
private readonly IEpisodeProvider _episodeProvider;
|
||||
private readonly IMediaFileProvider _mediaFileProvider;
|
||||
private readonly NotificationProvider _notificationProvider;
|
||||
private readonly IDiskProvider _diskProvider;
|
||||
private readonly DiskProvider _diskProvider;
|
||||
|
||||
private ProgressNotification _seriesSyncNotification;
|
||||
private Thread _seriesSyncThread;
|
||||
@ -26,7 +26,7 @@ public class SyncProvider : ISyncProvider
|
||||
|
||||
public SyncProvider(SeriesProvider seriesProvider, IEpisodeProvider episodeProvider,
|
||||
IMediaFileProvider mediaFileProvider, NotificationProvider notificationProvider,
|
||||
IDiskProvider diskProvider)
|
||||
DiskProvider diskProvider)
|
||||
{
|
||||
_seriesProvider = seriesProvider;
|
||||
_episodeProvider = episodeProvider;
|
||||
|
@ -20,7 +20,7 @@ namespace NzbDrone.Web.Controllers
|
||||
public class SettingsController : Controller
|
||||
{
|
||||
private IConfigProvider _configProvider;
|
||||
private IIndexerProvider _indexerProvider;
|
||||
private IndexerProvider _indexerProvider;
|
||||
private QualityProvider _qualityProvider;
|
||||
private RootDirProvider _rootDirProvider;
|
||||
|
||||
@ -28,7 +28,7 @@ public class SettingsController : Controller
|
||||
private const string SETTINGS_SAVED = "Settings Saved.";
|
||||
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)
|
||||
{
|
||||
_configProvider = configProvider;
|
||||
|
Loading…
Reference in New Issue
Block a user