From a6c1370a62ab0fdd9caf6bc83bacfb6c5c5137ee Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 31 Jul 2013 08:09:23 -0400 Subject: [PATCH] trim person names --- MediaBrowser.Controller/Providers/BaseItemXmlParser.cs | 6 +++--- MediaBrowser.Providers/Movies/MovieDbProvider.cs | 4 ++-- MediaBrowser.Providers/TV/RemoteSeriesProvider.cs | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs b/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs index e3cef0d16..b290d3bb5 100644 --- a/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs +++ b/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs @@ -350,7 +350,7 @@ namespace MediaBrowser.Controller.Providers 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)) { @@ -362,7 +362,7 @@ namespace MediaBrowser.Controller.Providers } 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)) { @@ -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 }); } /// diff --git a/MediaBrowser.Providers/Movies/MovieDbProvider.cs b/MediaBrowser.Providers/Movies/MovieDbProvider.cs index ea6bca917..07ba5ccbc 100644 --- a/MediaBrowser.Providers/Movies/MovieDbProvider.cs +++ b/MediaBrowser.Providers/Movies/MovieDbProvider.cs @@ -783,13 +783,13 @@ namespace MediaBrowser.Providers.Movies //actors come from cast 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 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 }); } } diff --git a/MediaBrowser.Providers/TV/RemoteSeriesProvider.cs b/MediaBrowser.Providers/TV/RemoteSeriesProvider.cs index 56ba654ad..1905bbddb 100644 --- a/MediaBrowser.Providers/TV/RemoteSeriesProvider.cs +++ b/MediaBrowser.Providers/TV/RemoteSeriesProvider.cs @@ -421,6 +421,7 @@ namespace MediaBrowser.Providers.TV { string actorName = p.SafeGetString("Name"); string actorRole = p.SafeGetString("Role"); + if (!string.IsNullOrWhiteSpace(actorName)) { // Sometimes tvdb actors have leading spaces