diff options
Diffstat (limited to 'Emby.Naming/Audio/AlbumParser.cs')
| -rw-r--r-- | Emby.Naming/Audio/AlbumParser.cs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/Emby.Naming/Audio/AlbumParser.cs b/Emby.Naming/Audio/AlbumParser.cs index 86a564153..73424a134 100644 --- a/Emby.Naming/Audio/AlbumParser.cs +++ b/Emby.Naming/Audio/AlbumParser.cs @@ -10,7 +10,7 @@ namespace Emby.Naming.Audio /// <summary> /// Helper class to determine if Album is multipart. /// </summary> - public class AlbumParser + public partial class AlbumParser { private readonly NamingOptions _options; @@ -23,6 +23,9 @@ namespace Emby.Naming.Audio _options = options; } + [GeneratedRegex(@"([-\.\(\)]|\s+)")] + private static partial Regex CleanRegex(); + /// <summary> /// Function that determines if album is multipart. /// </summary> @@ -42,13 +45,9 @@ namespace Emby.Naming.Audio // Normalize // Remove whitespace - filename = filename.Replace('-', ' '); - filename = filename.Replace('.', ' '); - filename = filename.Replace('(', ' '); - filename = filename.Replace(')', ' '); - filename = Regex.Replace(filename, @"\s+", " "); + filename = CleanRegex().Replace(filename, " "); - ReadOnlySpan<char> trimmedFilename = filename.TrimStart(); + ReadOnlySpan<char> trimmedFilename = filename.AsSpan().TrimStart(); foreach (var prefix in _options.AlbumStackingPrefixes) { |
