2019-12-13 12:11:37 -07:00
|
|
|
#pragma warning disable CS1591
|
|
|
|
|
2019-01-13 12:54:44 -07:00
|
|
|
using System;
|
2018-09-12 10:26:21 -07:00
|
|
|
using System.IO;
|
2019-01-13 12:17:29 -07:00
|
|
|
using Emby.Naming.Common;
|
2018-09-12 10:26:21 -07: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 13:50:43 -07:00
|
|
|
throw new ArgumentNullException(nameof(path));
|
2018-09-12 10:26:21 -07: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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|