public async Task <string> GetTokenisedUrlForChannelAsync(string token, string channelUrl) { _logger.Info($"Getting tokenised URL for channel with URL '{channelUrl}' using token '{token}'..."); var url = (await _f1tvClient.GetTokenisedUrlForChannelAsync(token, channelUrl)).Url; _logger.Info($"Got tokenised URL '{url}'."); return(url); }
public async Task <string> GetTokenisedUrlAsync(string token, IPlayableContent playableContent) { _logger.Info($"Getting tokenised URL for content-type '{playableContent.ContentType}' and content-URL '{playableContent.ContentUrl}' using token '{token}'..."); return(playableContent.ContentType switch { ContentType.Channel => (await _client.GetTokenisedUrlForChannelAsync(token, playableContent.ContentUrl)).Url, ContentType.Asset => (await _client.GetTokenisedUrlForAssetAsync(token, playableContent.ContentUrl)).Objects.First().TokenisedUrl.Url, ContentType.Backup => (await _client.GetBackupStream()).StreamManifest, _ => throw new ArgumentException($"Could not generate tokenised URL for unsupported content-type '{playableContent.ContentType}'.", nameof(playableContent)) });