|
|
@ -1,5 +1,6 @@
|
|
|
|
using System;
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
using System.Text;
|
|
|
|
using System.Threading;
|
|
|
|
using System.Threading;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using MediaBrowser.Common.Net;
|
|
|
|
using MediaBrowser.Common.Net;
|
|
|
@ -193,24 +194,43 @@ namespace MediaBrowser.Providers.TV.TheTVDB
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var person in episode.GuestStars)
|
|
|
|
// GuestStars is a weird list of names and roles
|
|
|
|
|
|
|
|
// Example:
|
|
|
|
|
|
|
|
// 1: Some Actor (Role1
|
|
|
|
|
|
|
|
// 2: Role2
|
|
|
|
|
|
|
|
// 3: Role3)
|
|
|
|
|
|
|
|
// 4: Another Actor (Role1
|
|
|
|
|
|
|
|
// ...
|
|
|
|
|
|
|
|
for (var i = 0; i < episode.GuestStars.Length; ++i)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var currentActor = episode.GuestStars[i];
|
|
|
|
|
|
|
|
var roleStartIndex = currentActor.IndexOf('(');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var roles = new List<string> {currentActor.Substring(roleStartIndex + 1)};
|
|
|
|
|
|
|
|
var name = currentActor.Substring(0, roleStartIndex).Trim();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Fetch all roles
|
|
|
|
|
|
|
|
for (var j = i + 1; j < episode.GuestStars.Length; ++j)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var index = person.IndexOf('(');
|
|
|
|
var currentRole = episode.GuestStars[j];
|
|
|
|
string role = null;
|
|
|
|
var roleEndIndex = currentRole.IndexOf(')');
|
|
|
|
var name = person;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (index != -1)
|
|
|
|
if (roleEndIndex != -1)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
role = person.Substring(index + 1).Trim().TrimEnd(')');
|
|
|
|
roles.Add(currentRole.TrimEnd(')'));
|
|
|
|
|
|
|
|
// Update the outer index (keep in mind it adds 1 after the iteration)
|
|
|
|
|
|
|
|
i = j;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
name = person.Substring(0, index).Trim();
|
|
|
|
roles.Add(currentRole);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
result.AddPerson(new PersonInfo
|
|
|
|
result.AddPerson(new PersonInfo
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Type = PersonType.GuestStar,
|
|
|
|
Type = PersonType.GuestStar,
|
|
|
|
Name = name,
|
|
|
|
Name = name,
|
|
|
|
Role = role
|
|
|
|
Role = string.Join(", ", roles)
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|