Jump to content

Load a .torrent file


neub

Recommended Posts

Posted

Hello I would like to know if someone can help to write a script to load .torrent files.

when i was using mldonkey I had created this script to simply load torrent, I was wondering if someone know the argument to load a .torrent file from the computer using the webUI.

#!/bin/bash

#

# Script to be called by web browser to load torrents to mldonkey

#

# Created by Neub

#

# This is setup for mldonkey running as daemon process as

# user mldonkey. As configured by mldonkey-init.

user=admin

server=neubserver

port=8080

echo "google-chrome http://$user@$server:$port/submit?jvcmd=multidllink&links=$1"

google-chrome "http://$server:$port/submit?jvcmd=multidllink&links=$1"

----------------------------------------

Another question Is that It might be more interesting to use magnet link but I have no idea to make it work with uTorrent.

Posted

The easiest way to "load" a torrent file is to put it in the autoload directory :)

Just quickly, I can offer this script that sends a URL (magnet link or file URL) to utserver:

#!/bin/bash

rm ~/.utorrent/curl.sh 2> /dev/null

# Get token
export token=$(curl -G -s -c ~/.utorrent/ucookie.txt -n http://192.168.0.4:9091/gui/token.html|sed 's/<[^<>]*>//g')
# echo $token

# Add URL
curl -G -s -n -b ~/.utorrent/ucookie.txt -d token=$token -d action=add-url -d s="$1" http://192.168.0.4:9091/gui/

It is also possible to send the actual contents of an existing file directly to utserver in the same way. I haven't tested this so I don't post the exact command, but you would need to use the --form option to curl in order to pass a form field name of type "file" and name "torrent_file" with a value of the filename to be loaded. The action is add-file instead of add-url. Possibly the command would be this (untested!):

curl -G -s -n -b ~/.utorrent/ucookie.txt -d token=$token -d action=add-file -F torrent_file=@/home/you/whatever.torrent http://192.168.0.4:9091/gui/

P.S. I can't see the full width of the code lines in my browser. I hope you can.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...