public async Task <IEnumerable <RemoteImageInfo> > GetImages(BaseItem item, CancellationToken cancellationToken) { var list = new List <RemoteImageInfo>(); try { Shokofin.API.Info.EpisodeInfo episode = null; Shokofin.API.Info.SeriesInfo series = null; if (item is Episode) { episode = await ApiManager.GetEpisodeInfo(item.GetProviderId("Shoko Episode")); } else if (item is Series) { var groupId = item.GetProviderId("Shoko Group"); if (string.IsNullOrEmpty(groupId)) { series = await ApiManager.GetSeriesInfo(item.GetProviderId("Shoko Series")); } else { series = (await ApiManager.GetGroupInfo(groupId))?.DefaultSeries; } } else if (item is BoxSet || item is Movie) { series = await ApiManager.GetSeriesInfo(item.GetProviderId("Shoko Series")); } else if (item is Season) { series = await ApiManager.GetSeriesInfoFromGroup(item.GetParent()?.GetProviderId("Shoko Group"), item.IndexNumber ?? 1); } if (episode != null) { Logger.LogInformation($"Getting episode images ({episode.Id} - {item.Name})"); AddImage(ref list, ImageType.Primary, episode?.TvDB?.Thumbnail); } if (series != null) { Logger.LogInformation($"Getting series images ({series.Id} - {item.Name})"); var images = series.Shoko.Images; AddImage(ref list, ImageType.Primary, series.AniDB.Poster); foreach (var image in images?.Posters) { AddImage(ref list, ImageType.Primary, image); } foreach (var image in images?.Fanarts) { AddImage(ref list, ImageType.Backdrop, image); } foreach (var image in images?.Banners) { AddImage(ref list, ImageType.Banner, image); } } Logger.LogInformation($"List got {list.Count} item(s)."); return(list); } catch (Exception e) { Logger.LogError(e, $"Threw unexpectedly; {e.Message}"); return(list); } }