reduced bandwidth usage, quality should be the same. Fixed reply bug

This commit is contained in:
Master Kwoth
2016-02-10 13:44:19 +01:00
parent bfc3acd40d
commit bbb336f1a3
2 changed files with 7 additions and 6 deletions

View File

@@ -79,11 +79,12 @@ namespace NadekoBot.Classes.Music {
if (OnResolving != null)
OnResolving();
var links = await Searches.FindYoutubeUrlByKeywords(Query);
var videos = await YouTube.Default.GetAllVideosAsync(links);
var allVideos = await YouTube.Default.GetAllVideosAsync(links);
var videos = allVideos.Where(v => v.AdaptiveKind == AdaptiveKind.Audio);
var video = videos
.Where(v => v.AdaptiveKind == AdaptiveKind.Audio)
.OrderByDescending(v => v.AudioBitrate)
.FirstOrDefault();
.Where(v => v.AudioBitrate < 256)
.OrderByDescending(v => v.AudioBitrate)
.FirstOrDefault();
if (video == null) // do something with this error
throw new Exception("Could not load any video elements based on the query.");