2019-12-13 19:11:37 +00:00
|
|
|
#pragma warning disable CS1591
|
|
|
|
#pragma warning disable SA1600
|
|
|
|
|
2019-01-13 19:54:44 +00:00
|
|
|
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))
|
|
|
|
{
|
2019-01-06 20:50:43 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|