trim person names

pull/702/head
Luke Pulverenti 11 years ago
parent 9d2ed0d7f6
commit a6c1370a62

@ -350,7 +350,7 @@ namespace MediaBrowser.Controller.Providers
case "Director": case "Director":
{ {
foreach (var p in SplitNames(reader.ReadElementContentAsString()).Select(v => new PersonInfo { Name = v, Type = PersonType.Director })) foreach (var p in SplitNames(reader.ReadElementContentAsString()).Select(v => new PersonInfo { Name = v.Trim(), Type = PersonType.Director }))
{ {
if (string.IsNullOrWhiteSpace(p.Name)) if (string.IsNullOrWhiteSpace(p.Name))
{ {
@ -362,7 +362,7 @@ namespace MediaBrowser.Controller.Providers
} }
case "Writer": case "Writer":
{ {
foreach (var p in SplitNames(reader.ReadElementContentAsString()).Select(v => new PersonInfo { Name = v, Type = PersonType.Writer })) foreach (var p in SplitNames(reader.ReadElementContentAsString()).Select(v => new PersonInfo { Name = v.Trim(), Type = PersonType.Writer }))
{ {
if (string.IsNullOrWhiteSpace(p.Name)) if (string.IsNullOrWhiteSpace(p.Name))
{ {
@ -911,7 +911,7 @@ namespace MediaBrowser.Controller.Providers
} }
} }
return names.Select(n => new PersonInfo { Name = n, Role = role, Type = type }); return names.Select(n => new PersonInfo { Name = n.Trim(), Role = role, Type = type });
} }
/// <summary> /// <summary>

@ -783,13 +783,13 @@ namespace MediaBrowser.Providers.Movies
//actors come from cast //actors come from cast
if (movieData.casts != null && movieData.casts.cast != null) if (movieData.casts != null && movieData.casts.cast != null)
{ {
foreach (var actor in movieData.casts.cast.OrderBy(a => a.order)) movie.AddPerson(new PersonInfo { Name = actor.name, Role = actor.character, Type = PersonType.Actor }); foreach (var actor in movieData.casts.cast.OrderBy(a => a.order)) movie.AddPerson(new PersonInfo { Name = actor.name.Trim(), Role = actor.character, Type = PersonType.Actor });
} }
//and the rest from crew //and the rest from crew
if (movieData.casts != null && movieData.casts.crew != null) if (movieData.casts != null && movieData.casts.crew != null)
{ {
foreach (var person in movieData.casts.crew) movie.AddPerson(new PersonInfo { Name = person.name, Role = person.job, Type = person.department }); foreach (var person in movieData.casts.crew) movie.AddPerson(new PersonInfo { Name = person.name.Trim(), Role = person.job, Type = person.department });
} }
} }

@ -421,6 +421,7 @@ namespace MediaBrowser.Providers.TV
{ {
string actorName = p.SafeGetString("Name"); string actorName = p.SafeGetString("Name");
string actorRole = p.SafeGetString("Role"); string actorRole = p.SafeGetString("Role");
if (!string.IsNullOrWhiteSpace(actorName)) if (!string.IsNullOrWhiteSpace(actorName))
{ {
// Sometimes tvdb actors have leading spaces // Sometimes tvdb actors have leading spaces

Loading…
Cancel
Save