mirror of
https://github.com/Radarr/Radarr
synced 2025-01-19 14:11:40 +00:00
Hotfix when importing movie (#971)
This commit is contained in:
parent
dfcdf8871c
commit
d84e6c84f5
1 changed files with 11 additions and 6 deletions
|
@ -42,16 +42,21 @@ public MovieFileMoveResult UpgradeMovieFile(MovieFile movieFile, LocalMovie loca
|
|||
var moveFileResult = new MovieFileMoveResult();
|
||||
|
||||
var existingFile = localMovie.Movie.MovieFile.Value;
|
||||
var movieFilePath = Path.Combine(localMovie.Movie.Path, existingFile.RelativePath);
|
||||
|
||||
if (_diskProvider.FileExists(movieFilePath))
|
||||
if (existingFile != null)
|
||||
{
|
||||
_logger.Debug("Removing existing movie file: {0}", existingFile);
|
||||
_recycleBinProvider.DeleteFile(movieFilePath);
|
||||
var movieFilePath = Path.Combine(localMovie.Movie.Path, existingFile.RelativePath);
|
||||
|
||||
if (_diskProvider.FileExists(movieFilePath))
|
||||
{
|
||||
_logger.Debug("Removing existing movie file: {0}", existingFile);
|
||||
_recycleBinProvider.DeleteFile(movieFilePath);
|
||||
}
|
||||
|
||||
moveFileResult.OldFiles.Add(existingFile);
|
||||
_mediaFileService.Delete(existingFile, DeleteMediaFileReason.Upgrade);
|
||||
}
|
||||
|
||||
moveFileResult.OldFiles.Add(existingFile);
|
||||
_mediaFileService.Delete(existingFile, DeleteMediaFileReason.Upgrade);
|
||||
if (copyOnly)
|
||||
{
|
||||
moveFileResult.MovieFile = _movieFileMover.CopyMovieFile(movieFile, localMovie);
|
||||
|
|
Loading…
Reference in a new issue