diff options
| author | Mark Monteiro <marknr.monteiro@protonmail.com> | 2020-04-01 18:53:19 +0200 |
|---|---|---|
| committer | Mark Monteiro <marknr.monteiro@protonmail.com> | 2020-04-01 18:53:19 +0200 |
| commit | 2e1ec2858a5bd2a03d8dd5fd0ae9f9c11487ed7f (patch) | |
| tree | 6018e7f0b9af0d2ba362c71a202442bf4547b309 /Emby.Naming/Video | |
| parent | cc8294842a41478e7c22bcef39c0cfcc114f05a0 (diff) | |
Match using directory names in ExtraResolver
Diffstat (limited to 'Emby.Naming/Video')
| -rw-r--r-- | Emby.Naming/Video/ExtraResolver.cs | 9 | ||||
| -rw-r--r-- | Emby.Naming/Video/ExtraRuleType.cs | 13 |
2 files changed, 18 insertions, 4 deletions
diff --git a/Emby.Naming/Video/ExtraResolver.cs b/Emby.Naming/Video/ExtraResolver.cs index 42a5c88b31..fc0424faab 100644 --- a/Emby.Naming/Video/ExtraResolver.cs +++ b/Emby.Naming/Video/ExtraResolver.cs @@ -80,6 +80,15 @@ namespace Emby.Naming.Video result.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.cs index b021a04a31..0a304874d2 100644 --- a/Emby.Naming/Video/ExtraRuleType.cs +++ b/Emby.Naming/Video/ExtraRuleType.cs @@ -5,18 +5,23 @@ namespace Emby.Naming.Video public 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, } } |
