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) {
|
} else if (currentPlayingPlaylistIndex + 1 >= currentPlayingPlaylist.length) {
|
||||||
throw Error("This is the Last song");
|
throw Error("This is the Last song");
|
||||||
}
|
}
|
||||||
|
jellyfinClientManager.getJellyfinClient().reportPlaybackStopped(getStopPayload());
|
||||||
|
|
||||||
startPlaying(undefined, undefined, currentPlayingPlaylistIndex + 1, 0, _disconnectOnFinish);
|
startPlaying(undefined, undefined, currentPlayingPlaylistIndex + 1, 0, _disconnectOnFinish);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,6 +142,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");
|
||||||
}
|
}
|
||||||
|
jellyfinClientManager.getJellyfinClient().reportPlaybackStopped(getStopPayload());
|
||||||
|
|
||||||
startPlaying(undefined, undefined, currentPlayingPlaylistIndex - 1, 0, _disconnectOnFinish);
|
startPlaying(undefined, undefined, currentPlayingPlaylistIndex - 1, 0, _disconnectOnFinish);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -155,11 +159,7 @@ function stop (disconnectVoiceConnection, itemId = getItemId()) {
|
|||||||
if (disconnectVoiceConnection) {
|
if (disconnectVoiceConnection) {
|
||||||
disconnectVoiceConnection.disconnect();
|
disconnectVoiceConnection.disconnect();
|
||||||
}
|
}
|
||||||
jellyfinClientManager.getJellyfinClient().reportPlaybackStopped({
|
jellyfinClientManager.getJellyfinClient().reportPlaybackStopped(getStopPayload());
|
||||||
userId: jellyfinClientManager.getJellyfinClient().getCurrentUserId(),
|
|
||||||
itemId: itemId,
|
|
||||||
playSessionId: getPlaySessionId()
|
|
||||||
});
|
|
||||||
if (getAudioDispatcher()) {
|
if (getAudioDispatcher()) {
|
||||||
try {
|
try {
|
||||||
getAudioDispatcher().destroy();
|
getAudioDispatcher().destroy();
|
||||||
@ -285,6 +285,17 @@ function getProgressPayload () {
|
|||||||
return payload;
|
return payload;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getStopPayload () {
|
||||||
|
const payload = {
|
||||||
|
userId: jellyfinClientManager.getJellyfinClient().getCurrentUserId(),
|
||||||
|
itemId: getItemId(),
|
||||||
|
sessionID: getPlaySessionId(),
|
||||||
|
playSessionId: getPlaySessionId(),
|
||||||
|
positionTicks: getPostitionTicks()
|
||||||
|
};
|
||||||
|
return payload;
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
startPlaying,
|
startPlaying,
|
||||||
stop,
|
stop,
|
||||||
|
Loading…
Reference in New Issue
Block a user