From 0ffddacf11795b8a50606b6515c1dc6828ad8dd0 Mon Sep 17 00:00:00 2001 From: gnattu Date: Tue, 24 Sep 2024 12:36:05 +0800 Subject: Move GetCustomTagDelimiters to Extension --- .../Extensions/LibraryOptionsExtension.cs | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 MediaBrowser.Model/Extensions/LibraryOptionsExtension.cs (limited to 'MediaBrowser.Model/Extensions') diff --git a/MediaBrowser.Model/Extensions/LibraryOptionsExtension.cs b/MediaBrowser.Model/Extensions/LibraryOptionsExtension.cs new file mode 100644 index 000000000..4a814f22a --- /dev/null +++ b/MediaBrowser.Model/Extensions/LibraryOptionsExtension.cs @@ -0,0 +1,32 @@ +using System; +using System.Linq; +using MediaBrowser.Model.Configuration; + +namespace MediaBrowser.Model.Extensions; + +/// +/// Extensions for . +/// +public static class LibraryOptionsExtension +{ + /// + /// Get the custom tag delimiters. + /// + /// This LibraryOptions. + /// CustomTagDelimiters in char[]. + public static char[] GetCustomTagDelimiters(this LibraryOptions options) + { + ArgumentNullException.ThrowIfNull(options); + + return options.CustomTagDelimiters.Select(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).ToArray(); + } +} -- cgit v1.2.3 From ee66c745274ae0b24022ec077e39d6bb9d6d6469 Mon Sep 17 00:00:00 2001 From: gnattu Date: Tue, 19 Nov 2024 15:43:22 -0500 Subject: Backport pull request #12962 from jellyfin/release-10.10.z Always consider null char as delimiter for ID3v2 Original-merge: 97dc02b1632c3c329a181c816ff2c6dc84319732 Merged-by: crobibero Backported-by: Joshua M. Boniface --- MediaBrowser.Model/Extensions/LibraryOptionsExtension.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'MediaBrowser.Model/Extensions') diff --git a/MediaBrowser.Model/Extensions/LibraryOptionsExtension.cs b/MediaBrowser.Model/Extensions/LibraryOptionsExtension.cs index 4a814f22a..b088cfb53 100644 --- a/MediaBrowser.Model/Extensions/LibraryOptionsExtension.cs +++ b/MediaBrowser.Model/Extensions/LibraryOptionsExtension.cs @@ -18,7 +18,7 @@ public static class LibraryOptionsExtension { ArgumentNullException.ThrowIfNull(options); - return options.CustomTagDelimiters.Select(x => + var delimiterList = options.CustomTagDelimiters.Select(x => { var isChar = char.TryParse(x, out var c); if (isChar) @@ -27,6 +27,8 @@ public static class LibraryOptionsExtension } return null; - }).Where(x => x is not null).Select(x => x!.Value).ToArray(); + }).Where(x => x is not null).Select(x => x!.Value).ToList(); + delimiterList.Add('\0'); + return delimiterList.ToArray(); } } -- cgit v1.2.3 From fdb489ae477bfac2ad738227e9d5ea657f4fc395 Mon Sep 17 00:00:00 2001 From: reuterma24 Date: Sun, 12 Jan 2025 18:54:19 +0100 Subject: improve parameter documentation for ContainsContainer method in ContainerHelper class --- MediaBrowser.Model/Extensions/ContainerHelper.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'MediaBrowser.Model/Extensions') diff --git a/MediaBrowser.Model/Extensions/ContainerHelper.cs b/MediaBrowser.Model/Extensions/ContainerHelper.cs index c86328ba6..39e5358ba 100644 --- a/MediaBrowser.Model/Extensions/ContainerHelper.cs +++ b/MediaBrowser.Model/Extensions/ContainerHelper.cs @@ -14,7 +14,8 @@ public static class ContainerHelper /// in . /// /// The comma-delimited string being searched. - /// If the parameter begins with the - character, the operation is reversed. + /// If the parameter begins with the - character, the operation is reversed. + /// If the parameter is empty or null, all containers in will be accepted. /// The comma-delimited string being matched. /// The result of the operation. public static bool ContainsContainer(string? profileContainers, string? inputContainer) @@ -34,7 +35,8 @@ public static class ContainerHelper /// in . /// /// The comma-delimited string being searched. - /// If the parameter begins with the - character, the operation is reversed. + /// If the parameter begins with the - character, the operation is reversed. + /// If the parameter is empty or null, all containers in will be accepted. /// The comma-delimited string being matched. /// The result of the operation. public static bool ContainsContainer(string? profileContainers, ReadOnlySpan inputContainer) @@ -53,7 +55,8 @@ public static class ContainerHelper /// Compares two containers, returning if an item in /// does not exist in . /// - /// The comma-delimited string being searched. + /// The comma-delimited string being searched. + /// If the parameter is empty or null, all containers in will be accepted. /// The boolean result to return if a match is not found. /// The comma-delimited string being matched. /// The result of the operation. @@ -71,7 +74,8 @@ public static class ContainerHelper /// Compares two containers, returning if an item in /// does not exist in . /// - /// The comma-delimited string being searched. + /// The comma-delimited string being searched. + /// If the parameter is empty or null, all containers in will be accepted. /// The boolean result to return if a match is not found. /// The comma-delimited string being matched. /// The result of the operation. @@ -106,7 +110,8 @@ public static class ContainerHelper /// Compares two containers, returning if an item in /// does not exist in . /// - /// The profile containers being matched searched. + /// The profile containers being matched searched. + /// If the parameter is empty or null, all containers in will be accepted. /// The boolean result to return if a match is not found. /// The comma-delimited string being matched. /// The result of the operation. -- cgit v1.2.3