#!/bin/bash USER=yourUserName PASS=yourPassword server=http://yourTransmissionHostIP speed=$1 curlout=$(curl -u $USER:$PASS ${server}:9091/transmission/rpc 2>/dev/null) regex='(X-Transmission-Session-Id\: )([^<]*)' if [[ $curlout =~ $regex ]]; then sessionid=${BASH_REMATCH[2]} else exit 1 fi if [ $# -eq 0 ] ; then data='{"method": "session-set", "arguments": { "speed-limit-down-enabled" : false } }' else data='{"method": "session-set", "arguments": { "speed-limit-down-enabled" : true, "speed-limit-down" :' data="$data ${speed} } }" fi curl -u $USER:$PASS ${server}:9091/transmission/rpc -d "$data" -H "X-Transmission-Session-Id: $sessionid" > /dev/null 2>&1
Pingback: JSON adatbányászat shellben | eFi.blog