private void TryStopCurrentSong() { if (CurrentPlayData != null) { Log.Debug("Stopping current song"); playerConnection.Stop(); CurrentPlayData = null; ResourceStopped?.Invoke(this, new SongEndEventArgs(true)); } }
private void TryStopCurrentSong() { if (taskHost.HasTask && taskHost.IsCurrentResource) { Log.Debug("Stopping preparation of current song"); taskHost.ClearTask(); } if (CurrentPlayData != null) { Log.Debug("Stopping current song"); playerConnection.Stop(); CurrentPlayData = null; ResourceStopped?.Invoke(this, new SongEndEventArgs(true)); } }
private void StopInternal(bool songEndedByCallback) { ResourceStopped?.Invoke(this, new SongEndEventArgs(songEndedByCallback)); if (songEndedByCallback) { var result = Next(CurrentPlayData?.Invoker ?? InvokerData.Anonymous, false); if (result.Ok) { return; } Log.Info("Song queue ended: {0}", result.Error); } else { playerConnection.Stop(); } CurrentPlayData = null; PlaybackStopped?.Invoke(this, EventArgs.Empty); }
private async Task StopInternal(bool songEndedByCallback) { await ResourceStopped.InvokeAsync(this, new SongEndEventArgs(songEndedByCallback)); if (songEndedByCallback) { try { await Next(CurrentPlayData?.Invoker ?? InvokerData.Anonymous, false); return; } catch (AudioBotException ex) { Log.Info("Song queue ended: {0}", ex.Message); } } else { playerConnection.Stop(); } CurrentPlayData = null; PlaybackStopped?.Invoke(this, EventArgs.Empty); }
private void StopSong(bool stopped /* true if stopped manually, false if ended normally */) { lock (Lock) { Log.Debug("Song stopped"); ResourceStopped?.Invoke(this, new SongEndEventArgs(stopped)); if (stopped) { playerConnection.Stop(); TryStopCurrentSong(); ClearTask(); } else { var result = Next(); if (result.Ok) { return; } Log.Info("Automatically playing next song ended with error: {0}", result.Error); } } }