diff options
| author | MrTimscampi <julien.machiels@protonmail.com> | 2021-07-27 17:09:23 +0200 |
|---|---|---|
| committer | MrTimscampi <julien.machiels@protonmail.com> | 2021-08-16 00:22:36 +0200 |
| commit | f35a527608fb3f6efde3f76042e0e701768eb3f2 (patch) | |
| tree | b6fd0a8f83e8165e708245a2892e7d3d26e39e54 /MediaBrowser.MediaEncoding/Probing | |
| parent | 24083d2e38c17e005c536339d555355b9155485f (diff) | |
Add performers to the ffprobe normalization for audio
Diffstat (limited to 'MediaBrowser.MediaEncoding/Probing')
| -rw-r--r-- | MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs index 875ee6f04..20dead077 100644 --- a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs +++ b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs @@ -7,6 +7,7 @@ using System.Globalization; using System.IO; using System.Linq; using System.Text; +using System.Text.RegularExpressions; using System.Xml; using Jellyfin.Extensions; using MediaBrowser.Controller.Library; @@ -1111,6 +1112,26 @@ namespace MediaBrowser.MediaEncoding.Probing } } + if (tags.TryGetValue("performer", out var performer) && !string.IsNullOrWhiteSpace(performer)) + { + foreach (var person in Split(performer, false)) + { + Regex pattern = new Regex(@"(?<name>.*) \((?<instrument>.*)\)"); + Match match = pattern.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) + { + people.Add(new BaseItemPerson + { + Name = match.Groups["name"].Value, + Type = PersonType.Actor, + Role = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(match.Groups["instrument"].Value) + }); + } + } + } + // Check for writer some music is tagged that way as alternative to composer/lyricist if (tags.TryGetValue("writer", out var writer) && !string.IsNullOrWhiteSpace(writer)) { |
