add comma delimiters for writers and actors

This commit is contained in:
Luke Pulverenti 2013-08-26 17:00:58 -04:00
parent aeb5984ee8
commit 4a5831adb6

View file

@ -320,7 +320,8 @@ namespace MediaBrowser.Providers.TV
var persons = Regex.Matches(actors, @"([^|()]|\([^)]*\)*)+")
.Cast<Match>()
.Select(m => m.Value).Where(i => !string.IsNullOrWhiteSpace(i) && !string.IsNullOrEmpty(i));
foreach (var person in persons.Select(str => {
foreach (var person in persons.Select(str =>
{
var nameGroup = str.Split(new[] { '(' }, 2, StringSplitOptions.RemoveEmptyEntries);
var name = nameGroup[0].Trim();
var roles = nameGroup.Count() > 1 ? nameGroup[1].Trim() : null;
@ -340,7 +341,8 @@ namespace MediaBrowser.Providers.TV
var persons = Regex.Matches(extraActors, @"([^|()]|\([^)]*\)*)+")
.Cast<Match>()
.Select(m => m.Value).Where(i => !string.IsNullOrWhiteSpace(i) && !string.IsNullOrEmpty(i));
foreach (var person in persons.Select(str => {
foreach (var person in persons.Select(str =>
{
var nameGroup = str.Split(new[] { '(' }, 2, StringSplitOptions.RemoveEmptyEntries);
var name = nameGroup[0].Trim();
var roles = nameGroup.Count() > 1 ? nameGroup[1].Trim() : null;
@ -358,7 +360,7 @@ namespace MediaBrowser.Providers.TV
if (directors != null)
{
// Sometimes tvdb actors have leading spaces
foreach (var person in directors.Split(new[] {'|'}, StringSplitOptions.RemoveEmptyEntries)
foreach (var person in directors.Split(new[] { '|', ',' }, StringSplitOptions.RemoveEmptyEntries)
.Where(i => !string.IsNullOrWhiteSpace(i))
.Select(str => new PersonInfo { Type = PersonType.Director, Name = str.Trim() }))
{
@ -371,7 +373,7 @@ namespace MediaBrowser.Providers.TV
if (writers != null)
{
// Sometimes tvdb actors have leading spaces
foreach (var person in writers.Split(new[] {'|'}, StringSplitOptions.RemoveEmptyEntries)
foreach (var person in writers.Split(new[] { '|', ',' }, StringSplitOptions.RemoveEmptyEntries)
.Where(i => !string.IsNullOrWhiteSpace(i))
.Select(str => new PersonInfo { Type = PersonType.Writer, Name = str.Trim() }))
{