Skip to content

Instantly share code, notes, and snippets.

@droM4X
Last active March 16, 2020 21:56
Show Gist options
  • Save droM4X/e4c5c486ebea0df538f6030091381094 to your computer and use it in GitHub Desktop.
Save droM4X/e4c5c486ebea0df538f6030091381094 to your computer and use it in GitHub Desktop.
Set upload limit to Qbittorrent if Kodi is playing
#!/bin/bash
PLAYING=`curl -s -X POST -H "Content-Type: application/json" -d '{"jsonrpc": "2.0", "method": "Player.GetActivePlayers", "id": 1}' http://localhost:8081/jsonrpc | jq -r '.result'`
if [ ${#PLAYING} -gt 2 ];
then
curl -s -X POST -F 'limit=5192' http://localhost:8080/api/v2/transfer/setUploadLimit
else
curl -s -X POST -F 'limit=NaN' http://localhost:8080/api/v2/transfer/setUploadLimit
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment