mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-11-24 11:43:07 +01:00
parent
4be626a44c
commit
6131a99497
@ -422,6 +422,24 @@ namespace NzbDrone.Core.Test.MediaFiles.DiskScanServiceTests
|
||||
.Verify(v => v.GetImportDecisions(It.Is<List<string>>(l => l.Count == 2), _series, false), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_exclude_inline_extra_files()
|
||||
{
|
||||
GivenSeriesFolder();
|
||||
|
||||
GivenFiles(new List<string>
|
||||
{
|
||||
Path.Combine(_series.Path, "Series Title S01E01.mkv").AsOsAgnostic(),
|
||||
Path.Combine(_series.Path, "Deleted Scenes-deleted.mkv").AsOsAgnostic(),
|
||||
Path.Combine(_series.Path, "The World of Pandora-other.mkv").AsOsAgnostic()
|
||||
});
|
||||
|
||||
Subject.Scan(_series);
|
||||
|
||||
Mocker.GetMock<IMakeImportDecision>()
|
||||
.Verify(v => v.GetImportDecisions(It.Is<List<string>>(l => l.Count == 1), _series), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_exclude_osx_metadata_files()
|
||||
{
|
||||
|
@ -71,6 +71,7 @@ namespace NzbDrone.Core.MediaFiles
|
||||
|
||||
private static readonly Regex ExcludedExtrasSubFolderRegex = new Regex(@"(?:\\|\/|^)(?:extras|extrafanart|behind the scenes|deleted scenes|featurettes|interviews|scenes|samples|shorts|trailers)(?:\\|\/)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
private static readonly Regex ExcludedSubFoldersRegex = new Regex(@"(?:\\|\/|^)(?:@eadir|\.@__thumb|plex versions|\.[^\\/]+)(?:\\|\/)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
private static readonly Regex ExcludedExtraFilesRegex = new Regex(@"(-(trailer|other|behindthescenes|deleted|featurette|interview|scene|short)\.[^.]+$)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
private static readonly Regex ExcludedFilesRegex = new Regex(@"^\._|^Thumbs\.db$", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
|
||||
public void Scan(Series series)
|
||||
@ -226,7 +227,9 @@ namespace NzbDrone.Core.MediaFiles
|
||||
|
||||
if (filterExtras)
|
||||
{
|
||||
filteredPaths = filteredPaths.Where(path => !ExcludedExtrasSubFolderRegex.IsMatch(basePath.GetRelativePath(path))).ToList();
|
||||
filteredPaths = filteredPaths.Where(path => !ExcludedExtrasSubFolderRegex.IsMatch(basePath.GetRelativePath(path)))
|
||||
.Where(path => !ExcludedExtraFilesRegex.IsMatch(Path.GetFileName(path)))
|
||||
.ToList();
|
||||
}
|
||||
|
||||
return filteredPaths;
|
||||
|
Loading…
Reference in New Issue
Block a user