From dbeb2b55abb460a538ab71e2032b4705a85c105b Mon Sep 17 00:00:00 2001 From: Master Kwoth Date: Sat, 30 Jan 2016 22:34:38 +0100 Subject: [PATCH] .leaveall leaves all except current. Back to extractor --- NadekoBot/Classes/Music/StreamRequest.cs | 10 +++++----- NadekoBot/Modules/Administration.cs | 2 +- NadekoBot/Modules/Music.cs | 2 ++ NadekoBot/NadekoBot.csproj | 12 ++---------- NadekoBot/packages.config | 2 +- 5 files changed, 11 insertions(+), 17 deletions(-) diff --git a/NadekoBot/Classes/Music/StreamRequest.cs b/NadekoBot/Classes/Music/StreamRequest.cs index d0546ace..9a6ee540 100644 --- a/NadekoBot/Classes/Music/StreamRequest.cs +++ b/NadekoBot/Classes/Music/StreamRequest.cs @@ -12,7 +12,7 @@ using System.Diagnostics; using NadekoBot.Extensions; using System.Threading; using Timer = System.Timers.Timer; -using VideoLibrary; +using YoutubeExtractor; namespace NadekoBot.Classes.Music { public enum StreamState { @@ -55,14 +55,14 @@ namespace NadekoBot.Classes.Music { } private async Task ResolveStreamLink() { - VideoLibrary.YouTubeVideo video = null; + VideoInfo video = null; try { if (OnResolving != null) OnResolving(); Console.WriteLine("Resolving video link"); - video = (await YouTube.Default.GetAllVideosAsync(Searches.FindYoutubeUrlByKeywords(Query))) - .Where(v => v.AdaptiveKind == AdaptiveKind.Audio) + video = DownloadUrlResolver.GetDownloadUrls(Searches.FindYoutubeUrlByKeywords(Query)) + .Where(v => v.AdaptiveType == AdaptiveType.Audio) .OrderByDescending(v => v.AudioBitrate) .FirstOrDefault(); @@ -78,7 +78,7 @@ namespace NadekoBot.Classes.Music { return; } - musicStreamer = new MusicStreamer(this, video.Uri, Channel); + musicStreamer = new MusicStreamer(this, video.DownloadUrl, Channel); if (OnQueued != null) OnQueued(); return; diff --git a/NadekoBot/Modules/Administration.cs b/NadekoBot/Modules/Administration.cs index 60868ce0..cddeb315 100644 --- a/NadekoBot/Modules/Administration.cs +++ b/NadekoBot/Modules/Administration.cs @@ -364,7 +364,7 @@ namespace NadekoBot.Modules { .Description("Nadeko leaves all servers") .Do(e => { if (e.User.Id == NadekoBot.OwnerID) - NadekoBot.client.Servers.ForEach(async s => { if (s.Name == "NadekoLog" || s.Name == "Discord Bots") return; await s.Leave(); }); + NadekoBot.client.Servers.ForEach(async s => { if (s.Name == e.Server.Name) return; await s.Leave(); }); }); diff --git a/NadekoBot/Modules/Music.cs b/NadekoBot/Modules/Music.cs index 7628af7a..d8b6f938 100644 --- a/NadekoBot/Modules/Music.cs +++ b/NadekoBot/Modules/Music.cs @@ -94,6 +94,8 @@ namespace NadekoBot.Modules { } try { + if (player.VoiceChannel.Server != e.Server) + throw new ArgumentException("You need to be in the voice channel on this server."); var sr = await player.CreateStreamRequest(e, e.GetArg("query"), player.VoiceChannel); if (sr == null) throw new NullReferenceException("StreamRequest is null."); diff --git a/NadekoBot/NadekoBot.csproj b/NadekoBot/NadekoBot.csproj index b4820e37..b8760708 100644 --- a/NadekoBot/NadekoBot.csproj +++ b/NadekoBot/NadekoBot.csproj @@ -73,10 +73,6 @@ true - - ..\packages\VideoLibrary.1.3.3\lib\portable-net45+win+wpa81+MonoAndroid10+xamarinios10+MonoTouch10\libvideo.dll - True - ..\packages\Manatee.Json.3.2.1\lib\net45\Manatee.Json.dll True @@ -109,10 +105,6 @@ ..\packages\Parse.1.6.2\lib\net45\Parse.NetFx45.dll True - - ..\packages\taglib.2.1.0.0\lib\policy.2.0.taglib-sharp.dll - True - ..\packages\RestSharp.105.2.3\lib\net452\RestSharp.dll True @@ -136,8 +128,8 @@ - - ..\packages\taglib.2.1.0.0\lib\taglib-sharp.dll + + ..\packages\YoutubeExtractor.0.10.10\lib\net35\YoutubeExtractor.dll True diff --git a/NadekoBot/packages.config b/NadekoBot/packages.config index c28cfd27..4d33cb49 100644 --- a/NadekoBot/packages.config +++ b/NadekoBot/packages.config @@ -11,5 +11,5 @@ - + \ No newline at end of file