From dd835d55033c7cdf5c4e279cb56635631b4b84b9 Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Thu, 29 Aug 2013 23:50:43 -0700 Subject: [PATCH] clear existing scene name since it wasn't storing the correct string --- .../Datastore/Migration/017_reset_scene_names.cs | 15 +++++++++++++++ .../EpisodeImport/ImportApprovedEpisodes.cs | 2 +- NzbDrone.Core/NzbDrone.Core.csproj | 1 + 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 NzbDrone.Core/Datastore/Migration/017_reset_scene_names.cs diff --git a/NzbDrone.Core/Datastore/Migration/017_reset_scene_names.cs b/NzbDrone.Core/Datastore/Migration/017_reset_scene_names.cs new file mode 100644 index 000000000..e2e3a21d6 --- /dev/null +++ b/NzbDrone.Core/Datastore/Migration/017_reset_scene_names.cs @@ -0,0 +1,15 @@ +using FluentMigrator; +using NzbDrone.Core.Datastore.Migration.Framework; + +namespace NzbDrone.Core.Datastore.Migration +{ + [Migration(17)] + public class reset_scene_names : NzbDroneMigrationBase + { + protected override void MainDbUpgrade() + { + //we were storing new file name as scene name. + Execute.Sql(@"UPDATE EpisodeFiles SET SceneName = NULL where SceneName != NULL"); + } + } +} diff --git a/NzbDrone.Core/MediaFiles/EpisodeImport/ImportApprovedEpisodes.cs b/NzbDrone.Core/MediaFiles/EpisodeImport/ImportApprovedEpisodes.cs index 087f29e68..733b8580d 100644 --- a/NzbDrone.Core/MediaFiles/EpisodeImport/ImportApprovedEpisodes.cs +++ b/NzbDrone.Core/MediaFiles/EpisodeImport/ImportApprovedEpisodes.cs @@ -62,12 +62,12 @@ public List Import(List decisions, bool newDownl episodeFile.Size = _diskProvider.GetFileSize(localEpisode.Path); episodeFile.Quality = localEpisode.Quality; episodeFile.SeasonNumber = localEpisode.SeasonNumber; - episodeFile.SceneName = Path.GetFileNameWithoutExtension(localEpisode.Path.CleanFilePath()); episodeFile.Episodes = localEpisode.Episodes; if (newDownload) { + episodeFile.SceneName = Path.GetFileNameWithoutExtension(localEpisode.Path.CleanFilePath()); episodeFile.Path = _episodeFileUpgrader.UpgradeEpisodeFile(episodeFile, localEpisode); _messageAggregator.PublishEvent(new EpisodeImportedEvent(localEpisode, episodeFile)); _messageAggregator.PublishEvent(new EpisodeDownloadedEvent(localEpisode)); diff --git a/NzbDrone.Core/NzbDrone.Core.csproj b/NzbDrone.Core/NzbDrone.Core.csproj index 26f5df9b8..82fd0aa60 100644 --- a/NzbDrone.Core/NzbDrone.Core.csproj +++ b/NzbDrone.Core/NzbDrone.Core.csproj @@ -159,6 +159,7 @@ +