zer0 revised this gist 3 hours ago. Go to revision
1 file changed, 17 insertions
sab_assign_cat.sh(file created)
| @@ -0,0 +1,17 @@ | |||
| 1 | + | #!/usr/bin/zsh | |
| 2 | + | ||
| 3 | + | # ==== Configuration ==== | |
| 4 | + | SABNZBD_HOST="" # IP or FQDN with port if on non-standard port | |
| 5 | + | API_KEY="" # API key | |
| 6 | + | HTTP_SCHEME="" # http or https | |
| 7 | + | ||
| 8 | + | # ==== Extract Job IDs ==== | |
| 9 | + | JOB_IDS=($(curl -s "$HTTP_SCHEME://$SABNZBD_HOST/api?apikey=$API_KEY&mode=queue&output=json" | jq -r '.queue.slots[] | select(.cat != "mycat") | .nzo_id')) | |
| 10 | + | ||
| 11 | + | # ==== Pause Each Job ==== | |
| 12 | + | for ID in $JOB_IDS; do | |
| 13 | + | curl -s "$HTTP_SCHEME://$SABNZBD_HOST/api?apikey=$API_KEY&mode=change_cat&value=$ID&value2=mycat" > /dev/null | |
| 14 | + | echo "Changed cat: $ID" | |
| 15 | + | done | |
| 16 | + | ||
| 17 | + | echo "All queue items set to new cat." | |
Newer
Older