Trying to replicate this bash script, any help appreciated #519
Replies: 1 comment 2 replies
-
|
Hi, Since this script involves making many HTTP requests and needs to process the response, it's best to create a "Scripting Shortcut" for this. I'm not too familiar with bash or with the const sabnzbdHost = "";
const apiKey = "";
const httpScheme = "https";
const result = sendHttpRequest(`${httpScheme}://${sabnzbdHost}/sabnzbd/api?apikey=${apiKey}&mode=queue&output=json`);
const responseBody = JSON.parse(result.response.body);
const jobIds = [];
for (slot in responseBody.queue.slots) {
if (slot.status != "Paused") {
jobIds.push(slot.nzo_id);
}
}
for (id in jobIds) {
sendHttpRequest(`${httpScheme}://${sabnzbdHost}/sabnzbd/api?apikey=${apiKey}&mode=queue&name=pause&value=${id}`);
}I have not tested the above, and it does not include any kind of error handling. For debugging purposes, you could insert an More information on Scripting, in particular the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Beta Was this translation helpful? Give feedback.
All reactions