mirror of
https://github.com/informaticker/discord-jellyfin-bot.git
synced 2024-11-23 18:21:55 +01:00
report position ticks with playback stop
This commit is contained in:
parent
9ec2d2aa73
commit
e895e849a2
@ -129,6 +129,8 @@ function nextTrack () {
|
||||
} else if (currentPlayingPlaylistIndex + 1 >= currentPlayingPlaylist.length) {
|
||||
throw Error("This is the Last song");
|
||||
}
|
||||
jellyfinClientManager.getJellyfinClient().reportPlaybackStopped(getStopPayload());
|
||||
|
||||
startPlaying(undefined, undefined, currentPlayingPlaylistIndex + 1, 0, _disconnectOnFinish);
|
||||
}
|
||||
|
||||
@ -140,6 +142,8 @@ function previousTrack () {
|
||||
startPlaying(undefined, undefined, currentPlayingPlaylistIndex, 0, _disconnectOnFinish);
|
||||
throw Error("This is the First song");
|
||||
}
|
||||
jellyfinClientManager.getJellyfinClient().reportPlaybackStopped(getStopPayload());
|
||||
|
||||
startPlaying(undefined, undefined, currentPlayingPlaylistIndex - 1, 0, _disconnectOnFinish);
|
||||
}
|
||||
}
|
||||
@ -155,11 +159,7 @@ function stop (disconnectVoiceConnection, itemId = getItemId()) {
|
||||
if (disconnectVoiceConnection) {
|
||||
disconnectVoiceConnection.disconnect();
|
||||
}
|
||||
jellyfinClientManager.getJellyfinClient().reportPlaybackStopped({
|
||||
userId: jellyfinClientManager.getJellyfinClient().getCurrentUserId(),
|
||||
itemId: itemId,
|
||||
playSessionId: getPlaySessionId()
|
||||
});
|
||||
jellyfinClientManager.getJellyfinClient().reportPlaybackStopped(getStopPayload());
|
||||
if (getAudioDispatcher()) {
|
||||
try {
|
||||
getAudioDispatcher().destroy();
|
||||
@ -285,6 +285,17 @@ function getProgressPayload () {
|
||||
return payload;
|
||||
}
|
||||
|
||||
function getStopPayload () {
|
||||
const payload = {
|
||||
userId: jellyfinClientManager.getJellyfinClient().getCurrentUserId(),
|
||||
itemId: getItemId(),
|
||||
sessionID: getPlaySessionId(),
|
||||
playSessionId: getPlaySessionId(),
|
||||
positionTicks: getPostitionTicks()
|
||||
};
|
||||
return payload;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
startPlaying,
|
||||
stop,
|
||||
|
Loading…
Reference in New Issue
Block a user