public async Task <YoutubeMetadata> GetMetadata(string url) { var video = await youtube.Videos.GetAsync(HttpUtility.UrlDecode(url)); var metadata = new YoutubeMetadata { Id = video.Id.Value, Author = video.Author, Title = video.Title, Duration = video.Duration }; return(metadata); }
public async Task <byte[]> makeBrstm(BrstmOptions options, string url) { byte[] data; YoutubeService yt = new YoutubeService(); YoutubeMetadata ytmd = await yt.GetMetadata(url); MemoryStream ms = new MemoryStream(await yt.DownloadAudio(HttpUtility.UrlDecode(url))); data = TrimWavFile(ms, TimeSpan.FromSeconds(options.start), TimeSpan.FromSeconds(options.end)); data = raiseVolume(data, options.decibelIncrease); if (options.finalLap) { data = adjustSpeed(data, options.speedFactor); } data = adjustChannels(data, options.courseInfo.channelCount); return(convertToBrstm(data)); }