jellyfin/Emby.Naming/Video/FlagParser.cs

36 lines
874 B
C#
Raw Normal View History

using System;
2018-09-12 17:26:21 +00:00
using System.IO;
2019-01-13 19:17:29 +00:00
using Emby.Naming.Common;
2018-09-12 17:26:21 +00:00
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));
2018-09-12 17:26:21 +00:00
}
// 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);
}
}
}