1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-29 02:57:15 +02:00

fixed show grid, added details page

This commit is contained in:
kay.one 2010-09-24 00:14:42 -07:00
parent 772452aa8b
commit 4d4a8198eb
15 changed files with 153 additions and 117 deletions

View File

@ -6,6 +6,7 @@ namespace NzbDrone.Core.Controllers
public interface ISeriesController
{
IQueryable<Series> GetSeries();
Series GetSeries(int tvdbId);
void SyncSeriesWithDisk();
}
}

View File

@ -32,16 +32,23 @@ public IQueryable<Series> GetSeries()
return _sonioRepo.All<Series>();
}
public Series GetSeries(int tvdbId)
{
return _sonioRepo.Single<Series>(s=> s.TvdbId == tvdbId);
}
public void SyncSeriesWithDisk()
{
foreach (string seriesFolder in _diskController.GetDirectories(_config.SeriesRoot))
{
var dirInfo = new DirectoryInfo(seriesFolder);
if (!_sonioRepo.Exists<Series>(s => s.Path == _diskController.CleanPath(dirInfo.FullName)))
var cleanPath =_diskController.CleanPath(new DirectoryInfo(seriesFolder).FullName);
if (!_sonioRepo.Exists<Series>(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 @@ private void AddShow(string path)
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 });
}
}
}

View File

@ -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 @@ public string Status
set;
}
[SubSonicLongString]
public string Overview
{
get;
@ -51,5 +54,6 @@ public string Path
get;
set;
}
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -35,9 +35,9 @@ public ActionResult Sync()
//
// GET: /Series/Details/5
public ActionResult Details(int id)
public ActionResult Details(int tvdbId)
{
return View();
return View(_seriesController.GetSeries(tvdbId));
}
//

View File

@ -30,9 +30,10 @@ public ActionResult Index(SettingsModel model)
if (ModelState.IsValid)
{
_configController.SeriesRoot = model.TvFolder;
//return RedirectToAction("index");
}
return RedirectToAction("index");
return View(model);
}
}

View File

@ -81,6 +81,7 @@
</ItemGroup>
<ItemGroup>
<Content Include="Global.asax" />
<Content Include="Views\Series\Details.aspx" />
<Content Include="Views\Series\index.aspx" />
<Content Include="Views\Settings\Index.aspx" />
<Content Include="Web.config">

View File

@ -0,0 +1,45 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<NzbDrone.Core.Repository.Series>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Details
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h2>Details</h2>
<fieldset>
<legend>Fields</legend>
<div class="display-label">Id</div>
<div class="display-field"><%: Model.TvdbId %></div>
<div class="display-label">SeriesName</div>
<div class="display-field"><%: Model.SeriesName %></div>
<div class="display-label">Status</div>
<div class="display-field"><%: Model.Status %></div>
<div class="display-label">Overview</div>
<div class="display-field"><%: Model.Overview %></div>
<div class="display-label">AirTimes</div>
<div class="display-field"><%: Model.AirTimes %></div>
<div class="display-label">Language</div>
<div class="display-field"><%: Model.Language %></div>
<div class="display-label">Path</div>
<div class="display-field"><%: Model.Path %></div>
<div class="display-label">TvdbId</div>
<div class="display-field"><%: Model.TvdbId %></div>
</fieldset>
<p>
<%-- <%: Html.ActionLink("Edit", "Edit", new { /* id=Model.PrimaryKey */ }) %> |--%>
<%: Html.ActionLink("Back to List", "Index") %>
</p>
</asp:Content>

View File

@ -1,16 +1,13 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<NzbDrone.Core.Repository.Series>>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
SeriesView
SeriesView
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h2>SeriesView</h2>
<h2>
SeriesView</h2>
<table>
<tr>
<th></th>
<th>
Id
</th>
@ -20,58 +17,35 @@
<th>
Status
</th>
<th>
Overview
</th>
<th>
AirTimes
</th>
<th>
Language
</th>
<th>
Path
</th>
</tr>
<% foreach (var item in Model) { %>
<% foreach (var item in Model)
{ %>
<tr>
<%-- <td>
<%: Html.ActionLink("Details", "Details", new { item.TvdbId })%>
|
<%: Html.ActionLink("Delete", "Delete", new { item.TvdbId })%>
</td>--%>
<td>
<%: 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.TvdbId.ToString()%>
</td>
<td>
<%: item.Id %>
</td>
<td>
<%: item.SeriesName %>
<%: Html.ActionLink(item.SeriesName, "Details", new { item.TvdbId })%>
</td>
<td>
<%: item.Status %>
</td>
<td>
<%: item.Overview %>
</td>
<td>
<%: item.AirTimes %>
</td>
<td>
<%: item.Language %>
</td>
<td>
<%: item.Path %>
</td>
</tr>
<% } %>
<% } %>
</table>
<p>
<%: Html.ActionLink("Create New", "Create") %>
<%: Html.ActionLink("Sync With Disk", "Sync") %>
</p>
</asp:Content>

View File

@ -9,7 +9,7 @@
Settings</h2>
<% 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.") %>
<div>
<fieldset>
<legend>General</legend>

View File

@ -12,7 +12,7 @@
<div id="header">
<div id="title">
<h1>[Sponge bob]</h1>
<h1>NZBDrone</h1>
</div>
<div id="logindisplay">

View File

@ -8,52 +8,54 @@
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
<appSettings/>
<connectionStrings>
<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<!--
<appSettings/>
<connectionStrings>
<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies>
</compilation>
<!--
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="NzbDrone.Core"/>
</assemblies>
</compilation>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn" timeout="2880"/>
</authentication>
<membership>
<providers>
<clear/>
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression="" applicationName="/"/>
</providers>
</membership>
<profile>
<providers>
<clear/>
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="ApplicationServices" applicationName="/"/>
</providers>
</profile>
<roleManager enabled="false">
<providers>
<clear/>
<add connectionStringName="ApplicationServices" applicationName="/" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
<add applicationName="/" name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</providers>
</roleManager>
<!--
<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn" timeout="2880"/>
</authentication>
<membership>
<providers>
<clear/>
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression="" applicationName="/"/>
</providers>
</membership>
<profile>
<providers>
<clear/>
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="ApplicationServices" applicationName="/"/>
</providers>
</profile>
<roleManager enabled="false">
<providers>
<clear/>
<add connectionStringName="ApplicationServices" applicationName="/" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
<add applicationName="/" name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</providers>
</roleManager>
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
@ -65,35 +67,36 @@
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
<namespaces>
<add namespace="System.Web.Mvc"/>
<add namespace="System.Web.Mvc.Ajax"/>
<add namespace="System.Web.Mvc.Html"/>
<add namespace="System.Web.Routing"/>
<add namespace="System.Linq"/>
<add namespace="System.Collections.Generic"/>
</namespaces>
</pages>
</system.web>
<system.web.extensions/>
<!--
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
<namespaces>
<add namespace="System.Web.Mvc"/>
<add namespace="System.Web.Mvc.Ajax"/>
<add namespace="System.Web.Mvc.Html"/>
<add namespace="System.Web.Routing"/>
<add namespace="System.Linq"/>
<add namespace="System.Collections.Generic"/>
<add namespace="NzbDrone.Core.Repository"/>
</namespaces>
</pages>
</system.web>
<system.web.extensions/>
<!--
The system.webServer section is required for running ASP.NET AJAX under Internet
Information Services 7.0. It is not necessary for previous version of IIS.
-->
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
</modules>
<handlers>
<remove name="UrlRoutingHandler"/>
</handlers>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
</modules>
<handlers>
<remove name="UrlRoutingHandler"/>
</handlers>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>