This gem is used to utilise the µTorrent 2.0 (or above) webapi
It uses the new authentication mechanism, also you can find the api reference.
Add this line to your application's Gemfile:
gem 'utorrent-webapi-ruby', git: '[email protected]:PeterWuMC/utorrent-webapi-ruby.git'
require 'u_torrent'
configuration = UTorrent::Configuration.new
configuration.url = '192.168.2.100'
configuration.port = '8085'
configuration.username = 'admin'
configuration.password = 'password'
configuration.logger = Logger.new(path)
UTorrent.configuration = configuration
The current version only support the following actions
- Only support HTTP
- Querying torrents attributes
- Perform the following actions to torrent:
start, stop, force_start, pause, unpause, recheck, remove, remove_data
- Querying files within a specific torrent attributes
- Add new torrent using with url or magnet
- Updating a file priority
- As of the current version, it does not have any error handling. Also the token is only valid for 30 minutes and it does not get automatically renewed.
UTorrent::Torrent.all
UTorrent::Torrent.find(HASH)
method | explain |
---|---|
id | torrent HASH |
name | torrent name |
size | torrent total size |
downloaded | total downloaded of the torrent in BYTES |
uploaded | total uploaded of the torrent in BYTES |
ratio | torrent ratio |
upload_speed | current upload seed of the torrent (BYTES per SECOND) |
download_speed | current download seed of the torrent (BYTES per SECOND) |
eta | ETA of the torrent in SECONDS |
statuses | list out all the statuses it was in |
status | the current status of the torrent |
percentage | the current completed percentage of the torrent |
label | the current label of the torrent |
peers_connected | |
peers_in_swarm | |
seeds_connected | |
seeds_in_swarm | |
availability | |
queue_order | current queue order of the torrent |
remaining | reminding BYTES |
url | the original torrent url if it was added from url |
current_directory | current location of the downloaded files |
method | explain |
---|---|
label= | set label for the torrent |
start! | start the torrent |
stop! | stop the torrent |
force_start! | force start the torrent, event it reaches maximum downloads |
pause! | pause the torrent |
unpause! | unpause the torrent |
recheck! | recheck the torrent |
remove! | remove the torrent |
remove_data! | remove the torrent and delete the data |
finished? | true if the torrent current status is Finished |
downloading? | true if the torrent current status is Downloading |
seeding? | true if the torrent current status is Seeding |
refresh! | reload the torrent information |
files | list all files of the torrent |
UTorrent::Torrent#files
method | explain |
---|---|
name | file name |
size | file size |
downloaded | total downloaded of the file in BYTES |
priority | current priority of the file |
priority_display_value | {0 => "Don't Download", 1 => 'Low Priority', 2 => 'Normal Priority', 3 => 'High Priority'} |
method | explain |
---|---|
priority= | set priority of the file |
skip! | set the file priority to 0 |
skipped? | true if the file priority is 0 |
refresh! | reload the file information |