Add performers to the ffprobe normalization for audio

This commit is contained in:
MrTimscampi
2021-07-27 17:09:23 +02:00
parent 24083d2e38
commit f35a527608
2 changed files with 25 additions and 1 deletions

View File

@@ -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))
{