Merge pull request #1247 from bugfixin/master
Adjust detection of 'sample' in filenames to use regex boundaries
This commit is contained in:
commit
9e9952d81f
|
@ -1,6 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.Resolvers;
|
using MediaBrowser.Controller.Resolvers;
|
||||||
|
@ -148,15 +149,9 @@ namespace Emby.Server.Implementations.Library
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ignore samples
|
// Ignore samples
|
||||||
var sampleFilename = " " + filename.Replace(".", " ", StringComparison.OrdinalIgnoreCase)
|
Match m = Regex.Match(filename,@"\bsample\b",RegexOptions.IgnoreCase);
|
||||||
.Replace("-", " ", StringComparison.OrdinalIgnoreCase)
|
|
||||||
.Replace("_", " ", StringComparison.OrdinalIgnoreCase)
|
|
||||||
.Replace("!", " ", StringComparison.OrdinalIgnoreCase);
|
|
||||||
|
|
||||||
if (sampleFilename.IndexOf(" sample ", StringComparison.OrdinalIgnoreCase) != -1)
|
return m.Success;
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -2,6 +2,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using Emby.Naming.Video;
|
using Emby.Naming.Video;
|
||||||
using MediaBrowser.Controller.Drawing;
|
using MediaBrowser.Controller.Drawing;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
|
@ -167,17 +168,9 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
|
||||||
private static bool IsIgnored(string filename)
|
private static bool IsIgnored(string filename)
|
||||||
{
|
{
|
||||||
// Ignore samples
|
// Ignore samples
|
||||||
var sampleFilename = " " + filename.Replace(".", " ", StringComparison.OrdinalIgnoreCase)
|
Match m = Regex.Match(filename,@"\bsample\b",RegexOptions.IgnoreCase);
|
||||||
.Replace("-", " ", StringComparison.OrdinalIgnoreCase)
|
|
||||||
.Replace("_", " ", StringComparison.OrdinalIgnoreCase)
|
|
||||||
.Replace("!", " ", StringComparison.OrdinalIgnoreCase);
|
|
||||||
|
|
||||||
if (sampleFilename.IndexOf(" sample ", StringComparison.OrdinalIgnoreCase) != -1)
|
return m.Success;
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ContainsFile(List<VideoInfo> result, FileSystemMetadata file)
|
private bool ContainsFile(List<VideoInfo> result, FileSystemMetadata file)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user