Queue 100 songs at a time

This commit is contained in:
RandyTheSilly committed 2026-10-11 17:10:44 -04:00
1 parent 1fb2b35b75
commit f8ef8b5667
1 file changed
+8 -1
+8 -1
View File
@@ -222,6 +222,13 @@ function payloadGet(payload, name) {
return undefined;
}
function ringSlice(arr, start, end) {
const n = arr.length;
if (n === 0) return [];
const count = Math.max(0, end + 1 - start);
return Array.from({ length: count }, (_, k) => arr[(((start + k) % n) + n) % n]);
}
Pebble.addEventListener("appmessage", function (dict) {
//console.log("payload", JSON.stringify(dict.payload));
//console.log("expected NAV_SCOPE key", keys.BIDIR_MENU_NAV_SCOPE);
@@ -231,7 +238,7 @@ Pebble.addEventListener("appmessage", function (dict) {
const seqId = payloadGet(dict.payload, "OUT_PLAY_SEQ_ID");
if (seqId !== undefined) {
callAPI("POST", cfg.PRIV_BASE_URL + "/Sessions/" + jfSessionId + "/Playing?playCommand=PlayNow&itemIds=" + allJfIds[seqId], null);
callAPI("POST", cfg.PRIV_BASE_URL + "/Sessions/" + jfSessionId + "/Playing?playCommand=PlayNow&itemIds=" + ringSlice(allJfIds, seqId, seqId+99), null);
}
if (scope !== undefined) {