JryVideo.Core.TheTVDB.TheTVDBClient.TryGetTheTVDBSeriesIdByRemoteIdAsync C# (CSharp) Méthode

TryGetTheTVDBSeriesIdByRemoteIdAsync() public méthode

public TryGetTheTVDBSeriesIdByRemoteIdAsync ( RemoteId id ) : Task
id JryVideo.Model.RemoteId
Résultat Task
        public async Task<string> TryGetTheTVDBSeriesIdByRemoteIdAsync(RemoteId id)
        {
            switch (id.Type)
            {
                case RemoteIdType.TheTVDB:
                    return id.Id;

                case RemoteIdType.Imdb:
                    return (await this.GetSeriesByImdbIdAsync(id.Id)).FirstOrDefault()?.SeriesId;

                default:
                    throw new ArgumentOutOfRangeException();
            }
        }
    }

Usage Example

        private async Task<bool> LoadFanartByImdbIdAsync(TheTVDBClient client, RemoteId id, string index = null)
        {
            var seriesId = await client.TryGetTheTVDBSeriesIdByRemoteIdAsync(id);
            if (seriesId == null) return false;

            var urls = (await client.GetBannersBySeriesIdAsync(seriesId)).Where(z => z.BannerType == BannerType.Fanart)
                .Where(z => index == null || z.Season == index)
                .Select(z => z.BuildUrl(client))
                .ToArray();
            if (urls.Length > 0)
            {
                this.Load(urls);
                return true;
            }
            return false;
        }
All Usage Examples Of JryVideo.Core.TheTVDB.TheTVDBClient::TryGetTheTVDBSeriesIdByRemoteIdAsync