Revert "Merge branch 'rename-existing-folder' into develop"

This reverts commit a340bc4da3, reversing
changes made to 4be7772d53.
pull/497/head
Tim Turner 8 years ago
parent 9953a5ed06
commit 5d2ef4786b

@ -64,11 +64,6 @@ namespace NzbDrone.Common.Extensions
return childPath.Substring(parentPath.Length).Trim(Path.DirectorySeparatorChar);
}
public static string GetRelativePathWithoutChildCheck(this string parentPath, string childPath)
{
return childPath.Substring(parentPath.Length).Trim(Path.DirectorySeparatorChar);
}
public static string GetParentPath(this string childPath)
{
var parentPath = childPath.TrimEnd('\\', '/');

@ -123,17 +123,6 @@ namespace NzbDrone.Core.Extras
// }
//}
// TODO
public void Handle(MovieFolderCreatedEvent message)
{
var movie = message.Movie;
foreach(var extraFileManager in _extraFileManagers)
{
//extraFileManager.CreateAfterMovieImport(movie, message.MovieFolder);
}
}
public void Handle(EpisodeFolderCreatedEvent message)
{
var series = message.Series;

@ -116,12 +116,6 @@ namespace NzbDrone.Core.MediaFiles
_diskTransferService.TransferFile(movieFilePath, destinationFilePath, mode);
var oldMoviePath = new OsPath(movieFilePath).Directory.FullPath.TrimEnd(Path.DirectorySeparatorChar);
var newMoviePath = new OsPath(destinationFilePath).Directory.FullPath.TrimEnd(Path.DirectorySeparatorChar);
movie.Path = newMoviePath;
movieFile.RelativePath = movie.Path.GetRelativePath(destinationFilePath);
_updateMovieFileService.ChangeFileDateForFile(movieFile, movie);
@ -138,8 +132,6 @@ namespace NzbDrone.Core.MediaFiles
_mediaFileAttributeService.SetFilePermissions(destinationFilePath);
_diskProvider.DeleteFolder(oldMoviePath, true);
return movieFile;
}
@ -152,7 +144,6 @@ namespace NzbDrone.Core.MediaFiles
{
var movieFolder = Path.GetDirectoryName(filePath);
var rootFolder = new OsPath(movieFolder).Directory.FullPath;
var fileName = Path.GetFileName(filePath);
if (!_diskProvider.FolderExists(rootFolder))
{
@ -165,7 +156,7 @@ namespace NzbDrone.Core.MediaFiles
if (!_diskProvider.FolderExists(movieFolder))
{
CreateFolder(movieFolder);
newEvent.MovieFolder = movieFolder;
newEvent.SeriesFolder = movieFolder;
changed = true;
}

@ -71,9 +71,8 @@ namespace NzbDrone.Core.MediaFiles
{
MovieId = movie.Id,
MovieFileId = file.Id,
ExistingPath = movieFilePath,
//NewPath = movie.Path.GetRelativePath(newPath)
NewPath = newPath
ExistingPath = file.RelativePath,
NewPath = movie.Path.GetRelativePath(newPath)
};
}
@ -95,7 +94,6 @@ namespace NzbDrone.Core.MediaFiles
_movieFileMover.MoveMovieFile(movieFile, movie);
_mediaFileService.Update(movieFile);
_movieService.UpdateMovie(movie);
renamed.Add(movieFile);
_logger.Debug("Renamed movie file: {0}", movieFile);
@ -124,7 +122,7 @@ namespace NzbDrone.Core.MediaFiles
public void Execute(RenameMovieCommand message)
{
_logger.Debug("Renaming all files for selected movies");
_logger.Debug("Renaming all files for selected movie");
var moviesToRename = _movieService.GetMovies(message.MovieIds);
foreach(var movie in moviesToRename)

@ -158,11 +158,12 @@ namespace NzbDrone.Core.Organizer
return GetOriginalTitle(movieFile);
}
//TODO: Update namingConfig for Movies!
var pattern = namingConfig.StandardMovieFormat;
var tokenHandlers = new Dictionary<string, Func<TokenMatch, string>>(FileNameBuilderTokenEqualityComparer.Instance);
AddMovieTokens(tokenHandlers, movie);
AddReleaseDateTokens(tokenHandlers, movie.Year);
AddReleaseDateTokens(tokenHandlers, movie.Year); //In case we want to separate the year
AddImdbIdTokens(tokenHandlers, movie.ImdbId);
AddQualityTokens(tokenHandlers, movie, movieFile);
AddMediaInfoTokens(tokenHandlers, movieFile);
@ -189,35 +190,9 @@ namespace NzbDrone.Core.Organizer
{
Ensure.That(extension, () => extension).IsNotNullOrWhiteSpace();
var path = BuildMoviePath(movie);
return Path.Combine(path, fileName + extension);
}
public string BuildMoviePath(Movie movie)
{
var path = movie.Path;
var directory = new DirectoryInfo(path).Name;
var parentDirectoryPath = new DirectoryInfo(path).Parent.FullName;
var namingConfig = _namingConfigService.GetConfig();
var movieFile = movie.MovieFile;
var pattern = namingConfig.MovieFolderFormat;
var tokenHandlers = new Dictionary<string, Func<TokenMatch, string>>(FileNameBuilderTokenEqualityComparer.Instance);
AddMovieTokens(tokenHandlers, movie);
AddReleaseDateTokens(tokenHandlers, movie.Year);
AddImdbIdTokens(tokenHandlers, movie.ImdbId);
AddQualityTokens(tokenHandlers, movie, movieFile);
AddMediaInfoTokens(tokenHandlers, movieFile);
AddMovieFileTokens(tokenHandlers, movieFile);
var directoryName = ReplaceTokens(pattern, tokenHandlers, namingConfig).Trim();
directoryName = FileNameCleanupRegex.Replace(directoryName, match => match.Captures[0].Value[0].ToString());
directoryName = TrimSeparatorsRegex.Replace(directoryName, string.Empty);
return Path.Combine(parentDirectoryPath, directoryName);
return Path.Combine(path, fileName + extension);
}
public string BuildSeasonPath(Series series, int seasonNumber)

@ -74,19 +74,6 @@ module.exports = Marionette.Layout.extend({
var file = movie.model.get("movieFile");
this.filesCollection.add(file);
//this.listenTo(this.releaseCollection, 'sync', this._showSearchResults);
this.listenTo(this.model, 'change', function(model, options) {
if (options && options.changeSource === 'signalr') {
this._refresh(movie);
}
});
},
_refresh : function(movie) {
this.filesCollection = new FilesCollection();
var file = movie.model.get("movieFile");
this.filesCollection.add(file);
this.onShow();
},
onShow : function() {

@ -9,7 +9,6 @@ module.exports = Marionette.ItemView.extend({
//var type = this.model.get('seriesType');
return {
rename : this.naming.get('renameEpisodes'),
folderFormat: this.naming.get('movieFolderFormat'),
format : this.naming.get('standardMovieFormat')
};
},

@ -1,4 +1,3 @@
{{#if rename}}
Folder Naming pattern: {{folderFormat}}<br>
Naming pattern: {{format}}
{{/if}}

@ -9,7 +9,7 @@
</div>
<div class="modal-body">
<div class="alert alert-info">
<div class="path-info x-path-info">Your movie may be moved; see the paths below</div>
<div class="path-info x-path-info">All paths are relative to: <strong>{{path}}</strong></div>
<div class="x-format-region"></div>
</div>

Loading…
Cancel
Save