mirror of https://github.com/lidarr/Lidarr
Fixed: Lidarr deletes download folder with audio files left over
Closes #182
This commit is contained in:
parent
e00c7af8b7
commit
b2ce3d5bda
|
@ -190,38 +190,6 @@ namespace NzbDrone.Core.Test.MediaFiles
|
|||
ExceptionVerification.ExpectedWarns(1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_delete_folder_if_files_were_imported_and_only_sample_files_remain()
|
||||
{
|
||||
GivenValidArtist();
|
||||
|
||||
var localTrack = new LocalTrack();
|
||||
|
||||
var imported = new List<ImportDecision>();
|
||||
imported.Add(new ImportDecision(localTrack));
|
||||
|
||||
Mocker.GetMock<IMakeImportDecision>()
|
||||
.Setup(s => s.GetImportDecisions(It.IsAny<List<string>>(), It.IsAny<Artist>(), null))
|
||||
.Returns(imported);
|
||||
|
||||
Mocker.GetMock<IImportApprovedTracks>()
|
||||
.Setup(s => s.Import(It.IsAny<List<ImportDecision>>(), true, null, ImportMode.Auto))
|
||||
.Returns(imported.Select(i => new ImportResult(i)).ToList());
|
||||
|
||||
//Mocker.GetMock<IDetectSample>()
|
||||
// .Setup(s => s.IsSample(It.IsAny<Artist>(),
|
||||
// It.IsAny<QualityModel>(),
|
||||
// It.IsAny<string>(),
|
||||
// It.IsAny<long>(),
|
||||
// It.IsAny<bool>()))
|
||||
// .Returns(true);
|
||||
|
||||
Subject.ProcessRootFolder(new DirectoryInfo(_droneFactory));
|
||||
|
||||
Mocker.GetMock<IDiskProvider>()
|
||||
.Verify(v => v.DeleteFolder(It.IsAny<string>(), true), Times.Once());
|
||||
}
|
||||
|
||||
[TestCase("_UNPACK_")]
|
||||
[TestCase("_FAILED_")]
|
||||
public void should_remove_unpack_from_folder_name(string prefix)
|
||||
|
|
|
@ -103,7 +103,6 @@ namespace NzbDrone.Core.MediaFiles
|
|||
|
||||
foreach (var audioFile in audioFiles)
|
||||
{
|
||||
//TODO Make this more robust, we should not delete path if it still contains audio files.
|
||||
var albumParseResult = Parser.Parser.ParseMusicTitle(Path.GetFileName(audioFile));
|
||||
|
||||
if (albumParseResult == null)
|
||||
|
@ -111,6 +110,9 @@ namespace NzbDrone.Core.MediaFiles
|
|||
_logger.Warn("Unable to parse file on import: [{0}]", audioFile);
|
||||
return false;
|
||||
}
|
||||
|
||||
_logger.Warn("Audio file detected: [{0}]", audioFile);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (rarFiles.Any(f => _diskProvider.GetFileSize(f) > 10.Megabytes()))
|
||||
|
|
Loading…
Reference in New Issue