diff options
| author | Claus Vium <clausvium@gmail.com> | 2019-08-16 19:58:44 +0200 |
|---|---|---|
| committer | Claus Vium <clausvium@gmail.com> | 2019-08-16 19:58:44 +0200 |
| commit | 15f7a2078b010b2a5aa644e05832a83e02c41bf0 (patch) | |
| tree | cb2adf8935fffdf842790aa0ee40c8f74441932a | |
| parent | 26b4fb21fe7992d5a489ed2ced74ee58671ee2d4 (diff) | |
Invert the if
| -rw-r--r-- | MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeProvider.cs | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeProvider.cs b/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeProvider.cs index 59df6ade4..36e172dfb 100644 --- a/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeProvider.cs +++ b/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeProvider.cs @@ -205,38 +205,41 @@ namespace MediaBrowser.Providers.TV.TheTVDB var currentActor = episode.GuestStars[i]; var roleStartIndex = currentActor.IndexOf('('); - string name = currentActor; - string role = string.Empty; - if (roleStartIndex != -1) + if (roleStartIndex == -1) { - var roles = new List<string> {currentActor.Substring(roleStartIndex + 1)}; - name = name.Substring(0, roleStartIndex).Trim(); - - // Fetch all roles - for (var j = i + 1; j < episode.GuestStars.Length; ++j) + result.AddPerson(new PersonInfo { - var currentRole = episode.GuestStars[j]; - var roleEndIndex = currentRole.IndexOf(')'); + Type = PersonType.GuestStar, + Name = currentActor, + Role = string.Empty + }); + continue; + } - if (roleEndIndex != -1) - { - roles.Add(currentRole.TrimEnd(')')); - // Update the outer index (keep in mind it adds 1 after the iteration) - i = j; - break; - } + var roles = new List<string> {currentActor.Substring(roleStartIndex + 1)}; - roles.Add(currentRole); + // Fetch all roles + for (var j = i + 1; j < episode.GuestStars.Length; ++j) + { + var currentRole = episode.GuestStars[j]; + var roleEndIndex = currentRole.IndexOf(')'); + + if (roleEndIndex != -1) + { + roles.Add(currentRole.TrimEnd(')')); + // Update the outer index (keep in mind it adds 1 after the iteration) + i = j; + break; } - role = string.Join(", ", roles); + roles.Add(currentRole); } result.AddPerson(new PersonInfo { Type = PersonType.GuestStar, - Name = name, - Role = role + Name = currentActor.Substring(0, roleStartIndex).Trim(), + Role = string.Join(", ", roles) }); } |
