mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-16 22:13:06 +03:00
Use generated regex
This commit is contained in:
@@ -22,7 +22,7 @@ namespace MediaBrowser.MediaEncoding.Probing
|
||||
/// <summary>
|
||||
/// Class responsible for normalizing FFprobe output.
|
||||
/// </summary>
|
||||
public class ProbeResultNormalizer
|
||||
public partial class ProbeResultNormalizer
|
||||
{
|
||||
// When extracting subtitles, the maximum length to consider (to avoid invalid filenames)
|
||||
private const int MaxSubtitleDescriptionExtractionLength = 100;
|
||||
@@ -31,8 +31,6 @@ namespace MediaBrowser.MediaEncoding.Probing
|
||||
|
||||
private readonly char[] _nameDelimiters = { '/', '|', ';', '\\' };
|
||||
|
||||
private static readonly Regex _performerPattern = new(@"(?<name>.*) \((?<instrument>.*)\)");
|
||||
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILocalizationManager _localization;
|
||||
|
||||
@@ -1215,7 +1213,7 @@ namespace MediaBrowser.MediaEncoding.Probing
|
||||
{
|
||||
foreach (var person in Split(performer, false))
|
||||
{
|
||||
Match match = _performerPattern.Match(person);
|
||||
Match match = PerformerRegex().Match(person);
|
||||
|
||||
// If the performer doesn't have any instrument/role associated, it won't match. In that case, chances are it's simply a band name, so we skip it.
|
||||
if (match.Success)
|
||||
@@ -1654,5 +1652,8 @@ namespace MediaBrowser.MediaEncoding.Probing
|
||||
|
||||
return TransportStreamTimestamp.Valid;
|
||||
}
|
||||
|
||||
[GeneratedRegex("(?<name>.*) \\((?<instrument>.*)\\)")]
|
||||
private static partial Regex PerformerRegex();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user