diff --git a/NzbDrone.Core/Controllers/ISeriesController.cs b/NzbDrone.Core/Controllers/ISeriesController.cs index 25c620d05..2e2d46fe7 100644 --- a/NzbDrone.Core/Controllers/ISeriesController.cs +++ b/NzbDrone.Core/Controllers/ISeriesController.cs @@ -6,6 +6,7 @@ namespace NzbDrone.Core.Controllers public interface ISeriesController { IQueryable GetSeries(); + Series GetSeries(int tvdbId); void SyncSeriesWithDisk(); } } \ No newline at end of file diff --git a/NzbDrone.Core/Controllers/SeriesController.cs b/NzbDrone.Core/Controllers/SeriesController.cs index bb19b1c76..cf210ad9d 100644 --- a/NzbDrone.Core/Controllers/SeriesController.cs +++ b/NzbDrone.Core/Controllers/SeriesController.cs @@ -32,16 +32,23 @@ namespace NzbDrone.Core.Controllers return _sonioRepo.All(); } + public Series GetSeries(int tvdbId) + { + return _sonioRepo.Single(s=> s.TvdbId == tvdbId); + } + + + public void SyncSeriesWithDisk() { foreach (string seriesFolder in _diskController.GetDirectories(_config.SeriesRoot)) { - var dirInfo = new DirectoryInfo(seriesFolder); - if (!_sonioRepo.Exists(s => s.Path == _diskController.CleanPath(dirInfo.FullName))) + var cleanPath =_diskController.CleanPath(new DirectoryInfo(seriesFolder).FullName); + if (!_sonioRepo.Exists(s => s.Path == cleanPath)) { - _logger.InfoFormat("Folder '{0} isn't mapped to a series in the database. Trying to map it.'", seriesFolder); - AddShow(seriesFolder); + _logger.InfoFormat("Folder '{0} isn't mapped to a series in the database. Trying to map it.'", cleanPath); + AddShow(cleanPath); } } @@ -60,7 +67,7 @@ namespace NzbDrone.Core.Controllers private void AddShow(string path, TvdbSeries series) { - _sonioRepo.Add(new Series { Id = series.Id, SeriesName = series.SeriesName, AirTimes = series.AirsTime, AirsDayOfWeek = series.AirsDayOfWeek, Overview = series.Overview, Status = series.Status, Language = series.Language.Name, Path = path }); + _sonioRepo.Add(new Series { TvdbId = series.Id, SeriesName = series.SeriesName, AirTimes = series.AirsTime, AirsDayOfWeek = series.AirsDayOfWeek, Overview = series.Overview, Status = series.Status, Language = series.Language.Abbriviation, Path = path }); } } } \ No newline at end of file diff --git a/NzbDrone.Core/Repository/Series.cs b/NzbDrone.Core/Repository/Series.cs index 689e11cb9..e39853b80 100644 --- a/NzbDrone.Core/Repository/Series.cs +++ b/NzbDrone.Core/Repository/Series.cs @@ -1,10 +1,12 @@ using System; +using SubSonic.SqlGeneration.Schema; namespace NzbDrone.Core.Repository { public class Series { - public int Id + [SubSonicPrimaryKey] + public int TvdbId { get; set; @@ -22,6 +24,7 @@ namespace NzbDrone.Core.Repository set; } + [SubSonicLongString] public string Overview { get; @@ -51,5 +54,6 @@ namespace NzbDrone.Core.Repository get; set; } + } } diff --git a/NzbDrone.Web/Bin/NzbDrone.Core.dll b/NzbDrone.Web/Bin/NzbDrone.Core.dll index 258c4cf37..79d52d4ca 100644 Binary files a/NzbDrone.Web/Bin/NzbDrone.Core.dll and b/NzbDrone.Web/Bin/NzbDrone.Core.dll differ diff --git a/NzbDrone.Web/Bin/NzbDrone.Core.pdb b/NzbDrone.Web/Bin/NzbDrone.Core.pdb index d5a2c29ea..7b86f2d58 100644 Binary files a/NzbDrone.Web/Bin/NzbDrone.Core.pdb and b/NzbDrone.Web/Bin/NzbDrone.Core.pdb differ diff --git a/NzbDrone.Web/Bin/NzbDrone.Web.dll b/NzbDrone.Web/Bin/NzbDrone.Web.dll index 92e14040f..90a8b99f1 100644 Binary files a/NzbDrone.Web/Bin/NzbDrone.Web.dll and b/NzbDrone.Web/Bin/NzbDrone.Web.dll differ diff --git a/NzbDrone.Web/Bin/NzbDrone.Web.pdb b/NzbDrone.Web/Bin/NzbDrone.Web.pdb index cf7f70e91..0b7384336 100644 Binary files a/NzbDrone.Web/Bin/NzbDrone.Web.pdb and b/NzbDrone.Web/Bin/NzbDrone.Web.pdb differ diff --git a/NzbDrone.Web/Controllers/SeriesController.cs b/NzbDrone.Web/Controllers/SeriesController.cs index 35b2d2eff..cde2d690c 100644 --- a/NzbDrone.Web/Controllers/SeriesController.cs +++ b/NzbDrone.Web/Controllers/SeriesController.cs @@ -35,9 +35,9 @@ namespace NzbDrone.Web.Controllers // // GET: /Series/Details/5 - public ActionResult Details(int id) + public ActionResult Details(int tvdbId) { - return View(); + return View(_seriesController.GetSeries(tvdbId)); } // diff --git a/NzbDrone.Web/Controllers/SettingsController.cs b/NzbDrone.Web/Controllers/SettingsController.cs index b23696cfd..e97b406cc 100644 --- a/NzbDrone.Web/Controllers/SettingsController.cs +++ b/NzbDrone.Web/Controllers/SettingsController.cs @@ -30,9 +30,10 @@ namespace NzbDrone.Web.Controllers if (ModelState.IsValid) { _configController.SeriesRoot = model.TvFolder; + //return RedirectToAction("index"); } - - return RedirectToAction("index"); + + return View(model); } } diff --git a/NzbDrone.Web/NzbDrone.Web.csproj b/NzbDrone.Web/NzbDrone.Web.csproj index 156aa18b4..20dc9199d 100644 --- a/NzbDrone.Web/NzbDrone.Web.csproj +++ b/NzbDrone.Web/NzbDrone.Web.csproj @@ -81,6 +81,7 @@ + diff --git a/NzbDrone.Web/Views/Series/Details.aspx b/NzbDrone.Web/Views/Series/Details.aspx new file mode 100644 index 000000000..944fbbd8c --- /dev/null +++ b/NzbDrone.Web/Views/Series/Details.aspx @@ -0,0 +1,45 @@ +<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %> + + + Details + + + + +

Details

+ +
+ Fields + +
Id
+
<%: Model.TvdbId %>
+ +
SeriesName
+
<%: Model.SeriesName %>
+ +
Status
+
<%: Model.Status %>
+ +
Overview
+
<%: Model.Overview %>
+ +
AirTimes
+
<%: Model.AirTimes %>
+ +
Language
+
<%: Model.Language %>
+ +
Path
+
<%: Model.Path %>
+ +
TvdbId
+
<%: Model.TvdbId %>
+ +
+

+ <%-- <%: Html.ActionLink("Edit", "Edit", new { /* id=Model.PrimaryKey */ }) %> |--%> + <%: Html.ActionLink("Back to List", "Index") %> +

+ +
+ diff --git a/NzbDrone.Web/Views/Series/index.aspx b/NzbDrone.Web/Views/Series/index.aspx index ae6fa948e..921507fad 100644 --- a/NzbDrone.Web/Views/Series/index.aspx +++ b/NzbDrone.Web/Views/Series/index.aspx @@ -1,16 +1,13 @@ <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage>" %> - SeriesView + SeriesView - - -

SeriesView

- +

+ SeriesView

- @@ -20,58 +17,35 @@ - - - - - <% foreach (var item in Model) { %> - + <% foreach (var item in Model) + { %> + <%-- --%> - - - - - - <% } %> - + <% } %>
Id Status - Overview - - AirTimes - - Language - Path
+ <%: Html.ActionLink("Details", "Details", new { item.TvdbId })%> + | + <%: Html.ActionLink("Delete", "Delete", new { item.TvdbId })%> + - <%: Html.ActionLink("Edit", "Edit", new { /* id=item.PrimaryKey */ }) %> | - <%: Html.ActionLink("Details", "Details", new { /* id=item.PrimaryKey */ })%> | - <%: Html.ActionLink("Delete", "Delete", new { /* id=item.PrimaryKey */ })%> - - <%: item.Id %> + <%: item.TvdbId.ToString()%> - <%: item.SeriesName %> + <%: Html.ActionLink(item.SeriesName, "Details", new { item.TvdbId })%> <%: item.Status %> - <%: item.Overview %> - - <%: item.AirTimes %> - - <%: item.Language %> - <%: item.Path %>
-

<%: Html.ActionLink("Create New", "Create") %> + <%: Html.ActionLink("Sync With Disk", "Sync") %>

-
- diff --git a/NzbDrone.Web/Views/Settings/Index.aspx b/NzbDrone.Web/Views/Settings/Index.aspx index dfa44b172..fe0d11d55 100644 --- a/NzbDrone.Web/Views/Settings/Index.aspx +++ b/NzbDrone.Web/Views/Settings/Index.aspx @@ -9,7 +9,7 @@ Settings <% using (Html.BeginForm()) { %> - <%: Html.ValidationSummary(true, "Unable to save you settings. Please correct the errors and try again.") %> + <%: Html.ValidationSummary(true, "Unable to save your settings. Please correct the errors and try again.") %>
General diff --git a/NzbDrone.Web/Views/Shared/Site.Master b/NzbDrone.Web/Views/Shared/Site.Master index 80fce96c3..f7e8af792 100644 --- a/NzbDrone.Web/Views/Shared/Site.Master +++ b/NzbDrone.Web/Views/Shared/Site.Master @@ -12,7 +12,7 @@