mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-23 14:55:20 -07:00
Revert "Merge branch 'rename-existing-folder' into develop"
This reverts commita340bc4da3
, reversing changes made to4be7772d53
.
This commit is contained in:
parent
9953a5ed06
commit
5d2ef4786b
12 changed files with 330 additions and 397 deletions
|
@ -64,11 +64,6 @@ namespace NzbDrone.Common.Extensions
|
||||||
return childPath.Substring(parentPath.Length).Trim(Path.DirectorySeparatorChar);
|
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)
|
public static string GetParentPath(this string childPath)
|
||||||
{
|
{
|
||||||
var parentPath = childPath.TrimEnd('\\', '/');
|
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)
|
public void Handle(EpisodeFolderCreatedEvent message)
|
||||||
{
|
{
|
||||||
var series = message.Series;
|
var series = message.Series;
|
||||||
|
|
|
@ -116,12 +116,6 @@ namespace NzbDrone.Core.MediaFiles
|
||||||
|
|
||||||
_diskTransferService.TransferFile(movieFilePath, destinationFilePath, mode);
|
_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);
|
movieFile.RelativePath = movie.Path.GetRelativePath(destinationFilePath);
|
||||||
|
|
||||||
_updateMovieFileService.ChangeFileDateForFile(movieFile, movie);
|
_updateMovieFileService.ChangeFileDateForFile(movieFile, movie);
|
||||||
|
@ -138,8 +132,6 @@ namespace NzbDrone.Core.MediaFiles
|
||||||
|
|
||||||
_mediaFileAttributeService.SetFilePermissions(destinationFilePath);
|
_mediaFileAttributeService.SetFilePermissions(destinationFilePath);
|
||||||
|
|
||||||
_diskProvider.DeleteFolder(oldMoviePath, true);
|
|
||||||
|
|
||||||
return movieFile;
|
return movieFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,7 +144,6 @@ namespace NzbDrone.Core.MediaFiles
|
||||||
{
|
{
|
||||||
var movieFolder = Path.GetDirectoryName(filePath);
|
var movieFolder = Path.GetDirectoryName(filePath);
|
||||||
var rootFolder = new OsPath(movieFolder).Directory.FullPath;
|
var rootFolder = new OsPath(movieFolder).Directory.FullPath;
|
||||||
var fileName = Path.GetFileName(filePath);
|
|
||||||
|
|
||||||
if (!_diskProvider.FolderExists(rootFolder))
|
if (!_diskProvider.FolderExists(rootFolder))
|
||||||
{
|
{
|
||||||
|
@ -165,7 +156,7 @@ namespace NzbDrone.Core.MediaFiles
|
||||||
if (!_diskProvider.FolderExists(movieFolder))
|
if (!_diskProvider.FolderExists(movieFolder))
|
||||||
{
|
{
|
||||||
CreateFolder(movieFolder);
|
CreateFolder(movieFolder);
|
||||||
newEvent.MovieFolder = movieFolder;
|
newEvent.SeriesFolder = movieFolder;
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,9 +71,8 @@ namespace NzbDrone.Core.MediaFiles
|
||||||
{
|
{
|
||||||
MovieId = movie.Id,
|
MovieId = movie.Id,
|
||||||
MovieFileId = file.Id,
|
MovieFileId = file.Id,
|
||||||
ExistingPath = movieFilePath,
|
ExistingPath = file.RelativePath,
|
||||||
//NewPath = movie.Path.GetRelativePath(newPath)
|
NewPath = movie.Path.GetRelativePath(newPath)
|
||||||
NewPath = newPath
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,7 +94,6 @@ namespace NzbDrone.Core.MediaFiles
|
||||||
_movieFileMover.MoveMovieFile(movieFile, movie);
|
_movieFileMover.MoveMovieFile(movieFile, movie);
|
||||||
|
|
||||||
_mediaFileService.Update(movieFile);
|
_mediaFileService.Update(movieFile);
|
||||||
_movieService.UpdateMovie(movie);
|
|
||||||
renamed.Add(movieFile);
|
renamed.Add(movieFile);
|
||||||
|
|
||||||
_logger.Debug("Renamed movie file: {0}", movieFile);
|
_logger.Debug("Renamed movie file: {0}", movieFile);
|
||||||
|
@ -124,7 +122,7 @@ namespace NzbDrone.Core.MediaFiles
|
||||||
|
|
||||||
public void Execute(RenameMovieCommand message)
|
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);
|
var moviesToRename = _movieService.GetMovies(message.MovieIds);
|
||||||
|
|
||||||
foreach(var movie in moviesToRename)
|
foreach(var movie in moviesToRename)
|
||||||
|
|
|
@ -158,11 +158,12 @@ namespace NzbDrone.Core.Organizer
|
||||||
return GetOriginalTitle(movieFile);
|
return GetOriginalTitle(movieFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO: Update namingConfig for Movies!
|
||||||
var pattern = namingConfig.StandardMovieFormat;
|
var pattern = namingConfig.StandardMovieFormat;
|
||||||
var tokenHandlers = new Dictionary<string, Func<TokenMatch, string>>(FileNameBuilderTokenEqualityComparer.Instance);
|
var tokenHandlers = new Dictionary<string, Func<TokenMatch, string>>(FileNameBuilderTokenEqualityComparer.Instance);
|
||||||
|
|
||||||
AddMovieTokens(tokenHandlers, movie);
|
AddMovieTokens(tokenHandlers, movie);
|
||||||
AddReleaseDateTokens(tokenHandlers, movie.Year);
|
AddReleaseDateTokens(tokenHandlers, movie.Year); //In case we want to separate the year
|
||||||
AddImdbIdTokens(tokenHandlers, movie.ImdbId);
|
AddImdbIdTokens(tokenHandlers, movie.ImdbId);
|
||||||
AddQualityTokens(tokenHandlers, movie, movieFile);
|
AddQualityTokens(tokenHandlers, movie, movieFile);
|
||||||
AddMediaInfoTokens(tokenHandlers, movieFile);
|
AddMediaInfoTokens(tokenHandlers, movieFile);
|
||||||
|
@ -189,37 +190,11 @@ namespace NzbDrone.Core.Organizer
|
||||||
{
|
{
|
||||||
Ensure.That(extension, () => extension).IsNotNullOrWhiteSpace();
|
Ensure.That(extension, () => extension).IsNotNullOrWhiteSpace();
|
||||||
|
|
||||||
var path = BuildMoviePath(movie);
|
var path = movie.Path;
|
||||||
|
|
||||||
return Path.Combine(path, fileName + extension);
|
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
public string BuildSeasonPath(Series series, int seasonNumber)
|
public string BuildSeasonPath(Series series, int seasonNumber)
|
||||||
{
|
{
|
||||||
var path = series.Path;
|
var path = series.Path;
|
||||||
|
|
|
@ -74,19 +74,6 @@ module.exports = Marionette.Layout.extend({
|
||||||
var file = movie.model.get("movieFile");
|
var file = movie.model.get("movieFile");
|
||||||
this.filesCollection.add(file);
|
this.filesCollection.add(file);
|
||||||
//this.listenTo(this.releaseCollection, 'sync', this._showSearchResults);
|
//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() {
|
onShow : function() {
|
||||||
|
|
|
@ -9,7 +9,6 @@ module.exports = Marionette.ItemView.extend({
|
||||||
//var type = this.model.get('seriesType');
|
//var type = this.model.get('seriesType');
|
||||||
return {
|
return {
|
||||||
rename : this.naming.get('renameEpisodes'),
|
rename : this.naming.get('renameEpisodes'),
|
||||||
folderFormat: this.naming.get('movieFolderFormat'),
|
|
||||||
format : this.naming.get('standardMovieFormat')
|
format : this.naming.get('standardMovieFormat')
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
{{#if rename}}
|
{{#if rename}}
|
||||||
Folder Naming pattern: {{folderFormat}}<br>
|
|
||||||
Naming pattern: {{format}}
|
Naming pattern: {{format}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<div class="alert alert-info">
|
<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 class="x-format-region"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue