mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-11 12:02:35 +02:00
parent
c84a9d6612
commit
b6c75e7e1b
@ -382,6 +382,24 @@ public void should_find_files_at_root_of_movie_folder()
|
||||
.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 @@ public DiskScanService(IDiskProvider diskProvider,
|
||||
|
||||
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 @@ public List<string> FilterFiles(string basePath, IEnumerable<string> files, bool
|
||||
|
||||
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…
Reference in New Issue
Block a user