diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-08-28 11:43:36 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-08-28 11:43:36 -0400 |
| commit | d06dca2d66e88e69fc06de346cdf09d52c90fc2b (patch) | |
| tree | 4e2b31367c6511212f5a12d36ac198a742fd1b58 | |
| parent | 89b8660fc8e98d7650d5974858a2b4acd0d43052 (diff) | |
handle comma delimited guest stars
| -rw-r--r-- | MediaBrowser.Providers/TV/RemoteEpisodeProvider.cs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/MediaBrowser.Providers/TV/RemoteEpisodeProvider.cs b/MediaBrowser.Providers/TV/RemoteEpisodeProvider.cs index 9099d10d6..247071416 100644 --- a/MediaBrowser.Providers/TV/RemoteEpisodeProvider.cs +++ b/MediaBrowser.Providers/TV/RemoteEpisodeProvider.cs @@ -319,7 +319,9 @@ namespace MediaBrowser.Providers.TV // Sometimes tvdb actors have leading spaces var persons = Regex.Matches(actors, @"([^|()]|\([^)]*\)*)+") .Cast<Match>() - .Select(m => m.Value).Where(i => !string.IsNullOrWhiteSpace(i) && !string.IsNullOrEmpty(i)); + .SelectMany(m => string.IsNullOrWhiteSpace(m.Value) ? new string[] { } : m.Value.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) + .Where(i => !string.IsNullOrWhiteSpace(i) && !string.IsNullOrEmpty(i)); + foreach (var person in persons.Select(str => { var nameGroup = str.Split(new[] { '(' }, 2, StringSplitOptions.RemoveEmptyEntries); @@ -340,7 +342,9 @@ namespace MediaBrowser.Providers.TV // Sometimes tvdb actors have leading spaces var persons = Regex.Matches(extraActors, @"([^|()]|\([^)]*\)*)+") .Cast<Match>() - .Select(m => m.Value).Where(i => !string.IsNullOrWhiteSpace(i) && !string.IsNullOrEmpty(i)); + .SelectMany(m => string.IsNullOrWhiteSpace(m.Value) ? new string[] { } : m.Value.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) + .Where(i => !string.IsNullOrWhiteSpace(i) && !string.IsNullOrEmpty(i)); + foreach (var person in persons.Select(str => { var nameGroup = str.Split(new[] { '(' }, 2, StringSplitOptions.RemoveEmptyEntries); @@ -349,8 +353,7 @@ namespace MediaBrowser.Providers.TV if (roles != null) roles = roles.EndsWith(")") ? roles.Substring(0, roles.Length - 1) : roles; return new PersonInfo { Type = PersonType.GuestStar, Name = name, Role = roles }; - }).Where(person => !episode.People.Any(x => x.Type == person.Type && x.Name == person.Name)) - ) + })) { episode.AddPerson(person); } |
