#!/bin/bash
# transmission-remote-magnet
# Usage: transmission-remote-magnet <magnet URL>

[ -z "$1" ] && exit 1
SESSID="$(curl -sI http://localhost:9091/bt/rpc/  | grep 'X-Transmission-Session-Id' | tr -d '\r')"
curl -s -H "$SESSID" -d "{\"method\":\"torrent-add\",\"arguments\":{\"filename\":\"${1}\"}}" http://localhost:9091/bt/rpc
