From 63336ed58d53d6a0ddc5d1d7bcf11937b622fb1c Mon Sep 17 00:00:00 2001 From: markus101 Date: Sun, 30 Jan 2011 23:42:44 -0800 Subject: [PATCH] Added Timer, will hold timer information for RSS Sync and eventually backlog searching. Attempt at styling configuration page, lots of work to go though. --- NzbDrone.Core/Providers/ITimerProvider.cs | 14 ++ NzbDrone.Core/Providers/RssSyncProvider.cs | 7 + NzbDrone.Core/Providers/TimerProvider.cs | 37 +++++ NzbDrone.Web/Content/style.css | 54 +++++++ .../Controllers/SettingsController.cs | 15 +- NzbDrone.Web/Models/SettingsModels.cs | 11 +- NzbDrone.Web/NzbDrone.Web.csproj | 2 - NzbDrone.Web/Views/Settings/Downloads.ascx | 135 ++++++++---------- NzbDrone.Web/Views/Shared/Footer.ascx | 15 +- 9 files changed, 202 insertions(+), 88 deletions(-) create mode 100644 NzbDrone.Core/Providers/ITimerProvider.cs create mode 100644 NzbDrone.Core/Providers/TimerProvider.cs diff --git a/NzbDrone.Core/Providers/ITimerProvider.cs b/NzbDrone.Core/Providers/ITimerProvider.cs new file mode 100644 index 000000000..f376660ad --- /dev/null +++ b/NzbDrone.Core/Providers/ITimerProvider.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace NzbDrone.Core.Providers +{ + public interface ITimerProvider + { + void ResetTimer(); + void StartTimer(); + void StopTimer(); + } +} diff --git a/NzbDrone.Core/Providers/RssSyncProvider.cs b/NzbDrone.Core/Providers/RssSyncProvider.cs index 915347d6e..468662930 100644 --- a/NzbDrone.Core/Providers/RssSyncProvider.cs +++ b/NzbDrone.Core/Providers/RssSyncProvider.cs @@ -185,6 +185,13 @@ namespace NzbDrone.Core.Providers foreach (var episode in episodes) { var episodeInDb = _episode.GetEpisode(seriesId, episode.SeasonNumber, episode.EpisodeNumber); + + if (episodeInDb == null) + { + Logger.Debug("Episode Not found in Database"); + return String.Format("{0} - {1}x{2:00}", series.Title, episode.SeasonNumber, episode.SeriesTitle); + } + seasonNumber = episodeInDb.SeasonNumber; episodeNumbers = String.Format("{0}x{1:00}", episodeNumbers, episodeInDb.EpisodeNumber); episodeTitles = String.Format("{0} + {1}", episodeTitles, episodeInDb.Title); diff --git a/NzbDrone.Core/Providers/TimerProvider.cs b/NzbDrone.Core/Providers/TimerProvider.cs new file mode 100644 index 000000000..7f3b08e4b --- /dev/null +++ b/NzbDrone.Core/Providers/TimerProvider.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using System.Timers; +using NzbDrone.Core.Model.Notification; +using Timer = System.Threading.Timer; + +namespace NzbDrone.Core.Providers +{ + public class TimerProvider : ITimerProvider + { + private ProgressNotification _seriesSyncNotification; + private Thread _seriesSyncThread; + private System.Timers.Timer _rssSyncTimer; + + #region ITimerProvider Members + + public void ResetTimer() + { + throw new NotImplementedException(); + } + public void StartTimer() + { + throw new NotImplementedException(); + } + + public void StopTimer() + { + throw new NotImplementedException(); + } + + #endregion + + } +} diff --git a/NzbDrone.Web/Content/style.css b/NzbDrone.Web/Content/style.css index 58f4bb84d..5d8ab3c3a 100644 --- a/NzbDrone.Web/Content/style.css +++ b/NzbDrone.Web/Content/style.css @@ -171,4 +171,58 @@ hr { padding: 1px, 1px, 1px, 1px; text-align: center; +} + +/* Config Pages */ +.config-group +{ + width:300px; + display: block; + padding-bottom: 25px; +} + +.config-title +{ + font-weight: bold; + padding-right: 15px; + float: left; +} + +.config-value +{ + float: right; + +} + +.config-validation +{ + +} +.sub-field +{ + width: 50%; +} + +input[type="text"] +{ + border: 1px solid #006; + background: #ffc; +} + +input[type="text"]:hover +{ + border: 1px solid #f00; + background: #ff6; +} + +.submitButton +{ + border: 1px solid #006; + background: #ccf; +} + +.submitButton:hover +{ + border: 1px solid #f00; + background: #eef; } \ No newline at end of file diff --git a/NzbDrone.Web/Controllers/SettingsController.cs b/NzbDrone.Web/Controllers/SettingsController.cs index a40b52385..c31d2f55e 100644 --- a/NzbDrone.Web/Controllers/SettingsController.cs +++ b/NzbDrone.Web/Controllers/SettingsController.cs @@ -42,7 +42,8 @@ namespace NzbDrone.Web.Controllers ViewData["viewName"] = "General"; return View("Index", new SettingsModel { - TvFolder = _configProvider.SeriesRoot + TvFolder = _configProvider.SeriesRoot, + Quality = Convert.ToInt32(_configProvider.GetValue("Quality", "1", true)), }); } @@ -79,7 +80,7 @@ namespace NzbDrone.Web.Controllers SyncFrequency = Convert.ToInt32(_configProvider.GetValue("SyncFrequency", "15", true)), DownloadPropers = Convert.ToBoolean(_configProvider.GetValue("DownloadPropers", "false", true)), - Rentention = Convert.ToInt32(_configProvider.GetValue("Rentention", "500", true)), + Retention = Convert.ToInt32(_configProvider.GetValue("Retention", "500", true)), SabHost = _configProvider.GetValue("SabHost", "localhost", false), SabPort = Convert.ToInt32(_configProvider.GetValue("SabPort", "8080", true)), SabApiKey = _configProvider.GetValue("SabApiKey", String.Empty, false), @@ -127,7 +128,11 @@ namespace NzbDrone.Web.Controllers { try { - _configProvider.SeriesRoot = data.TvFolder; + if (data.TvFolder != null) + _configProvider.SeriesRoot = data.TvFolder; + + //if (data.Quality != null) + // _configProvider.SetValue("Quality", data.Quality); } catch (Exception e) { @@ -200,8 +205,8 @@ namespace NzbDrone.Web.Controllers _configProvider.SetValue("DownloadPropers", data.DownloadPropers.ToString()); - if (data.Rentention > 0) - _configProvider.SetValue("Retention", data.Rentention.ToString()); + if (data.Retention > 0) + _configProvider.SetValue("Retention", data.Retention.ToString()); if (data.SabHost != null) _configProvider.SetValue("SabHost", data.SabHost); diff --git a/NzbDrone.Web/Models/SettingsModels.cs b/NzbDrone.Web/Models/SettingsModels.cs index 01364d678..e9ea8389e 100644 --- a/NzbDrone.Web/Models/SettingsModels.cs +++ b/NzbDrone.Web/Models/SettingsModels.cs @@ -24,6 +24,15 @@ namespace NzbDrone.Web.Models get; set; } + + [DataType(DataType.Text)] + [DisplayName("Initial Quality")] + public int Quality + { + get; + set; + } + #endregion #region Indexer Settings @@ -113,7 +122,7 @@ namespace NzbDrone.Web.Models [DataType(DataType.Text)] [DisplayName("Retention")] - public int Rentention + public int Retention { get; set; diff --git a/NzbDrone.Web/NzbDrone.Web.csproj b/NzbDrone.Web/NzbDrone.Web.csproj index bf3a2cbf3..25fc70005 100644 --- a/NzbDrone.Web/NzbDrone.Web.csproj +++ b/NzbDrone.Web/NzbDrone.Web.csproj @@ -270,10 +270,8 @@ - - diff --git a/NzbDrone.Web/Views/Settings/Downloads.ascx b/NzbDrone.Web/Views/Settings/Downloads.ascx index 0f0157cb3..8b7a271c5 100644 --- a/NzbDrone.Web/Views/Settings/Downloads.ascx +++ b/NzbDrone.Web/Views/Settings/Downloads.ascx @@ -27,7 +27,7 @@ {%> <%: Html.ValidationSummary(true, "Unable to save your settings. Please correct the errors and try again.") %> -
+
Download Settings <%--//Sync Frequency //Download Propers? @@ -40,89 +40,80 @@ //SAB Category //SAB Priority--%> -
- -
- <%= Html.LabelFor(m => m.SyncFrequency) %> - <%= Html.TextBoxFor(m => m.SyncFrequency)%> - <%= Html.ValidationMessageFor(m => m.SyncFrequency)%> -
+
+ Usenet Variables + +
+
<%= Html.LabelFor(m => m.SyncFrequency) %>
+
<%= Html.TextBoxFor(m => m.SyncFrequency)%>
+
<%= Html.ValidationMessageFor(m => m.SyncFrequency)%>
+
+ +
+
<%= Html.LabelFor(m => m.DownloadPropers)%>
+
<%= Html.CheckBoxFor(m => m.DownloadPropers)%>
+
<%= Html.ValidationMessageFor(m => m.DownloadPropers)%>
+
+ +
+
<%= Html.LabelFor(m => m.Retention)%>
+
<%= Html.TextBoxFor(m => m.Retention)%>
+
<%= Html.ValidationMessageFor(m => m.Retention)%>
+
+

-
- <%= Html.LabelFor(m => m.DownloadPropers)%> - <%= Html.CheckBoxFor(m => m.DownloadPropers)%> - <%= Html.ValidationMessageFor(m => m.DownloadPropers)%> -
+
+ SABnzbd -
+
+
<%= Html.LabelFor(m => m.SabHost)%>
+
<%= Html.TextBoxFor(m => m.SabHost)%>
+
<%= Html.ValidationMessageFor(m => m.SabHost)%>
+
-
- <%= Html.LabelFor(m => m.Rentention)%> - <%= Html.TextBoxFor(m => m.Rentention)%> - <%= Html.ValidationMessageFor(m => m.Rentention)%> -
+
+
<%= Html.LabelFor(m => m.SabPort)%>
+
<%= Html.TextBoxFor(m => m.SabPort)%>
+
<%= Html.ValidationMessageFor(m => m.SabPort)%>
+
-
+
+
<%= Html.LabelFor(m => m.SabApiKey)%>
+
<%= Html.TextBoxFor(m => m.SabApiKey)%>
+
<%= Html.ValidationMessageFor(m => m.SabApiKey)%>
+
-
- <%= Html.LabelFor(m => m.SabHost)%> - <%= Html.TextBoxFor(m => m.SabHost)%> - <%= Html.ValidationMessageFor(m => m.SabHost)%> -
+
+
<%= Html.LabelFor(m => m.SabUsername)%>
+
<%= Html.TextBoxFor(m => m.SabUsername)%>
+
<%= Html.ValidationMessageFor(m => m.SabUsername)%>
+
-
+
+
<%= Html.LabelFor(m => m.SabPassword)%>
+
<%= Html.TextBoxFor(m => m.SabPassword)%>
+
<%= Html.ValidationMessageFor(m => m.SabPassword)%>
+
-
- <%= Html.LabelFor(m => m.SabPort)%> - <%= Html.TextBoxFor(m => m.SabPort)%> - <%= Html.ValidationMessageFor(m => m.SabPort)%> -
+
+
<%= Html.LabelFor(m => m.SabCategory)%>
+
<%= Html.TextBoxFor(m => m.SabCategory)%>
+
<%= Html.ValidationMessageFor(m => m.SabCategory)%>
+
-
+ <%--
+ <%= Html.DropDownListFor(m => m.SabPriority) %> +
+
+ <%= Html.TextBoxFor(m => m.SabCategory)%> + <%= Html.ValidationMessageFor(m => m.SabCategory)%> +
--%> +
-
- <%= Html.LabelFor(m => m.SabApiKey)%> - <%= Html.TextBoxFor(m => m.SabApiKey)%> - <%= Html.ValidationMessageFor(m => m.SabApiKey)%> -
- -
- -
- <%= Html.LabelFor(m => m.SabUsername)%> - <%= Html.TextBoxFor(m => m.SabUsername)%> - <%= Html.ValidationMessageFor(m => m.SabUsername)%> -
- -
- -
- <%= Html.LabelFor(m => m.SabPassword)%> - <%= Html.TextBoxFor(m => m.SabPassword)%> - <%= Html.ValidationMessageFor(m => m.SabPassword)%> -
- -
- -
- <%= Html.LabelFor(m => m.SabCategory)%> - <%= Html.TextBoxFor(m => m.SabCategory)%> - <%= Html.ValidationMessageFor(m => m.SabCategory)%> -
- - <%--
- <%= Html.DropDownListFor(m => m.SabPriority) %> -
-
- <%= Html.TextBoxFor(m => m.SabCategory)%> - <%= Html.ValidationMessageFor(m => m.SabCategory)%> -
--%> - -

- +

diff --git a/NzbDrone.Web/Views/Shared/Footer.ascx b/NzbDrone.Web/Views/Shared/Footer.ascx index fef9c7422..73a70668e 100644 --- a/NzbDrone.Web/Views/Shared/Footer.ascx +++ b/NzbDrone.Web/Views/Shared/Footer.ascx @@ -3,19 +3,18 @@ -
RSS Sync:
- - - +<%--
RSS Sync:
--%> +
RSS Sync:
+ \ No newline at end of file