listenTo instead of on

This commit is contained in:
Mark McDowall 2014-06-25 00:09:16 -07:00
parent 6a9993fa70
commit 83207a0baf
2 changed files with 5 additions and 9 deletions

View File

@ -73,8 +73,9 @@ namespace NzbDrone.Core.MediaFiles
private IEnumerable<RenameEpisodeFilePreview> GetPreviews(Series series, List<Episode> episodes, List<EpisodeFile> files) private IEnumerable<RenameEpisodeFilePreview> GetPreviews(Series series, List<Episode> episodes, List<EpisodeFile> files)
{ {
foreach (var file in files) foreach (var f in files)
{ {
var file = f;
var episodesInFile = episodes.Where(e => e.EpisodeFileId == file.Id).ToList(); var episodesInFile = episodes.Where(e => e.EpisodeFileId == file.Id).ToList();
if (!episodesInFile.Any()) if (!episodesInFile.Any())
@ -95,18 +96,13 @@ namespace NzbDrone.Core.MediaFiles
SeasonNumber = seasonNumber, SeasonNumber = seasonNumber,
EpisodeNumbers = episodesInFile.Select(e => e.EpisodeNumber).ToList(), EpisodeNumbers = episodesInFile.Select(e => e.EpisodeNumber).ToList(),
EpisodeFileId = file.Id, EpisodeFileId = file.Id,
ExistingPath = GetRelativePath(series.Path, file.Path), ExistingPath = series.Path.GetRelativePath(file.Path),
NewPath = GetRelativePath(series.Path, newPath) NewPath = series.Path.GetRelativePath(newPath)
}; };
} }
} }
} }
private string GetRelativePath(string seriesPath, string path)
{
return path.Substring(seriesPath.Length + 1);
}
private void RenameFiles(List<EpisodeFile> episodeFiles, Series series) private void RenameFiles(List<EpisodeFile> episodeFiles, Series series)
{ {
var renamed = new List<EpisodeFile>(); var renamed = new List<EpisodeFile>();

View File

@ -55,7 +55,7 @@ define(
_importSeries: function () { _importSeries: function () {
this.rootFolderLayout = new RootFolderLayout(); this.rootFolderLayout = new RootFolderLayout();
this.rootFolderLayout.on('folderSelected', this._folderSelected, this); this.listenTo(this.rootFolderLayout, 'folderSelected', this._folderSelected);
AppLayout.modalRegion.show(this.rootFolderLayout); AppLayout.modalRegion.show(this.rootFolderLayout);
}, },