From add780b431d4c82fa3ea7e790f50e63d26dad129 Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Mon, 13 Jun 2011 18:23:04 -0700 Subject: [PATCH] Ninject is now forced to use proper constructor. --- NzbDrone.Core/CentralDispatch.cs | 1 - .../Providers/AutoConfigureProvider.cs | 9 ++---- NzbDrone.Core/Providers/BacklogProvider.cs | 19 ------------ .../Providers/Core/ConfigProvider.cs | 2 ++ NzbDrone.Core/Providers/DownloadProvider.cs | 2 ++ NzbDrone.Core/Providers/EpisodeProvider.cs | Bin 11661 -> 11695 bytes .../Providers/ExternalNotificationProvider.cs | 2 ++ NzbDrone.Core/Providers/HistoryProvider.cs | 2 ++ .../Providers/Indexer/IndexerBase.cs | 2 ++ NzbDrone.Core/Providers/Indexer/Newzbin.cs | 2 ++ NzbDrone.Core/Providers/Indexer/NzbMatrix.cs | 2 ++ NzbDrone.Core/Providers/Indexer/NzbsOrg.cs | 2 ++ NzbDrone.Core/Providers/Indexer/NzbsRUs.cs | 2 ++ NzbDrone.Core/Providers/IndexerProvider.cs | 2 ++ NzbDrone.Core/Providers/InventoryProvider.cs | 2 ++ .../Providers/Jobs/DeleteSeriesJob.cs | 2 ++ NzbDrone.Core/Providers/Jobs/DiskScanJob.cs | 2 ++ .../Providers/Jobs/EpisodeSearchJob.cs | 6 ++-- .../Providers/Jobs/ImportNewSeriesJob.cs | 28 ++++++++++-------- NzbDrone.Core/Providers/Jobs/JobProvider.cs | 2 ++ .../Providers/Jobs/PostDownloadScanJob.cs | 2 ++ .../Providers/Jobs/RenameEpisodeJob.cs | 2 ++ NzbDrone.Core/Providers/Jobs/RssSyncJob.cs | 2 ++ NzbDrone.Core/Providers/Jobs/UpdateInfoJob.cs | 4 ++- NzbDrone.Core/Providers/MediaFileProvider.cs | 2 ++ NzbDrone.Core/Providers/QualityProvider.cs | 2 ++ NzbDrone.Core/Providers/RootDirProvider.cs | 3 +- NzbDrone.Core/Providers/SabProvider.cs | 2 ++ NzbDrone.Core/Providers/SeriesProvider.cs | 5 ++-- NzbDrone.Core/Providers/StatsProvider.cs | 2 ++ .../Providers/UpcomingEpisodesProvider.cs | 4 ++- NzbDrone.Core/Providers/XbmcProvider.cs | 2 ++ .../Controllers/AddSeriesController.cs | 11 ++++--- .../Controllers/NotificationController.cs | 7 +++++ 34 files changed, 88 insertions(+), 53 deletions(-) delete mode 100644 NzbDrone.Core/Providers/BacklogProvider.cs diff --git a/NzbDrone.Core/CentralDispatch.cs b/NzbDrone.Core/CentralDispatch.cs index c4a3c3dd5..a1e4b894c 100644 --- a/NzbDrone.Core/CentralDispatch.cs +++ b/NzbDrone.Core/CentralDispatch.cs @@ -86,7 +86,6 @@ namespace NzbDrone.Core _kernel.Bind().ToSelf().InSingletonScope(); _kernel.Bind().ToSelf().InSingletonScope(); _kernel.Bind().To().InSingletonScope(); - _kernel.Bind().ToSelf().InSingletonScope(); _kernel.Bind().ToSelf().InSingletonScope(); _kernel.Bind().ToSelf().InSingletonScope(); _kernel.Bind().ToSelf().InSingletonScope(); diff --git a/NzbDrone.Core/Providers/AutoConfigureProvider.cs b/NzbDrone.Core/Providers/AutoConfigureProvider.cs index 8357ba1e7..2075825b6 100644 --- a/NzbDrone.Core/Providers/AutoConfigureProvider.cs +++ b/NzbDrone.Core/Providers/AutoConfigureProvider.cs @@ -13,9 +13,6 @@ namespace NzbDrone.Core.Providers { public class AutoConfigureProvider { - public AutoConfigureProvider() - { - } public SabnzbdInfoModel AutoConfigureSab() { @@ -29,8 +26,7 @@ namespace NzbDrone.Core.Providers var info = ipProperties.GetActiveTcpListeners().Select( p => - new ConnectionInfoModel - {Address = p.Address.ToString().Replace("0.0.0.0", "127.0.0.1"), Port = p.Port}).Distinct(). + new ConnectionInfoModel { Address = p.Address.ToString().Replace("0.0.0.0", "127.0.0.1"), Port = p.Port }).Distinct(). ToList(); info.RemoveAll(i => i.Port == 135); @@ -51,7 +47,8 @@ namespace NzbDrone.Core.Providers { var apiKey = GetApiKey(connection.Address, connection.Port); if (!String.IsNullOrEmpty(apiKey)) - return new SabnzbdInfoModel { + return new SabnzbdInfoModel + { Host = connection.Address, Port = connection.Port, ApiKey = apiKey diff --git a/NzbDrone.Core/Providers/BacklogProvider.cs b/NzbDrone.Core/Providers/BacklogProvider.cs deleted file mode 100644 index 06e7fc9b6..000000000 --- a/NzbDrone.Core/Providers/BacklogProvider.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; - -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(); - } - } -} \ No newline at end of file diff --git a/NzbDrone.Core/Providers/Core/ConfigProvider.cs b/NzbDrone.Core/Providers/Core/ConfigProvider.cs index 1984b8afc..f1afecabb 100644 --- a/NzbDrone.Core/Providers/Core/ConfigProvider.cs +++ b/NzbDrone.Core/Providers/Core/ConfigProvider.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using Ninject; using NLog; using NzbDrone.Core.Model; using NzbDrone.Core.Repository; @@ -13,6 +14,7 @@ namespace NzbDrone.Core.Providers.Core private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); private readonly IRepository _repository; + [Inject] public ConfigProvider(IRepository repository) { _repository = repository; diff --git a/NzbDrone.Core/Providers/DownloadProvider.cs b/NzbDrone.Core/Providers/DownloadProvider.cs index 5c238a983..dfb751802 100644 --- a/NzbDrone.Core/Providers/DownloadProvider.cs +++ b/NzbDrone.Core/Providers/DownloadProvider.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using Ninject; using NLog; using NzbDrone.Core.Model; using NzbDrone.Core.Providers.Core; @@ -17,6 +18,7 @@ namespace NzbDrone.Core.Providers private readonly EpisodeProvider _episodeProvider; private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); + [Inject] public DownloadProvider(SabProvider sabProvider, HistoryProvider historyProvider, EpisodeProvider episodeProvider) { _sabProvider = sabProvider; diff --git a/NzbDrone.Core/Providers/EpisodeProvider.cs b/NzbDrone.Core/Providers/EpisodeProvider.cs index bab8a744a176aec42ae01b0b3de90bf73b6fdd0c..df43746e101371c0b02be91827d9538c25fc6f60 100644 GIT binary patch delta 31 jcmeB;ULQRno-H#kD>b=fV`vj2N3 _indexers = new List(); + [Inject] public IndexerProvider(IRepository repository) { _repository = repository; diff --git a/NzbDrone.Core/Providers/InventoryProvider.cs b/NzbDrone.Core/Providers/InventoryProvider.cs index 4c81bba73..ffe3931ca 100644 --- a/NzbDrone.Core/Providers/InventoryProvider.cs +++ b/NzbDrone.Core/Providers/InventoryProvider.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using Ninject; using NLog; using NzbDrone.Core.Model; using NzbDrone.Core.Repository; @@ -15,6 +16,7 @@ namespace NzbDrone.Core.Providers private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); + [Inject] public InventoryProvider(SeriesProvider seriesProvider, EpisodeProvider episodeProvider, HistoryProvider historyProvider) { _seriesProvider = seriesProvider; diff --git a/NzbDrone.Core/Providers/Jobs/DeleteSeriesJob.cs b/NzbDrone.Core/Providers/Jobs/DeleteSeriesJob.cs index 1f3d63ca1..800c470af 100644 --- a/NzbDrone.Core/Providers/Jobs/DeleteSeriesJob.cs +++ b/NzbDrone.Core/Providers/Jobs/DeleteSeriesJob.cs @@ -1,6 +1,7 @@ using System; using System.IO; using System.Linq; +using Ninject; using NLog; using NzbDrone.Core.Model.Notification; using NzbDrone.Core.Repository; @@ -14,6 +15,7 @@ namespace NzbDrone.Core.Providers.Jobs private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); + [Inject] public DeleteSeriesJob(SeriesProvider seriesProvider) { _seriesProvider = seriesProvider; diff --git a/NzbDrone.Core/Providers/Jobs/DiskScanJob.cs b/NzbDrone.Core/Providers/Jobs/DiskScanJob.cs index 12ec61781..9944d2d28 100644 --- a/NzbDrone.Core/Providers/Jobs/DiskScanJob.cs +++ b/NzbDrone.Core/Providers/Jobs/DiskScanJob.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using Ninject; using NLog; using NzbDrone.Core.Model.Notification; using NzbDrone.Core.Repository; @@ -14,6 +15,7 @@ namespace NzbDrone.Core.Providers.Jobs private readonly MediaFileProvider _mediaFileProvider; private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); + [Inject] public DiskScanJob(SeriesProvider seriesProvider, MediaFileProvider mediaFileProvider) { _seriesProvider = seriesProvider; diff --git a/NzbDrone.Core/Providers/Jobs/EpisodeSearchJob.cs b/NzbDrone.Core/Providers/Jobs/EpisodeSearchJob.cs index bbb151fa5..6afd25d93 100644 --- a/NzbDrone.Core/Providers/Jobs/EpisodeSearchJob.cs +++ b/NzbDrone.Core/Providers/Jobs/EpisodeSearchJob.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using Ninject; using NLog; using NzbDrone.Core.Helpers; using NzbDrone.Core.Model; @@ -20,6 +21,7 @@ namespace NzbDrone.Core.Providers.Jobs private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); + [Inject] public EpisodeSearchJob(InventoryProvider inventoryProvider, DownloadProvider downloadProvider, IndexerProvider indexerProvider, EpisodeProvider episodeProvider) { _inventoryProvider = inventoryProvider; @@ -44,7 +46,7 @@ namespace NzbDrone.Core.Providers.Jobs throw new ArgumentOutOfRangeException("targetId"); var episode = _episodeProvider.GetEpisode(targetId); - + if (episode == null) { Logger.Error("Unable to find an episode {0} in database", targetId); @@ -58,7 +60,7 @@ namespace NzbDrone.Core.Providers.Jobs var title = SceneNameHelper.GetTitleById(series.SeriesId); - if(string.IsNullOrWhiteSpace(title)) + if (string.IsNullOrWhiteSpace(title)) { title = series.Title; } diff --git a/NzbDrone.Core/Providers/Jobs/ImportNewSeriesJob.cs b/NzbDrone.Core/Providers/Jobs/ImportNewSeriesJob.cs index 1f349d934..6e90fcdbf 100644 --- a/NzbDrone.Core/Providers/Jobs/ImportNewSeriesJob.cs +++ b/NzbDrone.Core/Providers/Jobs/ImportNewSeriesJob.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using Ninject; using NLog; using NzbDrone.Core.Model.Notification; using NzbDrone.Core.Repository; @@ -23,12 +24,13 @@ namespace NzbDrone.Core.Providers.Jobs private List _attemptedSeries; + [Inject] public ImportNewSeriesJob(SeriesProvider seriesProvider, MediaFileProvider mediaFileProvider, UpdateInfoJob updateInfoJob, DiskScanJob diskScanJob) { _seriesProvider = seriesProvider; _mediaFileProvider = mediaFileProvider; - _updateInfoJob = updateInfoJob; + _updateInfoJob = updateInfoJob; _diskScanJob = diskScanJob; } @@ -91,22 +93,22 @@ namespace NzbDrone.Core.Providers.Jobs foreach (var season in seasons) { - if (season!=currentSeasons ) + if (season != currentSeasons) { - + } } - /* Logger.Debug("Looking for seasons to ignore"); - foreach (var season in updatedSeries.Seasons) - { - if (season.SeasonNumber != updatedSeries.Seasons.Max(s => s.SeasonNumber) && _mediaFileProvider.GetSeasonFiles(season.SeasonId).Count() == 0) - { - Logger.Info("Season {0} of {1} doesn't have any files on disk. season will not be monitored.", season.SeasonNumber, updatedSeries.Title); - season.Monitored = false; - _seasonProvider.SaveSeason(season); - } - }*/ + /* Logger.Debug("Looking for seasons to ignore"); + foreach (var season in updatedSeries.Seasons) + { + if (season.SeasonNumber != updatedSeries.Seasons.Max(s => s.SeasonNumber) && _mediaFileProvider.GetSeasonFiles(season.SeasonId).Count() == 0) + { + Logger.Info("Season {0} of {1} doesn't have any files on disk. season will not be monitored.", season.SeasonNumber, updatedSeries.Title); + season.Monitored = false; + _seasonProvider.SaveSeason(season); + } + }*/ } } } diff --git a/NzbDrone.Core/Providers/Jobs/JobProvider.cs b/NzbDrone.Core/Providers/Jobs/JobProvider.cs index 1481f1e4b..a64344c30 100644 --- a/NzbDrone.Core/Providers/Jobs/JobProvider.cs +++ b/NzbDrone.Core/Providers/Jobs/JobProvider.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Threading; +using Ninject; using NLog; using NzbDrone.Core.Model.Notification; using NzbDrone.Core.Repository; @@ -24,6 +25,7 @@ namespace NzbDrone.Core.Providers.Jobs private ProgressNotification _notification; + [Inject] public JobProvider(IRepository repository, NotificationProvider notificationProvider, IList jobs) { _repository = repository; diff --git a/NzbDrone.Core/Providers/Jobs/PostDownloadScanJob.cs b/NzbDrone.Core/Providers/Jobs/PostDownloadScanJob.cs index b744d8b10..c0daf484f 100644 --- a/NzbDrone.Core/Providers/Jobs/PostDownloadScanJob.cs +++ b/NzbDrone.Core/Providers/Jobs/PostDownloadScanJob.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; +using Ninject; using NLog; using NzbDrone.Core.Model.Notification; using NzbDrone.Core.Providers.Core; @@ -18,6 +19,7 @@ namespace NzbDrone.Core.Providers.Jobs private readonly SeriesProvider _seriesProvider; private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); + [Inject] public PostDownloadScanJob(ConfigProvider configProvider, DiskProvider diskProvider, MediaFileProvider mediaFileProvider, SeriesProvider seriesProvider) { diff --git a/NzbDrone.Core/Providers/Jobs/RenameEpisodeJob.cs b/NzbDrone.Core/Providers/Jobs/RenameEpisodeJob.cs index f17f44faf..5ba082133 100644 --- a/NzbDrone.Core/Providers/Jobs/RenameEpisodeJob.cs +++ b/NzbDrone.Core/Providers/Jobs/RenameEpisodeJob.cs @@ -1,6 +1,7 @@ using System; using System.IO; using System.Linq; +using Ninject; using NLog; using NzbDrone.Core.Model.Notification; using NzbDrone.Core.Providers.Core; @@ -16,6 +17,7 @@ namespace NzbDrone.Core.Providers.Jobs private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); + [Inject] public RenameEpisodeJob(DiskProvider diskProvider, EpisodeProvider episodeProvider, MediaFileProvider mediaFileProvider, SeriesProvider seriesProvider) { diff --git a/NzbDrone.Core/Providers/Jobs/RssSyncJob.cs b/NzbDrone.Core/Providers/Jobs/RssSyncJob.cs index 375a3f35c..2c34ba43e 100644 --- a/NzbDrone.Core/Providers/Jobs/RssSyncJob.cs +++ b/NzbDrone.Core/Providers/Jobs/RssSyncJob.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using Ninject; using NLog; using NzbDrone.Core.Model; using NzbDrone.Core.Model.Notification; @@ -18,6 +19,7 @@ namespace NzbDrone.Core.Providers.Jobs private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); + [Inject] public RssSyncJob(IEnumerable indexers, InventoryProvider inventoryProvider, DownloadProvider downloadProvider, IndexerProvider indexerProvider) { _indexers = indexers; diff --git a/NzbDrone.Core/Providers/Jobs/UpdateInfoJob.cs b/NzbDrone.Core/Providers/Jobs/UpdateInfoJob.cs index 17b8764be..9c4609573 100644 --- a/NzbDrone.Core/Providers/Jobs/UpdateInfoJob.cs +++ b/NzbDrone.Core/Providers/Jobs/UpdateInfoJob.cs @@ -1,5 +1,6 @@ using System.Linq; using System.Collections.Generic; +using Ninject; using NzbDrone.Core.Model.Notification; using NzbDrone.Core.Repository; @@ -10,6 +11,7 @@ namespace NzbDrone.Core.Providers.Jobs private readonly SeriesProvider _seriesProvider; private readonly EpisodeProvider _episodeProvider; + [Inject] public UpdateInfoJob(SeriesProvider seriesProvider, EpisodeProvider episodeProvider) { _seriesProvider = seriesProvider; @@ -18,7 +20,7 @@ namespace NzbDrone.Core.Providers.Jobs public UpdateInfoJob() { - + } public string Name diff --git a/NzbDrone.Core/Providers/MediaFileProvider.cs b/NzbDrone.Core/Providers/MediaFileProvider.cs index cb84ebf00..7a6bbf762 100644 --- a/NzbDrone.Core/Providers/MediaFileProvider.cs +++ b/NzbDrone.Core/Providers/MediaFileProvider.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using Ninject; using NLog; using NzbDrone.Core.Helpers; using NzbDrone.Core.Model.Notification; @@ -22,6 +23,7 @@ namespace NzbDrone.Core.Providers private readonly IRepository _repository; private readonly ConfigProvider _configProvider; + [Inject] public MediaFileProvider(IRepository repository, DiskProvider diskProvider, EpisodeProvider episodeProvider, SeriesProvider seriesProvider, ConfigProvider configProvider) diff --git a/NzbDrone.Core/Providers/QualityProvider.cs b/NzbDrone.Core/Providers/QualityProvider.cs index 6a5ff341c..ec636ae9b 100644 --- a/NzbDrone.Core/Providers/QualityProvider.cs +++ b/NzbDrone.Core/Providers/QualityProvider.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using Ninject; using NLog; using NzbDrone.Core.Repository.Quality; using SubSonic.Repository; @@ -16,6 +17,7 @@ namespace NzbDrone.Core.Providers { } + [Inject] public QualityProvider(IRepository repository) { _repository = repository; diff --git a/NzbDrone.Core/Providers/RootDirProvider.cs b/NzbDrone.Core/Providers/RootDirProvider.cs index 2e0baa4df..801267912 100644 --- a/NzbDrone.Core/Providers/RootDirProvider.cs +++ b/NzbDrone.Core/Providers/RootDirProvider.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using Ninject; using NLog; using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Repository; @@ -16,7 +17,7 @@ namespace NzbDrone.Core.Providers private readonly DiskProvider _diskProvider; private readonly SeriesProvider _seriesProvider; - + [Inject] public RootDirProvider(IRepository repository, SeriesProvider seriesProvider, DiskProvider diskProvider) { _repository = repository; diff --git a/NzbDrone.Core/Providers/SabProvider.cs b/NzbDrone.Core/Providers/SabProvider.cs index 779eabccf..db8e59b79 100644 --- a/NzbDrone.Core/Providers/SabProvider.cs +++ b/NzbDrone.Core/Providers/SabProvider.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Text.RegularExpressions; using System.Web; using System.Xml.Linq; +using Ninject; using NLog; using NzbDrone.Core.Model; using NzbDrone.Core.Providers.Core; @@ -21,6 +22,7 @@ namespace NzbDrone.Core.Providers { } + [Inject] public SabProvider(ConfigProvider configProvider, HttpProvider httpProvider) { _configProvider = configProvider; diff --git a/NzbDrone.Core/Providers/SeriesProvider.cs b/NzbDrone.Core/Providers/SeriesProvider.cs index c164cb32e..84550bfa2 100644 --- a/NzbDrone.Core/Providers/SeriesProvider.cs +++ b/NzbDrone.Core/Providers/SeriesProvider.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Text.RegularExpressions; +using Ninject; using NLog; using NzbDrone.Core.Helpers; using NzbDrone.Core.Providers.Core; @@ -15,14 +16,12 @@ namespace NzbDrone.Core.Providers { public class SeriesProvider { - //TODO: Remove parsing of rest of tv show info we just need the show name - //Trims all white spaces and separators from the end of the title. - private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); private readonly IRepository _repository; private readonly ConfigProvider _configProvider; private readonly TvDbProvider _tvDbProvider; + [Inject] public SeriesProvider(ConfigProvider configProviderProvider, IRepository repository, TvDbProvider tvDbProviderProvider) { _configProvider = configProviderProvider; diff --git a/NzbDrone.Core/Providers/StatsProvider.cs b/NzbDrone.Core/Providers/StatsProvider.cs index a211fc564..9817e8d12 100644 --- a/NzbDrone.Core/Providers/StatsProvider.cs +++ b/NzbDrone.Core/Providers/StatsProvider.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using Ninject; namespace NzbDrone.Core.Providers { @@ -9,6 +10,7 @@ namespace NzbDrone.Core.Providers { private readonly SeriesProvider _seriesProvider; + [Inject] public StatsProvider(SeriesProvider seriesProvider) { _seriesProvider = seriesProvider; diff --git a/NzbDrone.Core/Providers/UpcomingEpisodesProvider.cs b/NzbDrone.Core/Providers/UpcomingEpisodesProvider.cs index be62fd20e..14bcb61f2 100644 --- a/NzbDrone.Core/Providers/UpcomingEpisodesProvider.cs +++ b/NzbDrone.Core/Providers/UpcomingEpisodesProvider.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using Ninject; using NzbDrone.Core.Model; using NzbDrone.Core.Repository; using SubSonic.Repository; @@ -11,6 +12,7 @@ namespace NzbDrone.Core.Providers { private readonly IRepository _repository; + [Inject] public UpcomingEpisodesProvider(IRepository repository) { _repository = repository; @@ -26,7 +28,7 @@ namespace NzbDrone.Core.Providers var today = allEps.Where(e => e.AirDate == DateTime.Today).ToList(); var week = allEps.Where(e => e.AirDate > DateTime.Today).ToList(); - return new UpcomingEpisodesModel {Yesterday = yesterday, Today = today, Week = week}; + return new UpcomingEpisodesModel { Yesterday = yesterday, Today = today, Week = week }; } public virtual List Yesterday() diff --git a/NzbDrone.Core/Providers/XbmcProvider.cs b/NzbDrone.Core/Providers/XbmcProvider.cs index b7cccefbe..109106e5a 100644 --- a/NzbDrone.Core/Providers/XbmcProvider.cs +++ b/NzbDrone.Core/Providers/XbmcProvider.cs @@ -2,6 +2,7 @@ using System.IO; using System.Linq; using System.Xml.Linq; +using Ninject; using NLog; using NzbDrone.Core.Helpers; using NzbDrone.Core.Providers.Core; @@ -14,6 +15,7 @@ namespace NzbDrone.Core.Providers private readonly ConfigProvider _configProvider; private readonly HttpProvider _httpProvider; + [Inject] public XbmcProvider(ConfigProvider configProvider, HttpProvider httpProvider) { _configProvider = configProvider; diff --git a/NzbDrone.Web/Controllers/AddSeriesController.cs b/NzbDrone.Web/Controllers/AddSeriesController.cs index 8df3391db..74d1f96d6 100644 --- a/NzbDrone.Web/Controllers/AddSeriesController.cs +++ b/NzbDrone.Web/Controllers/AddSeriesController.cs @@ -21,17 +21,16 @@ namespace NzbDrone.Web.Controllers private readonly RootDirProvider _rootFolderProvider; private readonly SeriesProvider _seriesProvider; private readonly JobProvider _jobProvider; - private readonly SyncProvider _syncProvider; private readonly TvDbProvider _tvDbProvider; private readonly DiskProvider _diskProvider; - public AddSeriesController(SyncProvider syncProvider, RootDirProvider rootFolderProvider, + public AddSeriesController(RootDirProvider rootFolderProvider, ConfigProvider configProvider, QualityProvider qualityProvider, TvDbProvider tvDbProvider, SeriesProvider seriesProvider, JobProvider jobProvider, DiskProvider diskProvider) { - _syncProvider = syncProvider; + _rootFolderProvider = rootFolderProvider; _configProvider = configProvider; _qualityProvider = qualityProvider; @@ -50,7 +49,7 @@ namespace NzbDrone.Web.Controllers public ActionResult AddNew() { - var rootDirs =_rootFolderProvider.GetAll().Select(r => + var rootDirs = _rootFolderProvider.GetAll().Select(r => new RootDirModel { Path = r.Path, @@ -137,10 +136,10 @@ namespace NzbDrone.Web.Controllers _seriesProvider.AddSeries(path, seriesId, qualityProfileId); ScanNewSeries(); - return new JsonResult {Data = "ok"}; + return new JsonResult { Data = "ok" }; } - catch(Exception ex) + catch (Exception ex) { return new JsonResult { Data = "failed" }; } diff --git a/NzbDrone.Web/Controllers/NotificationController.cs b/NzbDrone.Web/Controllers/NotificationController.cs index 3744c8f3d..25d9cac2a 100644 --- a/NzbDrone.Web/Controllers/NotificationController.cs +++ b/NzbDrone.Web/Controllers/NotificationController.cs @@ -1,4 +1,5 @@ using System.Web.Mvc; +using MvcMiniProfiler; using NzbDrone.Core.Providers; namespace NzbDrone.Web.Controllers @@ -35,6 +36,12 @@ namespace NzbDrone.Web.Controllers message = _notifications.GetProgressNotifications[0].CurrentMessage; } + + if (MiniProfiler.Current.DurationMilliseconds < 100) + { + MiniProfiler.Stop(true); + } + return Json(message, JsonRequestBehavior.AllowGet); } }