mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-10-30 07:22:35 +01:00
Import episodes will import largest files first (to reject samples)
This commit is contained in:
parent
03149b1396
commit
741279b596
@ -48,7 +48,6 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||
Episodes = new List<Episode> {episode},
|
||||
Path = @"C:\Test\TV\30 Rock\30 Rock - S01E01 - Pilit.avi".AsOsAgnostic(),
|
||||
Quality = new QualityModel(Quality.Bluray720p)
|
||||
|
||||
}));
|
||||
}
|
||||
|
||||
@ -125,5 +124,32 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||
Mocker.GetMock<IEventAggregator>()
|
||||
.Verify(v => v.PublishEvent(It.IsAny<EpisodeImportedEvent>()), Times.Never());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_import_larger_files_first()
|
||||
{
|
||||
var fileDecision = _approvedDecisions.First();
|
||||
fileDecision.LocalEpisode.Size = 1.Gigabytes();
|
||||
|
||||
var sampleDecision = new ImportDecision
|
||||
(new LocalEpisode
|
||||
{
|
||||
Series = fileDecision.LocalEpisode.Series,
|
||||
Episodes = new List<Episode> {fileDecision.LocalEpisode.Episodes.First()},
|
||||
Path = @"C:\Test\TV\30 Rock\30 Rock - S01E01 - Pilit.avi".AsOsAgnostic(),
|
||||
Quality = new QualityModel(Quality.Bluray720p),
|
||||
Size = 80.Megabytes()
|
||||
});
|
||||
|
||||
|
||||
var all = new List<ImportDecision>();
|
||||
all.Add(fileDecision);
|
||||
all.Add(sampleDecision);
|
||||
|
||||
var results = Subject.Import(all);
|
||||
|
||||
results.Should().HaveCount(1);
|
||||
results.Should().ContainSingle(d => d.LocalEpisode.Size == fileDecision.LocalEpisode.Size);
|
||||
}
|
||||
}
|
||||
}
|
@ -94,6 +94,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport
|
||||
{
|
||||
return decisions.Where(c => c.Approved)
|
||||
.OrderByDescending(c => c.LocalEpisode.Quality)
|
||||
.ThenByDescending(c => c.LocalEpisode.Size)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user