mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-05 21:37:10 -04:00
update the gueststars regex to use commas as delimitators
This commit is contained in:
parent
4c3ceee7a1
commit
3f4dd4231d
@ -317,9 +317,12 @@ namespace MediaBrowser.Providers.TV
|
|||||||
if (actors != null)
|
if (actors != null)
|
||||||
{
|
{
|
||||||
// Sometimes tvdb actors have leading spaces
|
// Sometimes tvdb actors have leading spaces
|
||||||
var persons = Regex.Matches(actors, @"([^|()]|\([^)]*\)*)+")
|
//Regex Info:
|
||||||
|
//The first block are the posible delimitators (open-parentheses should be there cause if dont the next block will fail)
|
||||||
|
//The second block Allow the delimitators to be part of the text if they're inside parentheses
|
||||||
|
var persons = Regex.Matches(actors, @"(?<delimitators>([^|,(])|(?<ignoreinParentheses>\([^)]*\)*))+")
|
||||||
.Cast<Match>()
|
.Cast<Match>()
|
||||||
.SelectMany(m => string.IsNullOrWhiteSpace(m.Value) ? new string[] { } : m.Value.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
|
.Select(m => m.Value)
|
||||||
.Where(i => !string.IsNullOrWhiteSpace(i) && !string.IsNullOrEmpty(i));
|
.Where(i => !string.IsNullOrWhiteSpace(i) && !string.IsNullOrEmpty(i));
|
||||||
|
|
||||||
foreach (var person in persons.Select(str =>
|
foreach (var person in persons.Select(str =>
|
||||||
@ -340,9 +343,9 @@ namespace MediaBrowser.Providers.TV
|
|||||||
var extraActors = xmlDocument.SafeGetString("//GuestStars");
|
var extraActors = xmlDocument.SafeGetString("//GuestStars");
|
||||||
if (extraActors == null) continue;
|
if (extraActors == null) continue;
|
||||||
// Sometimes tvdb actors have leading spaces
|
// Sometimes tvdb actors have leading spaces
|
||||||
var persons = Regex.Matches(extraActors, @"([^|()]|\([^)]*\)*)+")
|
var persons = Regex.Matches(extraActors, @"(?<delimitators>([^|,(])|(?<ignoreinParentheses>\([^)]*\)*))+")
|
||||||
.Cast<Match>()
|
.Cast<Match>()
|
||||||
.SelectMany(m => string.IsNullOrWhiteSpace(m.Value) ? new string[] { } : m.Value.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
|
.Select(m => m.Value)
|
||||||
.Where(i => !string.IsNullOrWhiteSpace(i) && !string.IsNullOrEmpty(i));
|
.Where(i => !string.IsNullOrWhiteSpace(i) && !string.IsNullOrEmpty(i));
|
||||||
|
|
||||||
foreach (var person in persons.Select(str =>
|
foreach (var person in persons.Select(str =>
|
||||||
|
Loading…
Reference in New Issue
Block a user