~h for help too, more work on yotube playlist queue, music debugging
This commit is contained in:
parent
6f53bfcf16
commit
aa961bbe65
3
.gitignore
vendored
3
.gitignore
vendored
@ -20,6 +20,9 @@ obj/
|
||||
!**/Bin/Debug/opus.dll
|
||||
!**/Bin/Debug/libsodium.dll
|
||||
!**/Bin/Debug/Discord.Net.Commands.dll
|
||||
!**/Bin/Debug/Nito.AsyncEx.Enlightenment.dll
|
||||
!**/Bin/Debug/Nito.AsyncEx.dll
|
||||
!**/Bin/Debug/WebSocket4Net.dll
|
||||
!**/Bin/Debug/data/*
|
||||
!**/Bin/Debug/data/
|
||||
|
||||
|
@ -61,8 +61,12 @@ namespace NadekoBot.Classes.Music {
|
||||
}
|
||||
|
||||
try {
|
||||
if (VoiceClient == null)
|
||||
if (VoiceClient == null) {
|
||||
Console.WriteLine($"Joining voice channel [{DateTime.Now.Second}]");
|
||||
//todo add a new event, to tell people nadeko is trying to join
|
||||
VoiceClient = await NadekoBot.client.Audio().Join(VoiceChannel);
|
||||
Console.WriteLine($"Joined voicechannel [{DateTime.Now.Second}]");
|
||||
}
|
||||
await CurrentSong.Start();
|
||||
} catch (Exception ex) {
|
||||
Console.WriteLine($"Starting failed: {ex}");
|
||||
|
@ -156,6 +156,7 @@ namespace NadekoBot.Classes.Music {
|
||||
Arguments = $"-i {Url} -f s16le -ar 48000 -ac 2 pipe:1",
|
||||
UseShellExecute = false,
|
||||
RedirectStandardOutput = true,
|
||||
RedirectStandardError = false,
|
||||
CreateNoWindow = true,
|
||||
WindowStyle = ProcessWindowStyle.Hidden,
|
||||
});
|
||||
@ -165,7 +166,7 @@ namespace NadekoBot.Classes.Music {
|
||||
//wait for the read pos to catch up with write pos
|
||||
while (buffer.writePos - buffer.readPos > 5.MB() && State != StreamState.Completed) {
|
||||
prebufferingComplete = true;
|
||||
await Task.Delay(500);
|
||||
await Task.Delay(200);
|
||||
}
|
||||
|
||||
if (State == StreamState.Completed) {
|
||||
@ -258,7 +259,7 @@ namespace NadekoBot.Classes.Music {
|
||||
|
||||
if (readCount == 0) {
|
||||
if (attempt == 2) {
|
||||
Console.WriteLine($"Failed to read {attempt} times. Stopping playback.");
|
||||
Console.WriteLine($"Failed to read {attempt} times. Breaking out. [{DateTime.Now.Second}]");
|
||||
break;
|
||||
} else {
|
||||
++attempt;
|
||||
@ -287,7 +288,7 @@ namespace NadekoBot.Classes.Music {
|
||||
}
|
||||
|
||||
internal void Stop() {
|
||||
Console.WriteLine("Stopping playback");
|
||||
Console.WriteLine($"Stopping playback [{DateTime.Now.Second}]");
|
||||
if (State != StreamState.Completed) {
|
||||
State = StreamState.Completed;
|
||||
parent.OnCompleted();
|
||||
|
@ -55,7 +55,7 @@ namespace NadekoBot
|
||||
public override void Init(CommandGroupBuilder cgb)
|
||||
{
|
||||
cgb.CreateCommand("-h")
|
||||
.Alias(new string[] { "-help", NadekoBot.botMention + " help", NadekoBot.botMention + " h" })
|
||||
.Alias(new string[] { "-help", NadekoBot.botMention + " help", NadekoBot.botMention + " h", "~h" })
|
||||
.Description("Help command")
|
||||
.Do(DoFunc());
|
||||
cgb.CreateCommand("-hgit")
|
||||
|
@ -269,7 +269,10 @@ namespace NadekoBot.Modules {
|
||||
var sr = new StreamReader(wr.GetResponse().GetResponseStream());
|
||||
|
||||
dynamic obj = JObject.Parse(sr.ReadToEnd());
|
||||
toReturn = "http://www.youtube.com/watch?v=" + obj.items[0].id.playlistId.ToString();
|
||||
|
||||
foreach (var item in obj.items) {
|
||||
toReturn.Add("http://www.youtube.com/watch?v=" + item.id.contentDetails.videoId);
|
||||
}
|
||||
return toReturn;
|
||||
} catch (Exception ex) {
|
||||
Console.WriteLine($"Error in GetPlaylistId: {ex.Message}");
|
||||
|
Loading…
Reference in New Issue
Block a user