.leaveall leaves all except current. Back to extractor

This commit is contained in:
Master Kwoth 2016-01-30 22:34:38 +01:00
parent db94133f3b
commit dbeb2b55ab
5 changed files with 11 additions and 17 deletions

View File

@ -12,7 +12,7 @@ using System.Diagnostics;
using NadekoBot.Extensions; using NadekoBot.Extensions;
using System.Threading; using System.Threading;
using Timer = System.Timers.Timer; using Timer = System.Timers.Timer;
using VideoLibrary; using YoutubeExtractor;
namespace NadekoBot.Classes.Music { namespace NadekoBot.Classes.Music {
public enum StreamState { public enum StreamState {
@ -55,14 +55,14 @@ namespace NadekoBot.Classes.Music {
} }
private async Task ResolveStreamLink() { private async Task ResolveStreamLink() {
VideoLibrary.YouTubeVideo video = null; VideoInfo video = null;
try { try {
if (OnResolving != null) if (OnResolving != null)
OnResolving(); OnResolving();
Console.WriteLine("Resolving video link"); Console.WriteLine("Resolving video link");
video = (await YouTube.Default.GetAllVideosAsync(Searches.FindYoutubeUrlByKeywords(Query))) video = DownloadUrlResolver.GetDownloadUrls(Searches.FindYoutubeUrlByKeywords(Query))
.Where(v => v.AdaptiveKind == AdaptiveKind.Audio) .Where(v => v.AdaptiveType == AdaptiveType.Audio)
.OrderByDescending(v => v.AudioBitrate) .OrderByDescending(v => v.AudioBitrate)
.FirstOrDefault(); .FirstOrDefault();
@ -78,7 +78,7 @@ namespace NadekoBot.Classes.Music {
return; return;
} }
musicStreamer = new MusicStreamer(this, video.Uri, Channel); musicStreamer = new MusicStreamer(this, video.DownloadUrl, Channel);
if (OnQueued != null) if (OnQueued != null)
OnQueued(); OnQueued();
return; return;

View File

@ -364,7 +364,7 @@ namespace NadekoBot.Modules {
.Description("Nadeko leaves all servers") .Description("Nadeko leaves all servers")
.Do(e => { .Do(e => {
if (e.User.Id == NadekoBot.OwnerID) 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(); });
}); });

View File

@ -94,6 +94,8 @@ namespace NadekoBot.Modules {
} }
try { 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); var sr = await player.CreateStreamRequest(e, e.GetArg("query"), player.VoiceChannel);
if (sr == null) if (sr == null)
throw new NullReferenceException("StreamRequest is null."); throw new NullReferenceException("StreamRequest is null.");

View File

@ -73,10 +73,6 @@
<Prefer32Bit>true</Prefer32Bit> <Prefer32Bit>true</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="libvideo, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\VideoLibrary.1.3.3\lib\portable-net45+win+wpa81+MonoAndroid10+xamarinios10+MonoTouch10\libvideo.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Manatee.Json, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c267f67a39449c62, processorArchitecture=MSIL"> <Reference Include="Manatee.Json, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c267f67a39449c62, processorArchitecture=MSIL">
<HintPath>..\packages\Manatee.Json.3.2.1\lib\net45\Manatee.Json.dll</HintPath> <HintPath>..\packages\Manatee.Json.3.2.1\lib\net45\Manatee.Json.dll</HintPath>
<Private>True</Private> <Private>True</Private>
@ -109,10 +105,6 @@
<HintPath>..\packages\Parse.1.6.2\lib\net45\Parse.NetFx45.dll</HintPath> <HintPath>..\packages\Parse.1.6.2\lib\net45\Parse.NetFx45.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="policy.2.0.taglib-sharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=db62eba44689b5b0, processorArchitecture=MSIL">
<HintPath>..\packages\taglib.2.1.0.0\lib\policy.2.0.taglib-sharp.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="RestSharp, Version=105.2.3.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="RestSharp, Version=105.2.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\RestSharp.105.2.3\lib\net452\RestSharp.dll</HintPath> <HintPath>..\packages\RestSharp.105.2.3\lib\net452\RestSharp.dll</HintPath>
<Private>True</Private> <Private>True</Private>
@ -136,8 +128,8 @@
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Net.Http" /> <Reference Include="System.Net.Http" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
<Reference Include="taglib-sharp, Version=2.1.0.0, Culture=neutral, PublicKeyToken=db62eba44689b5b0, processorArchitecture=MSIL"> <Reference Include="YoutubeExtractor, Version=0.10.10.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\taglib.2.1.0.0\lib\taglib-sharp.dll</HintPath> <HintPath>..\packages\YoutubeExtractor.0.10.10\lib\net35\YoutubeExtractor.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
</ItemGroup> </ItemGroup>

View File

@ -11,5 +11,5 @@
<package id="Parse" version="1.6.2" targetFramework="net452" /> <package id="Parse" version="1.6.2" targetFramework="net452" />
<package id="RestSharp" version="105.2.3" targetFramework="net452" /> <package id="RestSharp" version="105.2.3" targetFramework="net452" />
<package id="taglib" version="2.1.0.0" targetFramework="net452" /> <package id="taglib" version="2.1.0.0" targetFramework="net452" />
<package id="VideoLibrary" version="1.3.3" targetFramework="net452" /> <package id="YoutubeExtractor" version="0.10.10" targetFramework="net452" />
</packages> </packages>