trim person names

This commit is contained in:
Luke Pulverenti 2013-07-31 08:09:23 -04:00
parent 9d2ed0d7f6
commit a6c1370a62
3 changed files with 6 additions and 5 deletions

View File

@ -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>

View File

@ -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 });
} }
} }

View File

@ -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