Merge branch 'mark-fork'

pull/7/merge
kay.one 14 years ago
commit 8fbc79c50d

@ -66,7 +66,7 @@ namespace NzbDrone.Core.Test
{
//Setup
var season = new Mock<ISeasonProvider>();
var series = new Mock<ISeriesProvider>();
var series = new Mock<SeriesProvider>();
//var history = new Mock<IHistoryProvider>();
//var quality = new Mock<IQualityProvider>();
var repo = new Mock<IRepository>();

@ -48,14 +48,14 @@ namespace NzbDrone.Core.Test
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 @@ namespace NzbDrone.Core.Test
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 @@ namespace NzbDrone.Core.Test
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 @@ namespace NzbDrone.Core.Test
}
}
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);

@ -93,6 +93,7 @@
<Compile Include="AutoMoq\Unity\AutoMockingContainerExtension.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="RootDirProviderTest.cs" />
<Compile Include="RssProviderTest.cs" />
<Compile Include="HistoryProviderTest.cs" />
<Compile Include="MediaFileProviderTests.cs" />

@ -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 @@ namespace NzbDrone.Core.Test
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)
{
}

@ -60,26 +60,26 @@ namespace NzbDrone.Core
_kernel.Bind<QualityProvider>().ToSelf();
_kernel.Bind<TvDbProvider>().ToSelf();
_kernel.Bind<HttpProvider>().ToSelf();
_kernel.Bind<ISeriesProvider>().To<SeriesProvider>().InSingletonScope();
_kernel.Bind<IRssSyncProvider>().To<RssSyncProvider>().InSingletonScope();
_kernel.Bind<SeriesProvider>().ToSelf().InSingletonScope();
_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<SabProvider>().To<SabProvider>();
_kernel.Bind<IHistoryProvider>().To<HistoryProvider>();
_kernel.Bind<RootDirProvider>().To<RootDirProvider>();
_kernel.Bind<ExternalNotificationProvider>().To<ExternalNotificationProvider>();
_kernel.Bind<XbmcProvider>().To<XbmcProvider>();
_kernel.Bind<PostProcessingProvider>().To<PostProcessingProvider>();
_kernel.Bind<UpcomingEpisodesProvider>().ToSelf();
_kernel.Bind<DiskProvider>().ToSelf();
_kernel.Bind<SabProvider>().ToSelf();
_kernel.Bind<HistoryProvider>().ToSelf();
_kernel.Bind<RootDirProvider>().ToSelf();
_kernel.Bind<ExternalNotificationProvider>().ToSelf();
_kernel.Bind<XbmcProvider>().ToSelf();
_kernel.Bind<PostProcessingProvider>().ToSelf();
_kernel.Bind<IConfigProvider>().To<ConfigProvider>().InSingletonScope();
_kernel.Bind<ISyncProvider>().To<SyncProvider>().InSingletonScope();
_kernel.Bind<IIndexerProvider>().To<IndexerProvider>().InSingletonScope();
_kernel.Bind<IRenameProvider>().To<RenameProvider>().InSingletonScope();
_kernel.Bind<INotificationProvider>().To<NotificationProvider>().InSingletonScope();
_kernel.Bind<IndexerProvider>().ToSelf().InSingletonScope();
_kernel.Bind<RenameProvider>().ToSelf().InSingletonScope();
_kernel.Bind<NotificationProvider>().ToSelf().InSingletonScope();
_kernel.Bind<ILogProvider>().To<LogProvider>().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>().ToConstant(logRepository).WhenInjectedInto<SubsonicTarget>().InSingletonScope();

@ -182,12 +182,9 @@
<Compile Include="Providers\ExternalNotificationProvider.cs" />
<Compile Include="Providers\Feed\NzbsOrgFeedProvider.cs" />
<Compile Include="Providers\HistoryProvider.cs" />
<Compile Include="Providers\IBacklogProvider.cs" />
<Compile Include="Providers\IHistoryProvider.cs" />
<Compile Include="Providers\IIndexerProvider.cs" />
<Compile Include="Providers\BacklogProvider.cs" />
<Compile Include="Providers\IndexerProvider.cs" />
<Compile Include="Providers\IRenameProvider.cs" />
<Compile Include="Providers\IRssSyncProvider.cs" />
<Compile Include="Providers\RssSyncProvider.cs" />
<Compile Include="Providers\PostProcessingProvider.cs" />
<Compile Include="Providers\QualityProvider.cs" />
<Compile Include="Providers\RenameProvider.cs" />
@ -203,7 +200,6 @@
<Compile Include="Parser.cs" />
<Compile Include="Providers\Fakes\FakeNotificationProvider.cs" />
<Compile Include="Providers\IMediaFileProvider.cs" />
<Compile Include="Providers\INotificationProvider.cs" />
<Compile Include="Providers\ISyncProvider.cs" />
<Compile Include="Providers\MediaFileProvider.cs" />
<Compile Include="Providers\SyncProvider.cs" />
@ -214,7 +210,6 @@
<Compile Include="Providers\Core\HttpProvider.cs" />
<Compile Include="Providers\IEpisodeProvider.cs" />
<Compile Include="Providers\ISeasonProvider.cs" />
<Compile Include="Providers\ISeriesProvider.cs" />
<Compile Include="Providers\SabProvider.cs" />
<Compile Include="Providers\SeasonProvider.cs" />
<Compile Include="Repository\Episode.cs" />
@ -231,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>

@ -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 @@ using System.IO;
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);
}
}

@ -14,16 +14,16 @@ namespace NzbDrone.Core.Providers
//TODO: Remove parsing of the series name, it should be done in series provider
private readonly IRepository _sonicRepo;
private readonly ISeriesProvider _series;
private readonly SeriesProvider _series;
private readonly ISeasonProvider _seasons;
private readonly TvDbProvider _tvDb;
private readonly IHistoryProvider _history;
private readonly HistoryProvider _history;
private readonly QualityProvider _quality;
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
public EpisodeProvider(IRepository sonicRepo, ISeriesProvider seriesProvider,
public EpisodeProvider(IRepository sonicRepo, SeriesProvider seriesProvider,
ISeasonProvider seasonProvider, TvDbProvider tvDbProvider,
IHistoryProvider history, QualityProvider quality)
HistoryProvider history, QualityProvider quality)
{
_sonicRepo = sonicRepo;
_series = seriesProvider;

@ -4,7 +4,7 @@ using NzbDrone.Core.Model.Notification;
namespace NzbDrone.Core.Providers.Fakes
{
class FakeNotificationProvider : INotificationProvider
class FakeNotificationProvider
{
private readonly Dictionary<Guid, BasicNotification> _basicNotifications = new Dictionary<Guid, BasicNotification>();
private readonly Dictionary<Guid, ProgressNotification> _progressNotification = new Dictionary<Guid, ProgressNotification>();

@ -8,14 +8,14 @@ namespace NzbDrone.Core.Providers.Feed
{
public abstract class FeedProviderBase
{
protected readonly ISeriesProvider _seriesProvider;
protected readonly SeriesProvider _seriesProvider;
protected readonly ISeasonProvider _seasonProvider;
protected readonly IEpisodeProvider _episodeProvider;
protected readonly IConfigProvider _configProvider;
private readonly HttpProvider _httpProvider;
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)
{
_seriesProvider = seriesProvider;

@ -9,7 +9,7 @@ namespace NzbDrone.Core.Providers.Feed
{
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)
{
}

@ -9,7 +9,7 @@ using SubSonic.Repository;
namespace NzbDrone.Core.Providers
{
public class HistoryProvider : IHistoryProvider
public class HistoryProvider
{
private readonly IRepository _sonicRepo;
@ -20,34 +20,34 @@ namespace NzbDrone.Core.Providers
_sonicRepo = sonicRepo;
}
#region IHistoryProvider Members
#region HistoryProvider Members
public List<History> AllItems()
public virtual List<History> AllItems()
{
return _sonicRepo.All<History>().ToList();
}
public void Purge()
public virtual void Purge()
{
var all = _sonicRepo.All<History>();
_sonicRepo.DeleteMany(all);
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));
_sonicRepo.DeleteMany(old);
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);
//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
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 @@ using NzbDrone.Core.Repository;
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 @@ namespace NzbDrone.Core.Providers
_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 @@ namespace NzbDrone.Core.Providers
{
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;

@ -5,28 +5,28 @@ using NzbDrone.Core.Model.Notification;
namespace NzbDrone.Core.Providers
{
class NotificationProvider : INotificationProvider
public class NotificationProvider
{
private readonly Dictionary<Guid, BasicNotification> _basicNotifications = new Dictionary<Guid, BasicNotification>();
private Dictionary<Guid, ProgressNotification> _progressNotification = new Dictionary<Guid, ProgressNotification>();
private readonly Object _lock = new object();
public void Register(ProgressNotification notification)
public virtual void Register(ProgressNotification notification)
{
_progressNotification.Add(notification.Id, notification);
}
public void Register(BasicNotification notification)
public virtual void Register(BasicNotification notification)
{
_basicNotifications.Add(notification.Id, notification);
}
public List<BasicNotification> BasicNotifications
public virtual List<BasicNotification> BasicNotifications
{
get { return new List<BasicNotification>(_basicNotifications.Values); }
}
public List<ProgressNotification> GetProgressNotifications
public virtual List<ProgressNotification> GetProgressNotifications
{
get
{
@ -34,7 +34,7 @@ namespace NzbDrone.Core.Providers
}
}
public void Dismiss(Guid notificationId)
public virtual void Dismiss(Guid notificationId)
{
lock (_lock)
{

@ -11,12 +11,12 @@ namespace NzbDrone.Core.Providers
{
public class PostProcessingProvider
{
private readonly ISeriesProvider _seriesProvider;
private readonly SeriesProvider _seriesProvider;
private readonly IMediaFileProvider _mediaFileProvider;
private readonly IRenameProvider _renameProvider;
private readonly RenameProvider _renameProvider;
public PostProcessingProvider(ISeriesProvider seriesProvider,
IMediaFileProvider mediaFileProvider, IRenameProvider renameProvider)
public PostProcessingProvider(SeriesProvider seriesProvider,
IMediaFileProvider mediaFileProvider, RenameProvider renameProvider)
{
_seriesProvider = seriesProvider;
_mediaFileProvider = mediaFileProvider;

@ -12,13 +12,13 @@ using NzbDrone.Core.Repository;
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 IEpisodeProvider _episodeProvider;
private readonly IMediaFileProvider _mediaFileProvider;
private readonly IDiskProvider _diskProvider;
private readonly DiskProvider _diskProvider;
private readonly IConfigProvider _configProvider;
private readonly ExternalNotificationProvider _externalNotificationProvider;
@ -27,9 +27,9 @@ namespace NzbDrone.Core.Providers
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
public RenameProvider(ISeriesProvider seriesProvider, ISeasonProvider seasonProvider,
public RenameProvider(SeriesProvider seriesProvider, ISeasonProvider seasonProvider,
IEpisodeProvider episodeProvider, IMediaFileProvider mediaFileProvider,
IDiskProvider diskProvider, IConfigProvider configProvider,
DiskProvider diskProvider, IConfigProvider configProvider,
ExternalNotificationProvider extenalNotificationProvider)
{
_seriesProvider = seriesProvider;
@ -41,8 +41,8 @@ namespace NzbDrone.Core.Providers
_externalNotificationProvider = extenalNotificationProvider;
}
#region IRenameProvider Members
public void RenameAll()
#region RenameProvider Members
public virtual void RenameAll()
{
//Get a list of all episode files/episodes and rename them
@ -61,8 +61,8 @@ namespace NzbDrone.Core.Providers
StartRename();
}
}
public void RenameSeries(int seriesId)
public virtual void RenameSeries(int seriesId)
{
//Get a list of all applicable episode files/episodes and rename them
@ -83,8 +83,8 @@ namespace NzbDrone.Core.Providers
StartRename();
}
}
public void RenameSeason(int seasonId)
public virtual void RenameSeason(int seasonId)
{
//Get a list of all applicable episode files/episodes and rename them
var season = _seasonProvider.GetSeason(seasonId);
@ -105,8 +105,8 @@ namespace NzbDrone.Core.Providers
StartRename();
}
}
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
var episode = _episodeProvider.GetEpisode(episodeId);
@ -126,8 +126,8 @@ namespace NzbDrone.Core.Providers
_epsToRename.Add(erm);
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
var episodeFile = _mediaFileProvider.GetEpisodeFile(episodeFileId);

@ -5,14 +5,9 @@ using System.Text;
namespace NzbDrone.Core.Providers
{
public interface IRssSyncProvider
public class RssSyncProvider
{
void Begin();
}
public class RssSyncProvider : IRssSyncProvider
{
public void Begin()
public virtual void Begin()
{
}

@ -11,11 +11,11 @@ namespace NzbDrone.Core.Providers
public class SeasonProvider : ISeasonProvider
{
private readonly IRepository _sonicRepo;
private readonly ISeriesProvider _seriesProvider;
private readonly SeriesProvider _seriesProvider;
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
public SeasonProvider(IRepository dataRepository, ISeriesProvider seriesProvider)
public SeasonProvider(IRepository dataRepository, SeriesProvider seriesProvider)
{
_sonicRepo = dataRepository;
_seriesProvider = seriesProvider;

@ -13,7 +13,7 @@ using TvdbLib.Data;
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
@ -34,7 +34,7 @@ namespace NzbDrone.Core.Providers
_quality = quality;
}
#region ISeriesProvider Members
#region SeriesProvider Members
public virtual IQueryable<Series> GetAllSeries()
{

@ -13,20 +13,20 @@ namespace NzbDrone.Core.Providers
{
public class SyncProvider : ISyncProvider
{
private readonly ISeriesProvider _seriesProvider;
private readonly SeriesProvider _seriesProvider;
private readonly IEpisodeProvider _episodeProvider;
private readonly IMediaFileProvider _mediaFileProvider;
private readonly INotificationProvider _notificationProvider;
private readonly IDiskProvider _diskProvider;
private readonly NotificationProvider _notificationProvider;
private readonly DiskProvider _diskProvider;
private ProgressNotification _seriesSyncNotification;
private Thread _seriesSyncThread;
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
public SyncProvider(ISeriesProvider seriesProvider, IEpisodeProvider episodeProvider,
IMediaFileProvider mediaFileProvider, INotificationProvider notificationProvider,
IDiskProvider diskProvider)
public SyncProvider(SeriesProvider seriesProvider, IEpisodeProvider episodeProvider,
IMediaFileProvider mediaFileProvider, NotificationProvider notificationProvider,
DiskProvider diskProvider)
{
_seriesProvider = seriesProvider;
_episodeProvider = episodeProvider;

@ -10,8 +10,8 @@ namespace NzbDrone.Core.Providers
{
public class TimerProvider
{
private readonly IRssSyncProvider _rssSyncProvider;
private readonly ISeriesProvider _seriesProvider;
private readonly RssSyncProvider _rssSyncProvider;
private readonly SeriesProvider _seriesProvider;
private readonly ISeasonProvider _seasonProvider;
private readonly IEpisodeProvider _episodeProvider;
private readonly IMediaFileProvider _mediaFileProvider;
@ -21,7 +21,7 @@ namespace NzbDrone.Core.Providers
private DateTime _rssSyncNextInterval;
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;
_seriesProvider = seriesProvider;

@ -18,10 +18,10 @@ namespace NzbDrone.Web.Controllers
private readonly IConfigProvider _configProvider;
private readonly QualityProvider _qualityProvider;
private readonly TvDbProvider _tvDbProvider;
private readonly ISeriesProvider _seriesProvider;
private readonly SeriesProvider _seriesProvider;
public AddSeriesController(ISyncProvider syncProvider, RootDirProvider rootFolderProvider, IConfigProvider configProvider,
QualityProvider qualityProvider, TvDbProvider tvDbProvider, ISeriesProvider seriesProvider)
QualityProvider qualityProvider, TvDbProvider tvDbProvider, SeriesProvider seriesProvider)
{
ConfigProvider = configProvider;
_syncProvider = syncProvider;

@ -12,9 +12,9 @@ namespace NzbDrone.Web.Controllers
{
public class HistoryController : Controller
{
private IHistoryProvider _historyProvider;
private HistoryProvider _historyProvider;
public HistoryController(IHistoryProvider historyProvider)
public HistoryController(HistoryProvider historyProvider)
{
_historyProvider = historyProvider;
}

@ -9,11 +9,11 @@ namespace NzbDrone.Web.Controllers
{
public class NotificationController : Controller
{
private readonly INotificationProvider _notifications;
private readonly NotificationProvider _notifications;
//
// GET: /Notification/
public NotificationController(INotificationProvider notificationProvider)
public NotificationController(NotificationProvider notificationProvider)
{
_notifications = notificationProvider;
}

@ -21,22 +21,22 @@ namespace NzbDrone.Web.Controllers
[HandleError]
public class SeriesController : Controller
{
private readonly ISeriesProvider _seriesProvider;
private readonly SeriesProvider _seriesProvider;
private readonly IEpisodeProvider _episodeProvider;
private readonly ISyncProvider _syncProvider;
private readonly IRssSyncProvider _rssSyncProvider;
private readonly RssSyncProvider _rssSyncProvider;
private readonly QualityProvider _qualityProvider;
private readonly IMediaFileProvider _mediaFileProvider;
private readonly IRenameProvider _renameProvider;
private readonly RenameProvider _renameProvider;
private readonly RootDirProvider _rootDirProvider;
private readonly TvDbProvider _tvDbProvider;
//
// GET: /Series/
public SeriesController(ISyncProvider syncProvider, ISeriesProvider seriesProvider,
IEpisodeProvider episodeProvider, IRssSyncProvider rssSyncProvider,
public SeriesController(ISyncProvider syncProvider, SeriesProvider seriesProvider,
IEpisodeProvider episodeProvider, RssSyncProvider rssSyncProvider,
QualityProvider qualityProvider, IMediaFileProvider mediaFileProvider,
IRenameProvider renameProvider, RootDirProvider rootDirProvider,
RenameProvider renameProvider, RootDirProvider rootDirProvider,
TvDbProvider tvDbProvider)
{
_seriesProvider = seriesProvider;

@ -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 @@ namespace NzbDrone.Web.Controllers
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…
Cancel
Save