mirror of https://github.com/lidarr/Lidarr
Fixed: Import files for the series Extras
This commit is contained in:
parent
4f0ca20808
commit
90ce35abee
|
@ -62,7 +62,7 @@ namespace NzbDrone.Core.Test.MediaFiles.DiskScanServiceTests
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_not_scan_extras_folder()
|
public void should_not_scan_extras_subfolder()
|
||||||
{
|
{
|
||||||
GivenParentFolderExists();
|
GivenParentFolderExists();
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ namespace NzbDrone.Core.Test.MediaFiles.DiskScanServiceTests
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_not_scan_AppleDouble_folder()
|
public void should_not_scan_AppleDouble_subfolder()
|
||||||
{
|
{
|
||||||
GivenParentFolderExists();
|
GivenParentFolderExists();
|
||||||
|
|
||||||
|
@ -98,5 +98,27 @@ namespace NzbDrone.Core.Test.MediaFiles.DiskScanServiceTests
|
||||||
Mocker.GetMock<IMakeImportDecision>()
|
Mocker.GetMock<IMakeImportDecision>()
|
||||||
.Verify(v => v.GetImportDecisions(It.Is<List<String>>(l => l.Count == 1), _series, false, (QualityModel)null), Times.Once());
|
.Verify(v => v.GetImportDecisions(It.Is<List<String>>(l => l.Count == 1), _series, false, (QualityModel)null), Times.Once());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_scan_extras_series_and_subfolders()
|
||||||
|
{
|
||||||
|
GivenParentFolderExists();
|
||||||
|
_series.Path = @"C:\Test\TV\Extras".AsOsAgnostic();
|
||||||
|
|
||||||
|
GivenFiles(new List<String>
|
||||||
|
{
|
||||||
|
Path.Combine(_series.Path, "Extras", "file1.mkv").AsOsAgnostic(),
|
||||||
|
Path.Combine(_series.Path, ".AppleDouble", "file2.mkv").AsOsAgnostic(),
|
||||||
|
Path.Combine(_series.Path, "Season 1", "s01e01.mkv").AsOsAgnostic(),
|
||||||
|
Path.Combine(_series.Path, "Season 1", "s01e02.mkv").AsOsAgnostic(),
|
||||||
|
Path.Combine(_series.Path, "Season 2", "s02e01.mkv").AsOsAgnostic(),
|
||||||
|
Path.Combine(_series.Path, "Season 2", "s02e02.mkv").AsOsAgnostic(),
|
||||||
|
});
|
||||||
|
|
||||||
|
Subject.Scan(_series);
|
||||||
|
|
||||||
|
Mocker.GetMock<IMakeImportDecision>()
|
||||||
|
.Verify(v => v.GetImportDecisions(It.Is<List<String>>(l => l.Count == 4), _series, false, (QualityModel)null), Times.Once());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ using System.Linq;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.Disk;
|
using NzbDrone.Common.Disk;
|
||||||
|
using NzbDrone.Common.Extensions;
|
||||||
using NzbDrone.Common.Instrumentation.Extensions;
|
using NzbDrone.Common.Instrumentation.Extensions;
|
||||||
using NzbDrone.Core.Configuration;
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.MediaFiles.Commands;
|
using NzbDrone.Core.MediaFiles.Commands;
|
||||||
|
@ -56,7 +57,7 @@ namespace NzbDrone.Core.MediaFiles
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static readonly Regex ExcludedSubFoldersRegex = new Regex(@"(?:\\|\/)(extras|\.appledouble)(?:\\|\/)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
private static readonly Regex ExcludedSubFoldersRegex = new Regex(@"(extras|\.appledouble)(?:\\|\/)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||||
|
|
||||||
public void Scan(Series series)
|
public void Scan(Series series)
|
||||||
{
|
{
|
||||||
|
@ -89,7 +90,7 @@ namespace NzbDrone.Core.MediaFiles
|
||||||
}
|
}
|
||||||
|
|
||||||
var videoFilesStopwatch = Stopwatch.StartNew();
|
var videoFilesStopwatch = Stopwatch.StartNew();
|
||||||
var mediaFileList = GetVideoFiles(series.Path).Where(file => !ExcludedSubFoldersRegex.IsMatch(file)).ToList();
|
var mediaFileList = GetVideoFiles(series.Path).Where(file => !ExcludedSubFoldersRegex.IsMatch(series.Path.GetRelativePath(file))).ToList();
|
||||||
videoFilesStopwatch.Stop();
|
videoFilesStopwatch.Stop();
|
||||||
_logger.Trace("Finished getting episode files for: {0} [{1}]", series, videoFilesStopwatch.Elapsed);
|
_logger.Trace("Finished getting episode files for: {0} [{1}]", series, videoFilesStopwatch.Elapsed);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue