From 8ee1874e8cb70cea8916457d36e2f5f57e61d1b9 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 25 May 2013 08:37:02 -0400 Subject: [PATCH] fixes #309 - TVDB episode XML ingestion of Writer and Director elements not dropping leading spaces --- .../Providers/TV/RemoteEpisodeProvider.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/MediaBrowser.Controller/Providers/TV/RemoteEpisodeProvider.cs b/MediaBrowser.Controller/Providers/TV/RemoteEpisodeProvider.cs index 71249c5810..cccaf4d755 100644 --- a/MediaBrowser.Controller/Providers/TV/RemoteEpisodeProvider.cs +++ b/MediaBrowser.Controller/Providers/TV/RemoteEpisodeProvider.cs @@ -319,7 +319,9 @@ namespace MediaBrowser.Controller.Providers.TV var actors = doc.SafeGetString("//GuestStars"); if (actors != null) { - foreach (var person in actors.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries).Select(str => new PersonInfo { Type = PersonType.GuestStar, Name = str })) + foreach (var person in actors.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries) + .Where(i => !string.IsNullOrWhiteSpace(i)) + .Select(str => new PersonInfo { Type = PersonType.GuestStar, Name = str })) { episode.AddPerson(person); } @@ -329,7 +331,9 @@ namespace MediaBrowser.Controller.Providers.TV var directors = doc.SafeGetString("//Director"); if (directors != null) { - foreach (var person in directors.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries).Select(str => new PersonInfo { Type = PersonType.Director, Name = str })) + foreach (var person in directors.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries) + .Where(i => !string.IsNullOrWhiteSpace(i)) + .Select(str => new PersonInfo { Type = PersonType.Director, Name = str })) { episode.AddPerson(person); } @@ -339,7 +343,9 @@ namespace MediaBrowser.Controller.Providers.TV var writers = doc.SafeGetString("//Writer"); if (writers != null) { - foreach (var person in writers.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries).Select(str => new PersonInfo { Type = PersonType.Writer, Name = str })) + foreach (var person in writers.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries) + .Where(i => !string.IsNullOrWhiteSpace(i)) + .Select(str => new PersonInfo { Type = PersonType.Writer, Name = str })) { episode.AddPerson(person); }