aboutsummaryrefslogtreecommitdiff
path: root/Emby.Naming/Video/FlagParser.cs
blob: bb129499be9086926fd2a92ef534871e9320dee8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using System;
using System.IO;
using Emby.Naming.Common;

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(nameof(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);
        }
    }
}