Fixed: Skip Flat Extra Files (Plex Naming) on Import

Fixes #4630
pull/2/head
Qstick 4 years ago
parent c84a9d6612
commit b6c75e7e1b

@ -382,6 +382,24 @@ namespace NzbDrone.Core.Test.MediaFiles.DiskScanServiceTests
.Verify(v => v.GetImportDecisions(It.Is<List<string>>(l => l.Count == 2), _movie), Times.Once());
}
[Test]
public void should_exclude_inline_extra_files()
{
GivenMovieFolder();
GivenFiles(new List<string>
{
Path.Combine(_movie.Path, "Avatar (2009).mkv").AsOsAgnostic(),
Path.Combine(_movie.Path, "Deleted Scenes-deleted.mkv").AsOsAgnostic(),
Path.Combine(_movie.Path, "The World of Pandora-other.mkv").AsOsAgnostic()
});
Subject.Scan(_movie);
Mocker.GetMock<IMakeImportDecision>()
.Verify(v => v.GetImportDecisions(It.Is<List<string>>(l => l.Count == 1), _movie), Times.Once());
}
[Test]
public void should_exclude_osx_metadata_files()
{

@ -64,6 +64,7 @@ namespace NzbDrone.Core.MediaFiles
private static readonly Regex ExcludedExtrasSubFolderRegex = new Regex(@"(?:\\|\/|^)(?:extras|extrafanart|behind the scenes|deleted scenes|featurettes|interviews|scenes|sample[s]?|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(Movie movie)
@ -179,7 +180,9 @@ namespace NzbDrone.Core.MediaFiles
if (filterExtras)
{
filteredFiles = filteredFiles.Where(file => !ExcludedExtrasSubFolderRegex.IsMatch(basePath.GetRelativePath(file))).ToList();
filteredFiles = filteredFiles.Where(file => !ExcludedExtrasSubFolderRegex.IsMatch(basePath.GetRelativePath(file)))
.Where(file => !ExcludedExtraFilesRegex.IsMatch(Path.GetFileName(file)))
.ToList();
}
return filteredFiles;

Loading…
Cancel
Save