aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuis Miguel Almánzar <ruisu15@gmail.com>2013-08-30 22:04:43 -0400
committerLuis Miguel Almánzar <ruisu15@gmail.com>2013-08-30 22:04:43 -0400
commit3f4dd4231d2225ab0d474840038a4de01b5f7391 (patch)
tree1b349e8d918fce6fed70742b713db573be18389c
parent4c3ceee7a19b5285e65a07f0a0d21a30bbdf256a (diff)
update the gueststars regex to use commas as delimitators
-rw-r--r--MediaBrowser.Providers/TV/RemoteEpisodeProvider.cs11
1 files changed, 7 insertions, 4 deletions
diff --git a/MediaBrowser.Providers/TV/RemoteEpisodeProvider.cs b/MediaBrowser.Providers/TV/RemoteEpisodeProvider.cs
index 247071416..347c77d99 100644
--- a/MediaBrowser.Providers/TV/RemoteEpisodeProvider.cs
+++ b/MediaBrowser.Providers/TV/RemoteEpisodeProvider.cs
@@ -317,9 +317,12 @@ namespace MediaBrowser.Providers.TV
if (actors != null)
{
// 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>()
- .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));
foreach (var person in persons.Select(str =>
@@ -340,9 +343,9 @@ namespace MediaBrowser.Providers.TV
var extraActors = xmlDocument.SafeGetString("//GuestStars");
if (extraActors == null) continue;
// Sometimes tvdb actors have leading spaces
- var persons = Regex.Matches(extraActors, @"([^|()]|\([^)]*\)*)+")
+ var persons = Regex.Matches(extraActors, @"(?<delimitators>([^|,(])|(?<ignoreinParentheses>\([^)]*\)*))+")
.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));
foreach (var person in persons.Select(str =>