Merge pull request #3704 from oddstr13/pr-dotdir-sample-1

Don't ignore dot directories or movies/episodes with sample in their name.
This commit is contained in:
Anthony Lavado 2020-07-26 15:34:15 -07:00 committed by GitHub
commit 6eb3e736c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 4 deletions

View File

@ -18,7 +18,21 @@ namespace Emby.Server.Implementations.Library
{ {
"**/small.jpg", "**/small.jpg",
"**/albumart.jpg", "**/albumart.jpg",
"**/*sample*",
// We have neither non-greedy matching or character group repetitions, working around that here.
// https://github.com/dazinator/DotNet.Glob#patterns
// .*/sample\..{1,5}
"**/sample.?",
"**/sample.??",
"**/sample.???", // Matches sample.mkv
"**/sample.????", // Matches sample.webm
"**/sample.?????",
"**/*.sample.?",
"**/*.sample.??",
"**/*.sample.???",
"**/*.sample.????",
"**/*.sample.?????",
"**/sample/*",
// Directories // Directories
"**/metadata/**", "**/metadata/**",
@ -64,10 +78,13 @@ namespace Emby.Server.Implementations.Library
"**/.grab/**", "**/.grab/**",
"**/.grab", "**/.grab",
// Unix hidden files and directories // Unix hidden files
"**/.*/**",
"**/.*", "**/.*",
// Mac - if you ever remove the above.
// "**/._*",
// "**/.DS_Store",
// thumbs.db // thumbs.db
"**/thumbs.db", "**/thumbs.db",

View File

@ -9,17 +9,29 @@ namespace Jellyfin.Server.Implementations.Tests.Library
[InlineData("/media/small.jpg", true)] [InlineData("/media/small.jpg", true)]
[InlineData("/media/albumart.jpg", true)] [InlineData("/media/albumart.jpg", true)]
[InlineData("/media/movie.sample.mp4", true)] [InlineData("/media/movie.sample.mp4", true)]
[InlineData("/media/movie/sample.mp4", true)]
[InlineData("/media/movie/sample/movie.mp4", true)]
[InlineData("/foo/sample/bar/baz.mkv", false)]
[InlineData("/media/movies/the sample/the sample.mkv", false)]
[InlineData("/media/movies/sampler.mkv", false)]
[InlineData("/media/movies/#Recycle/test.txt", true)] [InlineData("/media/movies/#Recycle/test.txt", true)]
[InlineData("/media/movies/#recycle/", true)] [InlineData("/media/movies/#recycle/", true)]
[InlineData("/media/movies/#recycle", true)] [InlineData("/media/movies/#recycle", true)]
[InlineData("thumbs.db", true)] [InlineData("thumbs.db", true)]
[InlineData(@"C:\media\movies\movie.avi", false)] [InlineData(@"C:\media\movies\movie.avi", false)]
[InlineData("/media/.hiddendir/file.mp4", true)] [InlineData("/media/.hiddendir/file.mp4", false)]
[InlineData("/media/dir/.hiddenfile.mp4", true)] [InlineData("/media/dir/.hiddenfile.mp4", true)]
[InlineData("/media/dir/._macjunk.mp4", true)]
[InlineData("/volume1/video/Series/@eaDir", true)] [InlineData("/volume1/video/Series/@eaDir", true)]
[InlineData("/volume1/video/Series/@eaDir/file.txt", true)] [InlineData("/volume1/video/Series/@eaDir/file.txt", true)]
[InlineData("/directory/@Recycle", true)] [InlineData("/directory/@Recycle", true)]
[InlineData("/directory/@Recycle/file.mp3", true)] [InlineData("/directory/@Recycle/file.mp3", true)]
[InlineData("/media/movies/.@__thumb", true)]
[InlineData("/media/movies/.@__thumb/foo-bar-thumbnail.png", true)]
[InlineData("/media/music/Foo B.A.R./epic.flac", false)]
[InlineData("/media/music/Foo B.A.R", false)]
// This test is pending an upstream fix: https://github.com/dazinator/DotNet.Glob/issues/78
// [InlineData("/media/music/Foo B.A.R.", false)]
public void PathIgnored(string path, bool expected) public void PathIgnored(string path, bool expected)
{ {
Assert.Equal(expected, IgnorePatterns.ShouldIgnore(path)); Assert.Equal(expected, IgnorePatterns.ShouldIgnore(path));