extend logging of playbackstop

This commit is contained in:
KGT1 2021-01-18 07:30:33 +01:00
parent 37e027f357
commit 84ff83ede0

View File

@ -57,6 +57,9 @@ function startPlaying (voiceconnection = discordclientmanager.getDiscordClient()
getAudioDispatcher().on("finish", () => { getAudioDispatcher().on("finish", () => {
if (isRepeat) { if (isRepeat) {
log.debug("repeat and sending following payload as reportPlaybackStopped to the server: ",getStopPayload());
jellyfinClientManager.getJellyfinClient().reportPlaybackStopped(getStopPayload());
startPlaying(voiceconnection, undefined, currentPlayingPlaylistIndex, 0); startPlaying(voiceconnection, undefined, currentPlayingPlaylistIndex, 0);
} else { } else {
if (currentPlayingPlaylist.length < playlistIndex) { if (currentPlayingPlaylist.length < playlistIndex) {
@ -66,6 +69,8 @@ function startPlaying (voiceconnection = discordclientmanager.getDiscordClient()
stop(undefined, currentPlayingPlaylist[playlistIndex - 1]); stop(undefined, currentPlayingPlaylist[playlistIndex - 1]);
} }
} else { } else {
log.debug("repeat and sending following payload as reportPlaybackStopped to the server: ",getStopPayload());
jellyfinClientManager.getJellyfinClient().reportPlaybackStopped(getStopPayload());
startPlaying(voiceconnection, undefined, currentPlayingPlaylistIndex + 1, 0); startPlaying(voiceconnection, undefined, currentPlayingPlaylistIndex + 1, 0);
} }
} }
@ -135,6 +140,8 @@ function nextTrack () {
} else if (currentPlayingPlaylistIndex + 1 >= currentPlayingPlaylist.length) { } else if (currentPlayingPlaylistIndex + 1 >= currentPlayingPlaylist.length) {
throw Error("This is the Last song"); throw Error("This is the Last song");
} }
log.debug("sending following payload as reportPlaybackStopped to the server: ",getStopPayload());
jellyfinClientManager.getJellyfinClient().reportPlaybackStopped(getStopPayload()); jellyfinClientManager.getJellyfinClient().reportPlaybackStopped(getStopPayload());
startPlaying(undefined, undefined, currentPlayingPlaylistIndex + 1, 0, _disconnectOnFinish); startPlaying(undefined, undefined, currentPlayingPlaylistIndex + 1, 0, _disconnectOnFinish);
@ -149,6 +156,8 @@ function previousTrack () {
startPlaying(undefined, undefined, currentPlayingPlaylistIndex, 0, _disconnectOnFinish); startPlaying(undefined, undefined, currentPlayingPlaylistIndex, 0, _disconnectOnFinish);
throw Error("This is the First song"); throw Error("This is the First song");
} }
log.debug("sending following payload as reportPlaybackStopped to the server: ",getStopPayload());
jellyfinClientManager.getJellyfinClient().reportPlaybackStopped(getStopPayload()); jellyfinClientManager.getJellyfinClient().reportPlaybackStopped(getStopPayload());
startPlaying(undefined, undefined, currentPlayingPlaylistIndex - 1, 0, _disconnectOnFinish); startPlaying(undefined, undefined, currentPlayingPlaylistIndex - 1, 0, _disconnectOnFinish);
@ -167,7 +176,7 @@ function stop (disconnectVoiceConnection, itemId = getItemId()) {
if (disconnectVoiceConnection) { if (disconnectVoiceConnection) {
disconnectVoiceConnection.disconnect(); disconnectVoiceConnection.disconnect();
} }
log.debug("stop playback and send following payload to the server: ",getStopPayload()); log.debug("stop playback and send following payload as reportPlaybackStopped to the server: ",getStopPayload());
jellyfinClientManager.getJellyfinClient().reportPlaybackStopped(getStopPayload()); jellyfinClientManager.getJellyfinClient().reportPlaybackStopped(getStopPayload());
if (getAudioDispatcher()) { if (getAudioDispatcher()) {
try { try {