From 83207a0bafa871fe4a1d50edef50a0e5636bfa85 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Wed, 25 Jun 2014 00:09:16 -0700 Subject: [PATCH] listenTo instead of on --- .../MediaFiles/RenameEpisodeFileService.cs | 12 ++++-------- src/UI/AddSeries/AddSeriesLayout.js | 2 +- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/NzbDrone.Core/MediaFiles/RenameEpisodeFileService.cs b/src/NzbDrone.Core/MediaFiles/RenameEpisodeFileService.cs index 060f3c3ba..6a81ee4c8 100644 --- a/src/NzbDrone.Core/MediaFiles/RenameEpisodeFileService.cs +++ b/src/NzbDrone.Core/MediaFiles/RenameEpisodeFileService.cs @@ -73,8 +73,9 @@ namespace NzbDrone.Core.MediaFiles private IEnumerable GetPreviews(Series series, List episodes, List files) { - foreach (var file in files) + foreach (var f in files) { + var file = f; var episodesInFile = episodes.Where(e => e.EpisodeFileId == file.Id).ToList(); if (!episodesInFile.Any()) @@ -95,18 +96,13 @@ namespace NzbDrone.Core.MediaFiles SeasonNumber = seasonNumber, EpisodeNumbers = episodesInFile.Select(e => e.EpisodeNumber).ToList(), EpisodeFileId = file.Id, - ExistingPath = GetRelativePath(series.Path, file.Path), - NewPath = GetRelativePath(series.Path, newPath) + ExistingPath = series.Path.GetRelativePath(file.Path), + NewPath = series.Path.GetRelativePath(newPath) }; } } } - private string GetRelativePath(string seriesPath, string path) - { - return path.Substring(seriesPath.Length + 1); - } - private void RenameFiles(List episodeFiles, Series series) { var renamed = new List(); diff --git a/src/UI/AddSeries/AddSeriesLayout.js b/src/UI/AddSeries/AddSeriesLayout.js index e6e265abe..b51245d3a 100644 --- a/src/UI/AddSeries/AddSeriesLayout.js +++ b/src/UI/AddSeries/AddSeriesLayout.js @@ -55,7 +55,7 @@ define( _importSeries: function () { this.rootFolderLayout = new RootFolderLayout(); - this.rootFolderLayout.on('folderSelected', this._folderSelected, this); + this.listenTo(this.rootFolderLayout, 'folderSelected', this._folderSelected); AppLayout.modalRegion.show(this.rootFolderLayout); },