I use the applescript editor and save it as the program "OpenTorrent". Note, this may not be the best code in existance - it's my first attempt at applescript, but it could serve as a good starting point for someone else, and may be useful to enough people i thought i'd post it.
This version works with Transmission 1.53+:
Code: Select all
on open some_items
set transmissionurl to "http://admin:password@your.host.name:9091"
set rpcurl to transmissionurl & "/transmission/rpc"
repeat with this_item in some_items
set filename to POSIX path of this_item
set b64 to do shell script "openssl base64 -e -in " & quoted form of (filename) & " | tr -d \"\\n\" | tr -d \"\\r\" "
set session to do shell script "curl -D - " & rpcurl & " 2>/dev/null | grep '^X-Transmission-Session-Id'"
set json to "{ \"method\": \"torrent-add\", \"arguments\": { \"metainfo\": \"" & b64 & "\" } }"
set result to do shell script "curl -H " & quoted form of (session) & " -d " & quoted form of (json) & " " & rpcurl
end repeat
tell application "Firefox"
OpenURL transmissionurl
end tell
end open
Code: Select all
on open some_items
set transmissionurl to "http://admin:password@your.host.name:9091"
set rpcurl to transmissionurl & "/transmission/rpc"
repeat with this_item in some_items
set filename to POSIX path of this_item
set b64 to do shell script "openssl base64 -e -in " & quoted form of (filename) & " | tr -d \"\\n\" | tr -d \"\\r\" "
set json to "{ \"method\": \"torrent-add\", \"arguments\": { \"metainfo\": \"" & b64 & "\" } }"
set result to do shell script "curl -d " & quoted form of (json) & " " & rpcurl
end repeat
tell application "Firefox"
OpenURL transmissionurl
end tell
end open