You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jellyfin/Emby.Naming/Video/FlagParser.cs

36 lines
877 B

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