Exemple #1
0
        public async Task DownloadAudio_CanDownloadAudio(string id, string videoPath)
        {
            string videoPathAndName = videoPath + $"//{id}.mp3";
            await target.DownloadAudioAsync(id, videoPathAndName);

            Assert.True(File.Exists(videoPathAndName));
            await CleanDirectory.DeleteFileAsync(videoPath, id + ".mp3");
        }
Exemple #2
0
        public async Task <IActionResult> GetAudio(string id)
        {
            string audioPath = DownloaderConfiguration.videoDownloadPath + $"\\DownloadedVideos\\{id}.mp3";

            try
            {
                await clientHelper.DownloadAudioAsync(id, audioPath);
            }
            catch (ArgumentException)
            {
                return(BadRequest(new string("Provided ID is incorrect")));
            }

            return(new PhysicalFileResultAndDelete(audioPath, "audio/mp3"));
        }