private GetActorImageUrl

This commit is contained in:
xjasonlyu
2022-05-29 01:47:31 +08:00
parent 594729c304
commit 133e7ca171
2 changed files with 15 additions and 15 deletions

View File

@@ -99,20 +99,6 @@ public static class ApiClient
return ComposeImageApiUrl(BackdropImageApi, id, provider, url, position, auto);
}
public static async Task<string> GetActorImageUrl(string name, CancellationToken cancellationToken)
{
try
{
// Use GFriends as actor image provider.
return (await GetActorInfo(name, Constant.GFriends, cancellationToken)).Images[0];
}
catch (Exception)
{
// Ignore all exceptions and return empty url.
return string.Empty;
}
}
public static async Task<ActorInfoModel> GetActorInfo(string id, string provider,
CancellationToken cancellationToken)
{

View File

@@ -89,7 +89,7 @@ public class MovieProvider : BaseProvider, IRemoteMetadataProvider<Movie, MovieI
{
Name = name,
Type = PersonType.Actor,
ImageUrl = await ApiClient.GetActorImageUrl(name, cancellationToken)
ImageUrl = await GetActorImageUrl(name, cancellationToken)
});
return result;
@@ -129,4 +129,18 @@ public class MovieProvider : BaseProvider, IRemoteMetadataProvider<Movie, MovieI
{
return $"{m.Number} {m.Title}";
}
private static async Task<string> GetActorImageUrl(string name, CancellationToken cancellationToken)
{
try
{
// Use GFriends as actor image provider.
return (await ApiClient.GetActorInfo(name, Constant.GFriends, cancellationToken)).Images[0];
}
catch (Exception)
{
// Ignore all exceptions and return empty url.
return string.Empty;
}
}
}