Class: Torrent
Class Method Summary collapse
Class Method Details
.download(link, http_options = {}, options = {}) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/torrent.rb', line 7 def self.download(link, = {}, = {}) return if [:dry_run] uri = URI.parse(link) download_dir = .delete(:download_dir) torrent = uri.read() t = Transmission::Client.new([:transmission_server], [:transmission_port]) t.add_torrent('metainfo' => Base64.encode64(torrent), 'download-dir' => download_dir) end |