diff --git a/NzbDrone.5.1.ReSharper b/NzbDrone.5.1.ReSharper deleted file mode 100644 index 5792be25b..000000000 --- a/NzbDrone.5.1.ReSharper +++ /dev/null @@ -1,70 +0,0 @@ - - - - - SOLUTION - - - - public - protected - internal - private - new - abstract - virtual - override - sealed - static - readonly - extern - unsafe - volatile - - - - - $object$_On$event$ - $event$Handler - - - - - - - $object$_On$event$ - $event$Handler - - - - - - - - - - - - - - $object$_On$event$ - $event$Handler - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/NzbDrone.Core/CentralDispatch.cs b/NzbDrone.Core/CentralDispatch.cs index addfffa09..8fef3ef25 100644 --- a/NzbDrone.Core/CentralDispatch.cs +++ b/NzbDrone.Core/CentralDispatch.cs @@ -115,7 +115,9 @@ public static void BindKernel() private static void BindIndexers() { _kernel.Bind().To().InSingletonScope(); - + _kernel.Bind().To().InSingletonScope(); + _kernel.Bind().To().InSingletonScope(); + _kernel.Bind().To().InSingletonScope(); var indexers = _kernel.GetAll(); _kernel.Get().InitializeIndexers(indexers.ToList()); } diff --git a/NzbDrone.Core/NzbDrone.Core.csproj b/NzbDrone.Core/NzbDrone.Core.csproj index 56b174966..38bbece87 100644 --- a/NzbDrone.Core/NzbDrone.Core.csproj +++ b/NzbDrone.Core/NzbDrone.Core.csproj @@ -168,9 +168,10 @@ + - - + + diff --git a/NzbDrone.Core/Providers/Core/ConfigProvider.cs b/NzbDrone.Core/Providers/Core/ConfigProvider.cs index 6fdf61bde..be928d4aa 100644 --- a/NzbDrone.Core/Providers/Core/ConfigProvider.cs +++ b/NzbDrone.Core/Providers/Core/ConfigProvider.cs @@ -26,7 +26,6 @@ public virtual String ApiKey set { SetValue("ApiKey", value); } } - public virtual String EpisodeNameFormat { get { return GetValue("EpisodeNameFormat"); } @@ -83,6 +82,20 @@ public virtual String NzbsrusHash set { SetValue("NzbsrusHash", value); } } + public virtual String NewzbinUsername + { + get { return GetValue("NewzbinUsername"); } + + set { SetValue("NewzbinUsername", value); } + } + + public virtual String NewzbinPassword + { + get { return GetValue("NewzbinPassword"); } + + set { SetValue("NewzbinPassword", value); } + } + public virtual String SyncFrequency { get { return GetValue("SyncFrequency"); } diff --git a/NzbDrone.Core/Providers/Indexer/NewzbinProvider.cs b/NzbDrone.Core/Providers/Indexer/NewzbinProvider.cs new file mode 100644 index 000000000..87c71cdd6 --- /dev/null +++ b/NzbDrone.Core/Providers/Indexer/NewzbinProvider.cs @@ -0,0 +1,36 @@ +using System.ServiceModel.Syndication; +using NzbDrone.Core.Providers.Core; +using SubSonic.Repository; + +namespace NzbDrone.Core.Providers.Indexer +{ + public class NewzbinProvider : IndexerProviderBase + { + public NewzbinProvider(SeriesProvider seriesProvider, SeasonProvider seasonProvider, EpisodeProvider episodeProvider, ConfigProvider configProvider, HttpProvider httpProvider, IRepository repository, IndexerProvider indexerProvider) + : base(seriesProvider, seasonProvider, episodeProvider, configProvider, httpProvider, repository, indexerProvider) + { + } + + protected override string[] Url + { + get + { + return new[] + { + string.Format("http://www.newzbin.com", _configProvider.NewzbinUsername, _configProvider.NewzbinPassword) + }; + } + } + + public override string Name + { + get { return "Newzbin"; } + } + + + protected override string NzbDownloadUrl(SyndicationItem item) + { + return item.Id; + } + } +} \ No newline at end of file diff --git a/NzbDrone.Core/Providers/Indexer/NzbMatrixFeedProvider.cs b/NzbDrone.Core/Providers/Indexer/NzbMatrixProvider.cs similarity index 77% rename from NzbDrone.Core/Providers/Indexer/NzbMatrixFeedProvider.cs rename to NzbDrone.Core/Providers/Indexer/NzbMatrixProvider.cs index 54a9cde94..09d6e9050 100644 --- a/NzbDrone.Core/Providers/Indexer/NzbMatrixFeedProvider.cs +++ b/NzbDrone.Core/Providers/Indexer/NzbMatrixProvider.cs @@ -4,9 +4,9 @@ namespace NzbDrone.Core.Providers.Indexer { - internal class NzbMatrixFeedProvider : IndexerProviderBase + public class NzbMatrixProvider : IndexerProviderBase { - public NzbMatrixFeedProvider(SeriesProvider seriesProvider, SeasonProvider seasonProvider, EpisodeProvider episodeProvider, ConfigProvider configProvider, HttpProvider httpProvider, IRepository repository, IndexerProvider indexerProvider) + public NzbMatrixProvider(SeriesProvider seriesProvider, SeasonProvider seasonProvider, EpisodeProvider episodeProvider, ConfigProvider configProvider, HttpProvider httpProvider, IRepository repository, IndexerProvider indexerProvider) : base(seriesProvider, seasonProvider, episodeProvider, configProvider, httpProvider, repository, indexerProvider) { } diff --git a/NzbDrone.Core/Providers/Indexer/NzbsRUsFeedProvider.cs b/NzbDrone.Core/Providers/Indexer/NzbsRUsProvider.cs similarity index 76% rename from NzbDrone.Core/Providers/Indexer/NzbsRUsFeedProvider.cs rename to NzbDrone.Core/Providers/Indexer/NzbsRUsProvider.cs index c04388ac1..d75721147 100644 --- a/NzbDrone.Core/Providers/Indexer/NzbsRUsFeedProvider.cs +++ b/NzbDrone.Core/Providers/Indexer/NzbsRUsProvider.cs @@ -4,9 +4,9 @@ namespace NzbDrone.Core.Providers.Indexer { - internal class NzbsRUsFeedProvider : IndexerProviderBase + public class NzbsRUsProvider : IndexerProviderBase { - public NzbsRUsFeedProvider(SeriesProvider seriesProvider, SeasonProvider seasonProvider, EpisodeProvider episodeProvider, ConfigProvider configProvider, HttpProvider httpProvider, IRepository repository, IndexerProvider indexerProvider) + public NzbsRUsProvider(SeriesProvider seriesProvider, SeasonProvider seasonProvider, EpisodeProvider episodeProvider, ConfigProvider configProvider, HttpProvider httpProvider, IRepository repository, IndexerProvider indexerProvider) : base(seriesProvider, seasonProvider, episodeProvider, configProvider, httpProvider, repository, indexerProvider) { } diff --git a/NzbDrone.Core/Providers/IndexerProvider.cs b/NzbDrone.Core/Providers/IndexerProvider.cs index dde868228..9f627d001 100644 --- a/NzbDrone.Core/Providers/IndexerProvider.cs +++ b/NzbDrone.Core/Providers/IndexerProvider.cs @@ -75,7 +75,5 @@ public virtual void InitializeIndexers(IList indexers) } } } - - } } \ No newline at end of file diff --git a/NzbDrone.Web/Controllers/SettingsController.cs b/NzbDrone.Web/Controllers/SettingsController.cs index 34ba16973..15c4a13a4 100644 --- a/NzbDrone.Web/Controllers/SettingsController.cs +++ b/NzbDrone.Web/Controllers/SettingsController.cs @@ -58,6 +58,7 @@ public ActionResult General() public ActionResult Indexers() { ViewData["viewName"] = "Indexers"; + return View("Index", new IndexerSettingsModel { NzbMatrixUsername = @@ -71,8 +72,13 @@ public ActionResult Indexers() NzbsOrgHash = _configProvider.NzbsrusHash, NzbsOrgUId = _configProvider.NzbsrusUId, - Indexers = _indexerProvider.AllIndexers() + NewzbinUsername = _configProvider.NewzbinUsername, + NewzbinPassword = _configProvider.NewzbinPassword, + NzbsOrgEnabled = _indexerProvider.GetSettings(typeof(NzbsOrgProvider)).Enable, + NzbMatrixEnabled = _indexerProvider.GetSettings(typeof(NzbMatrixProvider)).Enable, + NzbsRUsEnabled = _indexerProvider.GetSettings(typeof(NzbsRUsProvider)).Enable, + NewzbinEnabled = _indexerProvider.GetSettings(typeof(NewzbinProvider)).Enable }); } @@ -268,22 +274,33 @@ public ActionResult SaveIndexers(IndexerSettingsModel data) { if (ModelState.IsValid) { - foreach (var indexer in data.Indexers) - { - var setting =_indexerProvider.GetSettings(indexer.Id); - setting.Enable = indexer.Enable; - _indexerProvider.SaveSettings(setting); - } - - _configProvider.NzbMatrixUsername = data.NzbMatrixUsername; - _configProvider.NzbMatrixApiKey = data.NzbMatrixApiKey; - _configProvider.NzbsrusUId = data.NzbsrusUId; - _configProvider.NzbsrusHash = data.NzbsrusHash; - var nzbsOrgSettings = _indexerProvider.GetSettings(typeof(NzbsOrgProvider)); + nzbsOrgSettings.Enable = data.NzbsOrgEnabled; + _indexerProvider.SaveSettings(nzbsOrgSettings); + + var nzbMatrixSettings = _indexerProvider.GetSettings(typeof(NzbMatrixProvider)); + nzbMatrixSettings.Enable = data.NzbMatrixEnabled; + _indexerProvider.SaveSettings(nzbMatrixSettings); + + var nzbsRUsSettings = _indexerProvider.GetSettings(typeof(NzbsRUsProvider)); + nzbsRUsSettings.Enable = data.NzbsRUsEnabled; + _indexerProvider.SaveSettings(nzbsRUsSettings); + + var newzbinSettings = _indexerProvider.GetSettings(typeof(NewzbinProvider)); + newzbinSettings.Enable = data.NewzbinEnabled; + _indexerProvider.SaveSettings(newzbinSettings); + _configProvider.NzbsrusHash = data.NzbsOrgHash; _configProvider.NzbsOrgUId = data.NzbsOrgUId; + _configProvider.NzbMatrixUsername = data.NzbMatrixUsername; + _configProvider.NzbMatrixApiKey = data.NzbMatrixApiKey; + + _configProvider.NzbsrusUId = data.NzbsrusUId; + _configProvider.NzbsOrgUId = data.NzbsrusHash; + + _configProvider.NewzbinUsername = data.NewzbinUsername; + _configProvider.NewzbinPassword = data.NewzbinPassword; return Content(SETTINGS_SAVED); } diff --git a/NzbDrone.Web/Models/IndexerSettingsModel.cs b/NzbDrone.Web/Models/IndexerSettingsModel.cs index 54e434c67..4d5b70082 100644 --- a/NzbDrone.Web/Models/IndexerSettingsModel.cs +++ b/NzbDrone.Web/Models/IndexerSettingsModel.cs @@ -9,35 +9,55 @@ namespace NzbDrone.Web.Models public class IndexerSettingsModel { [DataType(DataType.Text)] - [DisplayName("NZBMatrix Username")] + [DisplayName("Username")] [DisplayFormat(ConvertEmptyStringToNull = false)] public String NzbMatrixUsername { get; set; } [DataType(DataType.Text)] - [DisplayName("NZBMatrix API Key")] + [DisplayName("API Key")] [DisplayFormat(ConvertEmptyStringToNull = false)] public String NzbMatrixApiKey { get; set; } [DataType(DataType.Text)] - [DisplayName("NZBs.Org UID")] + [DisplayName("UID")] [DisplayFormat(ConvertEmptyStringToNull = false)] public String NzbsOrgUId { get; set; } [DataType(DataType.Text)] - [DisplayName("NZBs.Org Hash")] + [DisplayName("Hash")] [DisplayFormat(ConvertEmptyStringToNull = false)] public String NzbsOrgHash { get; set; } [DataType(DataType.Text)] - [DisplayName("NZBsRus UID")] + [DisplayName("UID")] [DisplayFormat(ConvertEmptyStringToNull = false)] public String NzbsrusUId { get; set; } [DataType(DataType.Text)] - [DisplayName("NZBsRus Hash")] + [DisplayName("Hash")] [DisplayFormat(ConvertEmptyStringToNull = false)] public String NzbsrusHash { get; set; } - public List Indexers { get; set; } + [DataType(DataType.Text)] + [DisplayName("Username")] + [DisplayFormat(ConvertEmptyStringToNull = false)] + public String NewzbinUsername { get; set; } + + [DataType(DataType.Text)] + [DisplayName("Password")] + [DisplayFormat(ConvertEmptyStringToNull = false)] + public String NewzbinPassword { get; set; } + + [DisplayName("NZBs.org")] + public bool NzbsOrgEnabled { get; set; } + + [DisplayName("NZB Matrix")] + public bool NzbMatrixEnabled { get; set; } + + [DisplayName("NZBsRUs")] + public bool NzbsRUsEnabled { get; set; } + + [DisplayName("Newzbin")] + public bool NewzbinEnabled { get; set; } } } \ No newline at end of file diff --git a/NzbDrone.Web/NzbDrone.Web.csproj b/NzbDrone.Web/NzbDrone.Web.csproj index 18acc6d0a..d42469932 100644 --- a/NzbDrone.Web/NzbDrone.Web.csproj +++ b/NzbDrone.Web/NzbDrone.Web.csproj @@ -629,7 +629,6 @@ - @@ -662,6 +661,7 @@ + diff --git a/NzbDrone.Web/Views/Settings/Indexers.ascx b/NzbDrone.Web/Views/Settings/Indexers.ascx deleted file mode 100644 index 863529faf..000000000 --- a/NzbDrone.Web/Views/Settings/Indexers.ascx +++ /dev/null @@ -1,136 +0,0 @@ -<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> - - - -<% - using (Html.BeginForm("SaveIndexers", "Settings", FormMethod.Post, new { id = "form", name = "form" })) - {%> -<%:Html.ValidationSummary(true, - "Unable to save your settings. Please correct the errors and try again.")%> -
- Indexers -
    - <% - for (int i = 0; i < Model.Indexers.Count(); i++) - {%> -
  • - <%=Html.CheckBoxFor(c => c.Indexers[i].Enable)%><%=Html.DisplayTextFor(c => c.Indexers[i].Name)%>
  • - <% - }%> -
- <% - for (int i = 0; i < Model.Indexers.Count(); i++) - {%> - <% - }%> - <%--NZBMatrix--%> -
- <%=Html.LabelFor(m => m.NzbMatrixUsername)%> -
-
- <%=Html.TextBoxFor(m => m.NzbMatrixUsername)%> - <%=Html.ValidationMessageFor(m => m.NzbMatrixUsername)%> -
-
- <%=Html.LabelFor(m => m.NzbMatrixApiKey)%> -
-
- <%=Html.TextBoxFor(m => m.NzbMatrixApiKey)%> - <%=Html.ValidationMessageFor(m => m.NzbMatrixApiKey)%> -
-
- <%--NZBs.Org--%> -
- <%=Html.LabelFor(m => m.NzbsOrgUId)%> -
-
- <%=Html.TextBoxFor(m => m.NzbsOrgUId)%> - <%=Html.ValidationMessageFor(m => m.NzbsOrgUId)%> -
-
- <%=Html.LabelFor(m => m.NzbsOrgHash)%> -
-
- <%=Html.TextBoxFor(m => m.NzbsOrgHash)%> - <%=Html.ValidationMessageFor(m => m.NzbsOrgHash)%> -
-
- <%--NZBsrus--%> -
- <%=Html.LabelFor(m => m.NzbsrusUId)%> -
-
- <%=Html.TextBoxFor(m => m.NzbsrusUId)%> - <%=Html.ValidationMessageFor(m => m.NzbsrusUId)%> -
-
- <%=Html.LabelFor(m => m.NzbsrusHash)%> -
-
- <%=Html.TextBoxFor(m => m.NzbsrusHash)%> - <%=Html.ValidationMessageFor(m => m.NzbsrusHash)%> -
-
- -
-<% - }%> -
-
diff --git a/NzbDrone.Web/Views/Settings/Indexers.cshtml b/NzbDrone.Web/Views/Settings/Indexers.cshtml new file mode 100644 index 000000000..b469b1d46 --- /dev/null +++ b/NzbDrone.Web/Views/Settings/Indexers.cshtml @@ -0,0 +1,205 @@ +@model NzbDrone.Web.Models.IndexerSettingsModel + + + + + +@using (Html.BeginForm("SaveIndexers", "Settings", FormMethod.Post, new { id = "form", name = "form" })) { + @Html.ValidationSummary(true, "Unable to save your settings. Please correct the errors and try again.") + +
+ Indexers +
+ @{ Html.Telerik().PanelBar() + .Name("PanelBar") + .HtmlAttributes(new { style = "width: 300px; margin: 10px;" }) + .ExpandMode(PanelBarExpandMode.Single) + .SelectedIndex(0) + .Items(item => + { + item.Add() + .Text("NZBs.org") + .Content( + "
" + + + "
" + + "
" + + "Enabled" + + "
" + + "
" + + Html.CheckBoxFor(m => m.NzbsOrgEnabled, new { @class = "indexer_checkbox" }) + + "
" + + "
" + + + "
" + + "
" + + Html.LabelFor(m => m.NzbsOrgUId) + + "
" + + "
" + + Html.TextBoxFor(m => m.NzbsOrgUId) + + "
" + + "
" + + "
" + + "
" + + Html.LabelFor(m => m.NzbsOrgHash) + + "
" + + "
" + + Html.TextBoxFor(m => m.NzbsOrgHash) + + "
" + + "
" + + "
" + ); + item.Add() + .Text("NZB Matrix") + .Content( + "
" + + + "
" + + "
" + + "Enabled" + + "
" + + "
" + + Html.CheckBoxFor(m => m.NzbMatrixEnabled, new { @class = "indexer_checkbox" }) + + "
" + + "
" + + + "
" + + "
" + + Html.LabelFor(m => m.NzbMatrixUsername) + + "
" + + "
" + + Html.TextBoxFor(m => m.NzbMatrixUsername) + + "
" + + "
" + + "
" + + "
" + + Html.LabelFor(m => m.NzbMatrixApiKey) + + "
" + + "
" + + Html.TextBoxFor(m => m.NzbMatrixApiKey) + + "
" + + "
" + + "
" + ); + item.Add() + .Text("NZBsRUs") + .Content( + "
" + + + "
" + + "
" + + "Enabled" + + "
" + + "
" + + Html.CheckBoxFor(m => m.NzbsRUsEnabled, new { @class = "indexer_checkbox" }) + + "
" + + "
" + + + "
" + + "
" + + Html.LabelFor(m => m.NzbsrusUId) + + "
" + + "
" + + Html.TextBoxFor(m => m.NzbsrusUId) + + "
" + + "
" + + "
" + + "
" + + Html.LabelFor(m => m.NzbsrusHash) + + "
" + + "
" + + Html.TextBoxFor(m => m.NzbsrusHash) + + "
" + + "
" + + "
" + ); + item.Add() + .Text("Newzbin") + .Content( + "
" + + + "
" + + "
" + + "Enabled" + + "
" + + "
" + + Html.CheckBoxFor(m => m.NewzbinEnabled, new { @class = "indexer_checkbox" }) + + "
" + + "
" + + + "
" + + "
" + + Html.LabelFor(m => m.NewzbinUsername) + + "
" + + "
" + + Html.TextBoxFor(m => m.NewzbinUsername) + + "
" + + "
" + + "
" + + "
" + + Html.LabelFor(m => m.NewzbinPassword) + + "
" + + "
" + + Html.TextBoxFor(m => m.NewzbinPassword) + + "
" + + "
" + + "
" + ); + }).Render(); + } +
+ +
+ +
+
+} +
\ No newline at end of file