Module: C3D

Extended by:
C3D
Included in:
C3D
Defined in:
lib/c3d/util/blobber.rb,
lib/c3d.rb,
lib/c3d/util/util.rb,
lib/c3d/util/setup.rb,
lib/c3d/util/trees.rb,
lib/c3d/util/watch.rb,
lib/c3d/util/purger.rb,
lib/c3d/actors/getter.rb,
lib/c3d/actors/crawler.rb,
lib/c3d/util/processes.rb,
lib/c3d/actors/assemble.rb,
lib/c3d/actors/blacklist.rb,
lib/c3d/actors/subscribe.rb,
lib/c3d/connectors/connect_torrent.rb,
lib/c3d/connectors/connect_ethereum.rb

Overview

This is based off of work by fguillen for the transmission_api gem here: github.com/fguillen/TransmissionApi

Defined Under Namespace

Modules: EthRunner, EyeOfZorax, Getter, TransmissionRunner, Utility Classes: Assemble, Blacklist, Blobber, ConnectEth, ConnectTorrent, Crawler, Purger, SetupC3D, Subscribe, TreeBuilder

Instance Method Summary collapse

Instance Method Details

#blob(args) ⇒ Object



54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/c3d.rb', line 54

def blob args
  C3D::SetupC3D.new true
  C3D::ConnectTorrent.supervise_as :puller, {
      username: ENV['TORRENT_USER'],
      password: ENV['TORRENT_PASS'],
      url:      ENV['TORRENT_RPC'] }
  until args.empty?
    file = args.shift
    c = C3D::Blobber.new file
    print "The magnet link for the file is: #{c.mag_link}\n"
  end
end

#ignore(args) ⇒ Object



81
82
83
84
85
86
# File 'lib/c3d.rb', line 81

def ignore args
  until args.empty?
    contract = args.shift
    C3D::EyeOfZorax.ignore contract
  end
end

#restartObject



48
49
50
51
52
# File 'lib/c3d.rb', line 48

def restart
  key = Celluloid::Actor[:eth].get_key
  C3D.stop
  C3D.start key
end

#start(key = '', cli = false) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/c3d.rb', line 28

def start key='', cli=false
  unless key == ''
    ENV['ETH_KEY'] = key
  end
  C3D::SetupC3D.new cli
  C3D::ConnectTorrent.supervise_as :puller, {
      username: ENV['TORRENT_USER'],
      password: ENV['TORRENT_PASS'],
      url:      ENV['TORRENT_RPC'] }
  C3D::ConnectEth.supervise_as :eth, :cpp
  C3D::Utility.save_key
  timers = Timers.new
  every_minute = timers.every(60) { C3D::Subscribe.new }
  loop { timers.wait }
end

#stopObject



44
45
46
# File 'lib/c3d.rb', line 44

def stop
  exit 0
end

#subscribe(args) ⇒ Object



67
68
69
70
71
72
# File 'lib/c3d.rb', line 67

def subscribe args
  until args.empty?
    contract = args.shift
    C3D::EyeOfZorax.subscribe contract
  end
end

#unignore(args) ⇒ Object



88
89
90
91
92
93
# File 'lib/c3d.rb', line 88

def unignore args
  until args.empty?
    contract = args.shift
    C3D::EyeOfZorax.unignore contract
  end
end

#unsubscribe(args) ⇒ Object



74
75
76
77
78
79
# File 'lib/c3d.rb', line 74

def unsubscribe args
  until args.empty?
    contract = args.shift
    C3D::EyeOfZorax.unsubscribe contract
  end
end

#versionObject



95
96
97
# File 'lib/c3d.rb', line 95

def version
  return VERSION
end