Sha256: 2dd4076837f44045f5b44f4bdcc9e7a3038a2a96d5b437fe1262c7e64f193bb7
Contents?: true
Size: 858 Bytes
Versions: 3
Compression:
Stored size: 858 Bytes
Contents
# The main Remote Transmission driver class RemoTransmission::Client < RemoTransmission::Remote # Add a torrent to the transmission client # and prints output. # # Arguments: # url: magnet URL or URL of torrent file # # Example: # >> transmission.add("magnet://..."") # success def add(url) add = super puts add["result"] end # Prints all active torrents # # Example: # >> transmission.list # 100% - ubuntu-10.10-desktop-i386.iso # 100% - ubuntu-10.10-server-i386.iso def list list = super args = list["arguments"] torrents = args["torrents"] torrents.each do |torrent| left = torrent["leftUntilDone"].to_f size = torrent["sizeWhenDone"].to_f pourcent = size != 0 ? ((size-left)*100/size).floor : "?" puts "#{pourcent}% - #{torrent["name"]}" end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
remotransmission-1.0.2 | lib/remotransmission/client.rb |
remotransmission-1.0.1 | lib/remotransmission/client.rb |
remotransmission-1.0.0 | lib/remotransmission/client.rb |