From 4d918ff683724a4c66561fcb3bcf5fe09d24cc8a Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Tue, 28 Feb 2012 23:20:40 -0800 Subject: [PATCH] New: Added Network to Series Grid. Fixed logging for RetentionSpecification. --- .../Datastore/Migrations/Migration20120228.cs | 15 +++++++++++++++ NzbDrone.Core/NzbDrone.Core.csproj | 1 + .../DecisionEngine/RetentionSpecification.cs | 2 +- NzbDrone.Core/Providers/SeriesProvider.cs | 7 ++++--- NzbDrone.Core/Repository/Series.cs | 2 ++ NzbDrone.Web/Controllers/SeriesController.cs | 1 + NzbDrone.Web/Models/SeriesModel.cs | 1 + NzbDrone.Web/Views/Series/Index.cshtml | 2 ++ 8 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 NzbDrone.Core/Datastore/Migrations/Migration20120228.cs diff --git a/NzbDrone.Core/Datastore/Migrations/Migration20120228.cs b/NzbDrone.Core/Datastore/Migrations/Migration20120228.cs new file mode 100644 index 000000000..c707e2671 --- /dev/null +++ b/NzbDrone.Core/Datastore/Migrations/Migration20120228.cs @@ -0,0 +1,15 @@ +using System.Data; +using Migrator.Framework; + +namespace NzbDrone.Core.Datastore.Migrations +{ + + [Migration(20120228)] + public class Migration20120228 : NzbDroneMigration + { + protected override void MainDbUpgrade() + { + Database.AddColumn("Series", "Network", DbType.String, ColumnProperty.Null); + } + } +} \ No newline at end of file diff --git a/NzbDrone.Core/NzbDrone.Core.csproj b/NzbDrone.Core/NzbDrone.Core.csproj index a414324ef..ba04cb773 100644 --- a/NzbDrone.Core/NzbDrone.Core.csproj +++ b/NzbDrone.Core/NzbDrone.Core.csproj @@ -222,6 +222,7 @@ + diff --git a/NzbDrone.Core/Providers/DecisionEngine/RetentionSpecification.cs b/NzbDrone.Core/Providers/DecisionEngine/RetentionSpecification.cs index 51b1c8ce1..58a86651d 100644 --- a/NzbDrone.Core/Providers/DecisionEngine/RetentionSpecification.cs +++ b/NzbDrone.Core/Providers/DecisionEngine/RetentionSpecification.cs @@ -25,7 +25,7 @@ namespace NzbDrone.Core.Providers.DecisionEngine logger.Trace("Checking if report meets retention requirements. {0}", subject.Age); if (_configProvider.Retention > 0 && subject.Age > _configProvider.Retention) { - logger.Trace("Quality {0} rejected by user's retention limit", subject.Age); + logger.Trace("Report age: {0} rejected by user's retention limit", subject.Age); return false; } diff --git a/NzbDrone.Core/Providers/SeriesProvider.cs b/NzbDrone.Core/Providers/SeriesProvider.cs index 1a5b2b1a6..2618bf8a1 100644 --- a/NzbDrone.Core/Providers/SeriesProvider.cs +++ b/NzbDrone.Core/Providers/SeriesProvider.cs @@ -46,7 +46,7 @@ namespace NzbDrone.Core.Providers { var series = _database .Fetch(@"SELECT Series.SeriesId, Series.Title, Series.CleanTitle, Series.Status, Series.Overview, Series.AirsDayOfWeek,Series.AirTimes, - Series.Language, Series.Path, Series.Monitored, Series.QualityProfileId, Series.SeasonFolder, Series.BacklogSetting, + Series.Language, Series.Path, Series.Monitored, Series.QualityProfileId, Series.SeasonFolder, Series.BacklogSetting, Series.Network, SUM(CASE WHEN Ignored = 0 AND Airdate <= @0 THEN 1 ELSE 0 END) AS EpisodeCount, SUM(CASE WHEN Episodes.Ignored = 0 AND Episodes.EpisodeFileId > 0 AND Episodes.AirDate <= @0 THEN 1 ELSE 0 END) as EpisodeFileCount, MAX(Episodes.SeasonNumber) as SeasonCount, MIN(CASE WHEN AirDate < @0 OR Ignored = 1 THEN NULL ELSE AirDate END) as NextAiring, @@ -55,8 +55,8 @@ namespace NzbDrone.Core.Providers INNER JOIN QualityProfiles ON Series.QualityProfileId = QualityProfiles.QualityProfileId LEFT JOIN Episodes ON Series.SeriesId = Episodes.SeriesId WHERE Series.LastInfoSync IS NOT NULL - GROUP BY Series.SeriesId, Series.Title, Series.CleanTitle, Series.Status, Series.Overview, Series.AirsDayOfWeek,Series.AirTimes, - Series.Language, Series.Path, Series.Monitored, Series.QualityProfileId, Series.SeasonFolder, Series.BacklogSetting, + GROUP BY Series.SeriesId, Series.Title, Series.CleanTitle, Series.Status, Series.Overview, Series.AirsDayOfWeek, Series.AirTimes, + Series.Language, Series.Path, Series.Monitored, Series.QualityProfileId, Series.SeasonFolder, Series.BacklogSetting, Series.Network, QualityProfiles.QualityProfileId, QualityProfiles.Name, QualityProfiles.Cutoff, QualityProfiles.SonicAllowed", DateTime.Today); return series; @@ -97,6 +97,7 @@ namespace NzbDrone.Core.Providers series.LastInfoSync = DateTime.Now; series.Runtime = (int)tvDbSeries.Runtime; series.BannerUrl = tvDbSeries.BannerPath; + series.Network = tvDbSeries.Network; UpdateSeries(series); return series; diff --git a/NzbDrone.Core/Repository/Series.cs b/NzbDrone.Core/Repository/Series.cs index 82f8ebfd7..13fce0064 100644 --- a/NzbDrone.Core/Repository/Series.cs +++ b/NzbDrone.Core/Repository/Series.cs @@ -46,6 +46,8 @@ namespace NzbDrone.Core.Repository public BacklogSettingType BacklogSetting { get; set; } + public string Network { get; set; } + /// /// Gets or sets a value indicating whether this is hidden. /// diff --git a/NzbDrone.Web/Controllers/SeriesController.cs b/NzbDrone.Web/Controllers/SeriesController.cs index 523d6d1e5..3639583a6 100644 --- a/NzbDrone.Web/Controllers/SeriesController.cs +++ b/NzbDrone.Web/Controllers/SeriesController.cs @@ -193,6 +193,7 @@ namespace NzbDrone.Web.Controllers Path = s.Path, QualityProfileId = s.QualityProfileId, QualityProfileName = s.QualityProfile.Name, + Network = s.Network, SeasonFolder = s.SeasonFolder, BacklogSetting = (int)s.BacklogSetting, Status = s.Status, diff --git a/NzbDrone.Web/Models/SeriesModel.cs b/NzbDrone.Web/Models/SeriesModel.cs index 34002756a..fe36a2234 100644 --- a/NzbDrone.Web/Models/SeriesModel.cs +++ b/NzbDrone.Web/Models/SeriesModel.cs @@ -26,6 +26,7 @@ namespace NzbDrone.Web.Models public string NextAiring { get; set; } public string NextAiringSorter { get; set; } public string Details { get; set; } + public string Network { get; set; } public IList Seasons { get; set; } diff --git a/NzbDrone.Web/Views/Series/Index.cshtml b/NzbDrone.Web/Views/Series/Index.cshtml index dac850127..1365b3bc0 100644 --- a/NzbDrone.Web/Views/Series/Index.cshtml +++ b/NzbDrone.Web/Views/Series/Index.cshtml @@ -88,6 +88,7 @@ Title Seasons Quality + Network Next Airing Episodes @@ -170,6 +171,7 @@ }, //Title { sWidth: '100px', "mDataProp": "SeasonsCount", "bSortable": false }, //Seasons { sWidth: '100px', "mDataProp": "QualityProfileName" }, //Quality + { sWidth: '100px', "mDataProp": "Network" }, //Network { sWidth: '120px', "mDataProp": function (source, type, val) { // 'display' and 'filter' use our fancy naming if (type === 'display' || type === 'filter') {