Repository is archived
No commit activity in last 3 years
No release in over 3 years
A fork of transmission-rpc-ruby with shortcut methods and revised codebase.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 12.0
~> 3.5
~> 2.3

Runtime

~> 0.10
 Project Readme

Transmission RPC Ruby Extended

Gem Version Build Status Code Climate Coverage Status Dependency Status Inline docs

This is a fork of transmission-rpc-ruby with some shortcut methods added and revised codebase.

Documentation for the original gem can be found in the upstream repository.

Installation

gem install transmission-rpc-ruby-ext

Then require it

require 'transmission'

If both transmission-rpc-ruby and transmission-rpc-ruby-ext gems are installed, specify the gem to require to avoid namespace conflict.

gem 'transmission-rpc-ruby-ext'
require 'transmission'

Extensions

Transmission selectors

All torrents

Transmission.all

All finished torrents

Transmission.finished

All completed or incomplete torrents

Transmission.completed
Transmission.incomplete

All torrents based on status

Transmission.paused         # status 0
Transmission.queued         # status 3
Transmission.downloading    # status 4    
Transmission.seeding        # status 6

All torrents with error

Transmission.errors

All hashes of all torrents

Transmission.hashes

Find torrents by name, hash, id or tracker

Transmission.find_by_name('ubuntu')
Transmission.find_by_hash('9f9165d9a281a9b8e782cd5176bbcc8256fd1871')
Transmission.find_by_id(1)
Transmission.find_by_tracker('torrent.ubuntu.com')

Torrent status

t = Transmission.all.first

t.paused?
# => false
t.queued?
# => false
t.downloading?
# => true
t.seeding?
# => false
t.finished?
# => false
t.completed?
# => false
t.incomplete?
# => false
t.error?
# => false

Torrent attributes

Basic attributes

t = Transmission.all.first

t.name
# => "ubuntu-16.04.1-desktop-amd64.iso"
t.path
# => "/Users/epistrephein/Downloads/ubuntu-16.04-desktop-amd64.iso"
t.id
# => 1
t.hash
# => "9f9165d9a281a9b8e782cd5176bbcc8256fd1871"

Size

t.length
# => 1513308160
t.valid
# => 582696960
t.percent_downloaded
# => 0.39
t.percent_uploaded
# => 0.0
t.percent_ratio
# => nil

Speed

t.speed_download
# => 14477000
t.speed_upload
# => 0

Ratio & ETA

t.ratio
# => 0.0
t.eta
# => 85

Files and folders

t.file?
# => true
t.folder?
# => false
t.files
# => ["/Users/epistrephein/Downloads/ubuntu-16.04-desktop-amd64.iso"]
t.content
# => ["ubuntu-16.04.1-desktop-amd64.iso"]
t.biggest
# => ["ubuntu-16.04.1-desktop-amd64.iso", 1513308160]
t.smallest
# => ["ubuntu-16.04.1-desktop-amd64.iso", 1513308160]

Peers

t.peers
# => 11
t.peers_seeding
# => 9
t.peers_leeching
# => 0

Errors

t.error
# => nil

Magnet link

t.magnet
# => "magnet:?xt=urn:btih:9f9165d9a281a9b8e782cd5176bbcc8256fd1871&dn=ubuntu-16.04.1-desktop-amd64.iso&tr=http%3A%2F%2Ftorrent.ubuntu.com%3A6969%2Fannounce&tr=http%3A%2F%2Fipv6.torrent.ubuntu.com%3A6969%2Fannounce"

Trackers

t.trackers
# => ["torrent.ubuntu.com", "ipv6.torrent.ubuntu.com"]

Torrent prettified attributes

t.pretty_length
# => "1.51GB"
t.pretty_valid
# => "582.7MB"
t.pretty_eta
# => "1 minutes, 25 seconds"

Torrent actions

t.reload!
t.remove!
t.remove_data!

Contributing

Contributions are welcome and encouraged. Feel free to open an issue or submit a pull request.

License

MIT License