.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 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;

View File

@ -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(); });
});

View File

@ -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.");

View File

@ -73,10 +73,6 @@
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<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">
<HintPath>..\packages\Manatee.Json.3.2.1\lib\net45\Manatee.Json.dll</HintPath>
<Private>True</Private>
@ -109,10 +105,6 @@
<HintPath>..\packages\Parse.1.6.2\lib\net45\Parse.NetFx45.dll</HintPath>
<Private>True</Private>
</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">
<HintPath>..\packages\RestSharp.105.2.3\lib\net452\RestSharp.dll</HintPath>
<Private>True</Private>
@ -136,8 +128,8 @@
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="taglib-sharp, Version=2.1.0.0, Culture=neutral, PublicKeyToken=db62eba44689b5b0, processorArchitecture=MSIL">
<HintPath>..\packages\taglib.2.1.0.0\lib\taglib-sharp.dll</HintPath>
<Reference Include="YoutubeExtractor, Version=0.10.10.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\YoutubeExtractor.0.10.10\lib\net35\YoutubeExtractor.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>

View File

@ -11,5 +11,5 @@
<package id="Parse" version="1.6.2" targetFramework="net452" />
<package id="RestSharp" version="105.2.3" 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>