Simplify logic using pattern matching

This commit is contained in:
Jendrik Weise 2023-08-19 18:47:43 +02:00
parent 0943d98f97
commit 8f765b5880
1 changed files with 2 additions and 9 deletions

View File

@ -121,16 +121,10 @@ namespace NzbDrone.Core.MediaFiles
throw new SameFilenameException("File not moved, source and destination are the same", episodeFilePath); throw new SameFilenameException("File not moved, source and destination are the same", episodeFilePath);
} }
var transfer = true;
episodeFile.RelativePath = series.Path.GetRelativePath(destinationFilePath); episodeFile.RelativePath = series.Path.GetRelativePath(destinationFilePath);
if (localEpisode is not null) if (localEpisode is not null && _scriptImportDecider.TryImport(episodeFilePath, destinationFilePath, localEpisode, episodeFile, mode) is var scriptImportDecision && scriptImportDecision != ScriptImportDecision.DeferMove)
{ {
var scriptImportDecision = _scriptImportDecider.TryImport(episodeFilePath, destinationFilePath, localEpisode, episodeFile, mode);
transfer = scriptImportDecision == ScriptImportDecision.DeferMove;
if (scriptImportDecision == ScriptImportDecision.RenameRequested) if (scriptImportDecision == ScriptImportDecision.RenameRequested)
{ {
try try
@ -143,8 +137,7 @@ namespace NzbDrone.Core.MediaFiles
} }
} }
} }
else
if (transfer)
{ {
_diskTransferService.TransferFile(episodeFilePath, destinationFilePath, mode); _diskTransferService.TransferFile(episodeFilePath, destinationFilePath, mode);
} }