Fixed: Sample files of daily episodes should also be deleted after import.

pull/2/head
Taloth Saldono 9 years ago
parent 1c92ea58da
commit 91d91bc673

@ -167,7 +167,7 @@ namespace NzbDrone.Core.Test.MediaFiles
It.IsAny<QualityModel>(),
It.IsAny<string>(),
It.IsAny<long>(),
It.IsAny<int>()))
It.IsAny<bool>()))
.Returns(true);
Subject.ProcessRootFolder(new DirectoryInfo(_droneFactory));
@ -239,7 +239,7 @@ namespace NzbDrone.Core.Test.MediaFiles
It.IsAny<QualityModel>(),
It.IsAny<string>(),
It.IsAny<long>(),
It.IsAny<int>()))
It.IsAny<bool>()))
.Returns(true);
Mocker.GetMock<IDiskProvider>()
@ -350,7 +350,7 @@ namespace NzbDrone.Core.Test.MediaFiles
It.IsAny<QualityModel>(),
It.IsAny<string>(),
It.IsAny<long>(),
It.IsAny<int>()))
It.IsAny<bool>()))
.Returns(true);
Mocker.GetMock<IDiskProvider>()

@ -332,7 +332,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport
GivenVideoFiles(videoFiles.ToList());
Mocker.GetMock<IDetectSample>()
.Setup(s => s.IsSample(_series, It.IsAny<QualityModel>(), It.Is<string>(c => c.Contains("sample")), It.IsAny<long>(), It.IsAny<int>()))
.Setup(s => s.IsSample(_series, It.IsAny<QualityModel>(), It.Is<string>(c => c.Contains("sample")), It.IsAny<long>(), It.IsAny<bool>()))
.Returns(true);
var folderInfo = Parser.Parser.ParseTitle("Series.Title.S01E01");

@ -91,7 +91,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport
_localEpisode.Quality,
_localEpisode.Path,
_localEpisode.Size,
_localEpisode.SeasonNumber);
_localEpisode.IsSpecial);
Mocker.GetMock<IVideoFileInfoReader>().Verify(v => v.GetRunTime(It.IsAny<string>()), Times.Once());
}
@ -144,7 +144,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport
}
[Test]
public void should_return_false_for_anime_speical()
public void should_return_false_for_anime_special()
{
_series.SeriesType = SeriesTypes.Anime;
_localEpisode.Episodes[0].SeasonNumber = 0;
@ -158,7 +158,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport
_localEpisode.Quality,
_localEpisode.Path,
_localEpisode.Size,
_localEpisode.SeasonNumber).Should().BeTrue();
_localEpisode.IsSpecial).Should().BeTrue();
}
private void ShouldBeFalse()
@ -167,7 +167,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport
_localEpisode.Quality,
_localEpisode.Path,
_localEpisode.Size,
_localEpisode.SeasonNumber).Should().BeFalse();
_localEpisode.IsSpecial).Should().BeFalse();
}
}
}

@ -117,8 +117,7 @@ namespace NzbDrone.Core.MediaFiles
var size = _diskProvider.GetFileSize(videoFile);
var quality = QualityParser.ParseQuality(videoFile);
if (!_detectSample.IsSample(series, quality, videoFile, size,
episodeParseResult.SeasonNumber))
if (!_detectSample.IsSample(series, quality, videoFile, size, episodeParseResult.IsPossibleSpecialEpisode))
{
_logger.Warn("Non-sample file detected: [{0}]", videoFile);
return false;

@ -10,7 +10,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport
{
public interface IDetectSample
{
bool IsSample(Series series, QualityModel quality, string path, long size, int seasonNumber);
bool IsSample(Series series, QualityModel quality, string path, long size, bool isSpecial);
}
public class DetectSample : IDetectSample
@ -34,9 +34,9 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport
}
}
public bool IsSample(Series series, QualityModel quality, string path, long size, int seasonNumber)
public bool IsSample(Series series, QualityModel quality, string path, long size, bool isSpecial)
{
if (seasonNumber == 0)
if (isSpecial)
{
_logger.Debug("Special, skipping sample check");
return false;

@ -163,7 +163,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport
{
var size = _diskProvider.GetFileSize(file);
var fileQuality = QualityParser.ParseQuality(file);
var sample = _detectSample.IsSample(series, GetQuality(folderInfo, fileQuality, series), file, size, folderInfo.SeasonNumber);
var sample = _detectSample.IsSample(series, GetQuality(folderInfo, fileQuality, series), file, size, folderInfo.IsPossibleSpecialEpisode);
if (sample)
{

@ -28,7 +28,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications
localEpisode.Quality,
localEpisode.Path,
localEpisode.Size,
localEpisode.SeasonNumber);
localEpisode.IsSpecial);
if (sample)
{

@ -31,6 +31,14 @@ namespace NzbDrone.Core.Parser.Model
}
}
public bool IsSpecial
{
get
{
return SeasonNumber == 0;
}
}
public override string ToString()
{
return Path;

Loading…
Cancel
Save