From ce0a6f8b86b56436adb2cc64c585a3e7eccfef0f Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Wed, 2 May 2012 08:37:09 -0700 Subject: [PATCH] NzbInfoUrl added to history and episode parse result, will be added to history item before being added to the DB. --- .../{Migration20120414.cs => Migration20120430.cs} | 6 +++--- NzbDrone.Core/Model/EpisodeParseResult.cs | 2 ++ NzbDrone.Core/Providers/DownloadProvider.cs | 2 +- NzbDrone.Core/Repository/History.cs | 1 + 4 files changed, 7 insertions(+), 4 deletions(-) rename NzbDrone.Core/Datastore/Migrations/{Migration20120414.cs => Migration20120430.cs} (50%) diff --git a/NzbDrone.Core/Datastore/Migrations/Migration20120414.cs b/NzbDrone.Core/Datastore/Migrations/Migration20120430.cs similarity index 50% rename from NzbDrone.Core/Datastore/Migrations/Migration20120414.cs rename to NzbDrone.Core/Datastore/Migrations/Migration20120430.cs index 6c6e296aa..ca949c36b 100644 --- a/NzbDrone.Core/Datastore/Migrations/Migration20120414.cs +++ b/NzbDrone.Core/Datastore/Migrations/Migration20120430.cs @@ -4,12 +4,12 @@ namespace NzbDrone.Core.Datastore.Migrations { - [Migration(20120414)] - public class Migration20120414 : NzbDroneMigration + [Migration(20120430)] + public class Migration20120430 : NzbDroneMigration { protected override void MainDbUpgrade() { - Database.AddColumn("History", "Url", DbType.String, ColumnProperty.Null); + Database.AddColumn("History", "NzbInfoUrl", DbType.String, ColumnProperty.Null); } } } \ No newline at end of file diff --git a/NzbDrone.Core/Model/EpisodeParseResult.cs b/NzbDrone.Core/Model/EpisodeParseResult.cs index b8375bef4..97a4a78a4 100644 --- a/NzbDrone.Core/Model/EpisodeParseResult.cs +++ b/NzbDrone.Core/Model/EpisodeParseResult.cs @@ -30,6 +30,8 @@ public string CleanTitle public string NzbUrl { get; set; } + public string NzbInfoUrl { get; set; } + public string OriginalString { get; set; } public Series Series { get; set; } diff --git a/NzbDrone.Core/Providers/DownloadProvider.cs b/NzbDrone.Core/Providers/DownloadProvider.cs index 521491f4f..e70f87e74 100644 --- a/NzbDrone.Core/Providers/DownloadProvider.cs +++ b/NzbDrone.Core/Providers/DownloadProvider.cs @@ -52,7 +52,6 @@ public virtual bool DownloadReport(EpisodeParseResult parseResult) { logger.Trace("Download added to Queue: {0}", downloadTitle); - foreach (var episode in _episodeProvider.GetEpisodesByParseResult(parseResult)) { var history = new History(); @@ -63,6 +62,7 @@ public virtual bool DownloadReport(EpisodeParseResult parseResult) history.NzbTitle = parseResult.OriginalString; history.EpisodeId = episode.EpisodeId; history.SeriesId = episode.SeriesId; + history.NzbInfoUrl = parseResult.NzbInfoUrl; _historyProvider.Add(history); _episodeProvider.MarkEpisodeAsFetched(episode.EpisodeId); diff --git a/NzbDrone.Core/Repository/History.cs b/NzbDrone.Core/Repository/History.cs index d34d6c2b2..0c00ff2c9 100644 --- a/NzbDrone.Core/Repository/History.cs +++ b/NzbDrone.Core/Repository/History.cs @@ -16,6 +16,7 @@ public class History public DateTime Date { get; set; } public bool IsProper { get; set; } public string Indexer { get; set; } + public string NzbInfoUrl { get; set; } [ResultColumn] public Episode Episode { get; set; }