mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 10:47:08 -07:00
CalculateFilePath will use configured season folder, with tests.
MoveFile creates folder before move.
This commit is contained in:
parent
a31858bb4c
commit
584a96a4f2
3 changed files with 33 additions and 6 deletions
|
@ -142,7 +142,6 @@ namespace NzbDrone.Core.Providers
|
|||
return episodeFile;
|
||||
}
|
||||
|
||||
|
||||
public virtual bool MoveEpisodeFile(EpisodeFile episodeFile)
|
||||
{
|
||||
if (episodeFile == null)
|
||||
|
@ -153,6 +152,9 @@ namespace NzbDrone.Core.Providers
|
|||
string newFileName = _mediaFileProvider.GetNewFilename(episodes, series.Title, episodeFile.Quality);
|
||||
var newFile = _mediaFileProvider.CalculateFilePath(series, episodes.First().SeasonNumber, newFileName, Path.GetExtension(episodeFile.Path));
|
||||
|
||||
//Ensure the folder Exists before trying to move it (No error is thrown if the folder already exists)
|
||||
_diskProvider.CreateDirectory(newFile.DirectoryName);
|
||||
|
||||
//Do the rename
|
||||
Logger.Trace("Attempting to rename {0} to {1}", episodeFile.Path, newFile.FullName);
|
||||
_diskProvider.MoveFile(episodeFile.Path, newFile.FullName);
|
||||
|
@ -164,7 +166,6 @@ namespace NzbDrone.Core.Providers
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Removes files that no longer exist on disk from the database
|
||||
/// </summary>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue