Added Timer, will hold timer information for RSS Sync and eventually backlog searching.

Attempt at styling configuration page, lots of work to go though.
This commit is contained in:
markus101 2011-01-30 23:42:44 -08:00
parent e199843c92
commit 63336ed58d
9 changed files with 202 additions and 88 deletions

View File

@ -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();
}
}

View File

@ -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);

View File

@ -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
}
}

View File

@ -172,3 +172,57 @@ 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;
}

View File

@ -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);

View File

@ -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;

View File

@ -270,10 +270,8 @@
<Content Include="Views\Series\EpisodeDetail.ascx" />
<Content Include="Views\Series\index.aspx" />
<Content Include="Views\Series\Unmapped.aspx" />
<Content Include="Views\Settings\Copy of Indexers.ascx" />
<Content Include="Views\Settings\Downloads.ascx" />
<Content Include="Views\Settings\General.ascx" />
<Content Include="Views\Settings\Index-old.aspx" />
<Content Include="Views\Settings\Index.aspx" />
<Content Include="Views\Settings\Indexers.ascx" />
<Content Include="Views\Settings\SubMenu.ascx" />

View File

@ -27,7 +27,7 @@
{%>
<%: Html.ValidationSummary(true, "Unable to save your settings. Please correct the errors and try again.") %>
<fieldset>
<fieldset >
<legend>Download Settings</legend>
<%--//Sync Frequency
//Download Propers?
@ -40,89 +40,80 @@
//SAB Category
//SAB Priority--%>
<br />
<fieldset class="sub-field">
<legend>Usenet Variables</legend>
<div>
<span><%= Html.LabelFor(m => m.SyncFrequency) %></span>
<%= Html.TextBoxFor(m => m.SyncFrequency)%>
<%= Html.ValidationMessageFor(m => m.SyncFrequency)%>
</div>
<div class="config-group">
<div class="config-title"><%= Html.LabelFor(m => m.SyncFrequency) %></div>
<div class="config-value"><%= Html.TextBoxFor(m => m.SyncFrequency)%></div>
<div class="config-validation"><%= Html.ValidationMessageFor(m => m.SyncFrequency)%></div>
</div>
<div class="config-group">
<div class="config-title"><%= Html.LabelFor(m => m.DownloadPropers)%></div>
<div class="config-value"><%= Html.CheckBoxFor(m => m.DownloadPropers)%></div>
<div class="config-validation"><%= Html.ValidationMessageFor(m => m.DownloadPropers)%></div>
</div>
<div class="config-group">
<div class="config-title"><%= Html.LabelFor(m => m.Retention)%></div>
<div class="config-value"><%= Html.TextBoxFor(m => m.Retention)%></div>
<div class="config-validation"><%= Html.ValidationMessageFor(m => m.Retention)%></div>
</div>
</fieldset>
<br />
<div>
<span><%= Html.LabelFor(m => m.DownloadPropers)%></span>
<%= Html.CheckBoxFor(m => m.DownloadPropers)%>
<%= Html.ValidationMessageFor(m => m.DownloadPropers)%>
</div>
<fieldset class="sub-field">
<legend>SABnzbd</legend>
<br />
<div class="config-group">
<div class="config-title"><%= Html.LabelFor(m => m.SabHost)%></div>
<div class="config-value"><%= Html.TextBoxFor(m => m.SabHost)%></div>
<div class="config-validation"><%= Html.ValidationMessageFor(m => m.SabHost)%></div>
</div>
<div>
<span><%= Html.LabelFor(m => m.Rentention)%></span>
<%= Html.TextBoxFor(m => m.Rentention)%>
<%= Html.ValidationMessageFor(m => m.Rentention)%>
</div>
<div class="config-group">
<div class="config-title"><%= Html.LabelFor(m => m.SabPort)%></div>
<div class="config-value"><%= Html.TextBoxFor(m => m.SabPort)%></div>
<div class="config-validation"><%= Html.ValidationMessageFor(m => m.SabPort)%></div>
</div>
<br />
<div class="config-group">
<div class="config-title"><%= Html.LabelFor(m => m.SabApiKey)%></div>
<div class="config-value"><%= Html.TextBoxFor(m => m.SabApiKey)%></div>
<div class="config-validation"><%= Html.ValidationMessageFor(m => m.SabApiKey)%></div>
</div>
<div>
<span><%= Html.LabelFor(m => m.SabHost)%></span>
<%= Html.TextBoxFor(m => m.SabHost)%>
<%= Html.ValidationMessageFor(m => m.SabHost)%>
</div>
<div class="config-group">
<div class="config-title"><%= Html.LabelFor(m => m.SabUsername)%></div>
<div class="config-value"><%= Html.TextBoxFor(m => m.SabUsername)%></div>
<div class="config-validation"><%= Html.ValidationMessageFor(m => m.SabUsername)%></div>
</div>
<br />
<div class="config-group">
<div class="config-title"><%= Html.LabelFor(m => m.SabPassword)%></div>
<div class="config-value"><%= Html.TextBoxFor(m => m.SabPassword)%></div>
<div class="config-validation"><%= Html.ValidationMessageFor(m => m.SabPassword)%></div>
</div>
<div>
<span><%= Html.LabelFor(m => m.SabPort)%></span>
<%= Html.TextBoxFor(m => m.SabPort)%>
<%= Html.ValidationMessageFor(m => m.SabPort)%>
</div>
<div class="config-group">
<div class="config-title"><%= Html.LabelFor(m => m.SabCategory)%></div>
<div class="config-value"><%= Html.TextBoxFor(m => m.SabCategory)%></div>
<div class="config-validation"><%= Html.ValidationMessageFor(m => m.SabCategory)%></div>
</div>
<br />
<%--<div class="editor-label">
<%= Html.DropDownListFor(m => m.SabPriority) %>
</div>
<div class="editor-field">
<%= Html.TextBoxFor(m => m.SabCategory)%>
<%= Html.ValidationMessageFor(m => m.SabCategory)%>
</div>--%>
</fieldset>
<div>
<span><%= Html.LabelFor(m => m.SabApiKey)%></span>
<%= Html.TextBoxFor(m => m.SabApiKey)%>
<%= Html.ValidationMessageFor(m => m.SabApiKey)%>
</div>
<br />
<div>
<span><%= Html.LabelFor(m => m.SabUsername)%></span>
<%= Html.TextBoxFor(m => m.SabUsername)%>
<%= Html.ValidationMessageFor(m => m.SabUsername)%>
</div>
<br />
<div>
<span><%= Html.LabelFor(m => m.SabPassword)%></span>
<%= Html.TextBoxFor(m => m.SabPassword)%>
<%= Html.ValidationMessageFor(m => m.SabPassword)%>
</div>
<br />
<div>
<span><%= Html.LabelFor(m => m.SabCategory)%></span>
<%= Html.TextBoxFor(m => m.SabCategory)%>
<%= Html.ValidationMessageFor(m => m.SabCategory)%>
</div>
<%--<div class="editor-label">
<%= Html.DropDownListFor(m => m.SabPriority) %>
</div>
<div class="editor-field">
<%= Html.TextBoxFor(m => m.SabCategory)%>
<%= Html.ValidationMessageFor(m => m.SabCategory)%>
</div>--%>
<br />
<p>
<input type="submit" value="Save" />
<input type="submit" value="Save" class="submitButton"/>
</p>
</fieldset>

View File

@ -3,19 +3,18 @@
<script type="text/javascript">
jQuery(document).ready(function () {
document.getElementById('syncTimer').style.display = 'block'; //Show the timer after the page loads, prevents FOUC (Flash of Unstyled Content)
document.getElementById('syncTimer').style.display = 'inline'; //Show the timer after the page loads, prevents FOUC (Flash of Unstyled Content)
$('#syncTimer').tgcCountdown({
counter: '<span style="color: #065EFE;">[H]:[M]:[S]</span>',
counter_warning: '<span style="color: #065EFE;">[H]:[M]:[S]</span>',
counter_expired: '<span style="color: #FFFFFF;">00:00:00</span>',
counter: '<div style="color: #065EFE;">[H]:[M]:[S]</div>',
counter_warning: '<div style="color: #065EFE;">[H]:[M]:[S]</div>',
counter_expired: '<div style="color: #FFFFFF;">00:00:00</div>',
interval: 1000,
warnonminutesleft: 1
});
});
</script>
<div>RSS Sync:</div>
<%--<div>RSS Sync: <span style="display:none" id="syncTimer" class="timer"><%: ViewData["RssTimer"] %></span></div>--%>
<div>RSS Sync: </div>
<div style="display:none" id="syncTimer" class="timer"><%: ViewData["RssTimer"] %></div>