The Free Software Media System - Server Backend & API
Match using directory names in ExtraResolver
Mark Monteiro2e1ec2858a5b
diff --git a/Emby.Naming/Common/NamingOptions.cs b/Emby.Naming/Common/NamingOptions.csindex 793847f84c..8ac33d3f55 100644--- a/Emby.Naming/Common/NamingOptions.cs+++ b/Emby.Naming/Common/NamingOptions.cs@@ -505,7 +505,15 @@ namespace Emby.Naming.CommonRuleType = ExtraRuleType.Suffix,Token = "-short",MediaType = MediaType.Video- }+ },+ new ExtraRule { RuleType = ExtraRuleType.DirectoryName, MediaType = MediaType.Video, ExtraType = ExtraType.BehindTheScenes, Token = "behind the scenes" },+ new ExtraRule { RuleType = ExtraRuleType.DirectoryName, MediaType = MediaType.Video, ExtraType = ExtraType.DeletedScene, Token = "deleted scenes" },+ new ExtraRule { RuleType = ExtraRuleType.DirectoryName, MediaType = MediaType.Video, ExtraType = ExtraType.Interview, Token = "interviews" },+ new ExtraRule { RuleType = ExtraRuleType.DirectoryName, MediaType = MediaType.Video, ExtraType = ExtraType.Scene, Token = "scenes" },+ new ExtraRule { RuleType = ExtraRuleType.DirectoryName, MediaType = MediaType.Video, ExtraType = ExtraType.Sample, Token = "samples" },+ new ExtraRule { RuleType = ExtraRuleType.DirectoryName, MediaType = MediaType.Video, ExtraType = ExtraType.Clip, Token = "shorts" },+ new ExtraRule { RuleType = ExtraRuleType.DirectoryName, MediaType = MediaType.Video, ExtraType = ExtraType.Clip, Token = "featurettes" },+ new ExtraRule { RuleType = ExtraRuleType.DirectoryName, MediaType = MediaType.Video, ExtraType = ExtraType.Unknown, Token = "extras" },};Format3DRules = new[]diff --git a/Emby.Naming/Video/ExtraResolver.cs b/Emby.Naming/Video/ExtraResolver.csindex 42a5c88b31..fc0424faab 100644--- a/Emby.Naming/Video/ExtraResolver.cs+++ b/Emby.Naming/Video/ExtraResolver.cs@@ -80,6 +80,15 @@ namespace Emby.Naming.Videoresult.Rule = rule;}}+ else if (rule.RuleType == ExtraRuleType.DirectoryName)+ {+ var directoryName = Path.GetFileName(Path.GetDirectoryName(path));+ if (string.Equals(directoryName, rule.Token, StringComparison.OrdinalIgnoreCase))+ {+ result.ExtraType = rule.ExtraType;+ result.Rule = rule;+ }+ }return result;}diff --git a/Emby.Naming/Video/ExtraRuleType.cs b/Emby.Naming/Video/ExtraRuleType.csindex b021a04a31..0a304874d2 100644--- a/Emby.Naming/Video/ExtraRuleType.cs+++ b/Emby.Naming/Video/ExtraRuleType.cs@@ -5,18 +5,23 @@ namespace Emby.Naming.Videopublic enum ExtraRuleType{/// <summary>- /// The suffix+ /// Match <see cref="ExtraRule.Token"/> against a suffix in the file name./// </summary>Suffix = 0,/// <summary>- /// The filename+ /// Match <see cref="ExtraRule.Token"/> against the file name./// </summary>Filename = 1,/// <summary>- /// The regex+ /// Match <see cref="ExtraRule.Token"/> against the a regex./// </summary>- Regex = 2+ Regex = 2,++ /// <summary>+ /// Match <see cref="ExtraRule.Token"/> against the directory name of the file.+ /// </summary>+ DirectoryName = 3,}}