diff options
Diffstat (limited to 'Emby.Naming/Video/FlagParser.cs')
| -rw-r--r-- | Emby.Naming/Video/FlagParser.cs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/Emby.Naming/Video/FlagParser.cs b/Emby.Naming/Video/FlagParser.cs new file mode 100644 index 0000000000..a2c541eeb2 --- /dev/null +++ b/Emby.Naming/Video/FlagParser.cs @@ -0,0 +1,35 @@ +using Emby.Naming.Common; +using System; +using System.IO; + +namespace Emby.Naming.Video +{ + public class FlagParser + { + private readonly NamingOptions _options; + + public FlagParser(NamingOptions options) + { + _options = options; + } + + public string[] GetFlags(string path) + { + return GetFlags(path, _options.VideoFlagDelimiters); + } + + public string[] GetFlags(string path, char[] delimeters) + { + if (string.IsNullOrEmpty(path)) + { + throw new ArgumentNullException("path"); + } + + // Note: the tags need be be surrounded be either a space ( ), hyphen -, dot . or underscore _. + + var file = Path.GetFileName(path); + + return file.Split(delimeters, StringSplitOptions.RemoveEmptyEntries); + } + } +} |
