diff options
| author | Marc Brooks <IDisposable@gmail.com> | 2025-02-03 19:48:59 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-03 19:48:59 -0600 |
| commit | e8cbcde02ebd930a5eeb6c95e0875a9e30acb3e8 (patch) | |
| tree | 2ecd43f232012c8f037f4cd6fee4168e46d01aa3 /MediaBrowser.Model/Extensions/LibraryOptionsExtension.cs | |
| parent | 6dc61a430ba3a8480399309f277e5debfd6403ba (diff) | |
| parent | d376b5fbc7cf3ae7440a606a9e885d70605956bd (diff) | |
Merge branch 'master' into sort-nfo-data
Diffstat (limited to 'MediaBrowser.Model/Extensions/LibraryOptionsExtension.cs')
| -rw-r--r-- | MediaBrowser.Model/Extensions/LibraryOptionsExtension.cs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/MediaBrowser.Model/Extensions/LibraryOptionsExtension.cs b/MediaBrowser.Model/Extensions/LibraryOptionsExtension.cs new file mode 100644 index 000000000..b088cfb53 --- /dev/null +++ b/MediaBrowser.Model/Extensions/LibraryOptionsExtension.cs @@ -0,0 +1,34 @@ +using System; +using System.Linq; +using MediaBrowser.Model.Configuration; + +namespace MediaBrowser.Model.Extensions; + +/// <summary> +/// Extensions for <see cref="LibraryOptions"/>. +/// </summary> +public static class LibraryOptionsExtension +{ + /// <summary> + /// Get the custom tag delimiters. + /// </summary> + /// <param name="options">This LibraryOptions.</param> + /// <returns>CustomTagDelimiters in char[].</returns> + public static char[] GetCustomTagDelimiters(this LibraryOptions options) + { + ArgumentNullException.ThrowIfNull(options); + + var delimiterList = options.CustomTagDelimiters.Select<string, char?>(x => + { + var isChar = char.TryParse(x, out var c); + if (isChar) + { + return c; + } + + return null; + }).Where(x => x is not null).Select(x => x!.Value).ToList(); + delimiterList.Add('\0'); + return delimiterList.ToArray(); + } +} |
