GithubHelp home page GithubHelp logo

digideskio / bittorrent-client Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jarred-sumner/transmission-rpc

0.0 1.0 0.0 213 KB

Control the Transmission BitTorrent client from Ruby

License: MIT License

Ruby 100.00%

bittorrent-client's Introduction

Transmission::RPC

A simplistic Transmission RPC client for Ruby. It implements part of RPC 1.7.x.

You can:

  • Add a torrent by URL or file path
  • Start a torrent
  • Stop a torrent
  • Get all torrents
  • Delete torrents from Transmission and from disk

Installation

Add this line to your application's Gemfile:

gem 'transmission-rpc'

And then execute:

$ bundle

Or install it yourself as:

$ gem install transmission-rpc

It depends on transmission-daemon. Install it from homebrew:

$ brew install transmission

transmission-daemon must be running, run it like so:

$ transmission-daemon

Usage

To add a torrent by URL or file path:

Transmission::RPC::Torrent + "http://example.com/url/to/torrent.torrent"

To add a torrent by metainfo:

require 'base64'
f = File.open "moo.torrent"
Transmission::RPC::Torrent.add({:metainfo => Base64.strict_encode(f.read)})

To set specific options for torrent file:

Transmission::RPC::Torrent.add({
  :filename => "http://example.com/url/to/torrent.torrent",
  :download_dir => "path/to/downloaded/files",
  :paused => true
})

To start all torrents:

Transmission::RPC::Torrent.start!

To stop all torrents:

Transmission::RPC::Torrent.stop!

To get all torrents:

Transmission.torrents

To start a specific torrent:

Transmission.torrents.first.start!

To stop a specific torrent:

Transmission.torrents.first.stop!

To move an existing torrent:

Transmission.torrents.first.move! '/path/to/new/location'

To delete a torrent:

Transmission.torrents.first.delete!

To delete a torrent and delete the contents from disk:

Transmission.torrents.first.delete!(true)

bittorrent-client's People

Contributors

chrome avatar eargollo avatar jamesdabbs avatar jarred-sumner avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.