c3d 0.4.7 → 0.4.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/c3d.rb +2 -7
- data/lib/c3d/actors/assemble.rb +2 -2
- data/lib/c3d/actors/crawler.rb +1 -1
- data/lib/c3d/actors/getter.rb +1 -1
- data/lib/c3d/util/blobber.rb +1 -1
- data/lib/c3d/util/purger.rb +2 -2
- data/lib/c3d/util/trees.rb +2 -2
- data/lib/c3d/util/util.rb +1 -1
- data/lib/c3d/version.rb +1 -1
- data/spec/spec_helper.rb +1 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 186a27dd5c70f1d4b4fd474b699fc194e588fea0
|
4
|
+
data.tar.gz: 1b60ed82f414718ca74112ca74407e7ba9922763
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ecda352a43aa3ef2c4338ea1258b1e17e6edaf241df0bcb59de5d4f0acd7b80221f393f12595854faaad1b658e03037cffc5dc182caae3c0105076e0cdd9df4
|
7
|
+
data.tar.gz: 5ebc156d74ce1f539608b57587e9dbddaca4cafee7ffdea1ea3243c76faaa0004dbabeb39bf4b8a4bf410ec6de49cceeffca9f128fa51452f32d606ffa0728d1
|
data/lib/c3d.rb
CHANGED
@@ -31,11 +31,6 @@ module C3D
|
|
31
31
|
password: ENV['TORRENT_PASS'],
|
32
32
|
url: ENV['TORRENT_RPC'] }
|
33
33
|
C3D::ConnectEth.supervise_as :eth, :cpp
|
34
|
-
|
35
|
-
# todo, need to trap_exit on these actors if they crash
|
36
|
-
$puller = Celluloid::Actor[:puller]
|
37
|
-
$eth = Celluloid::Actor[:eth]
|
38
|
-
|
39
34
|
C3D::Utility.save_key
|
40
35
|
sleep
|
41
36
|
end
|
@@ -51,10 +46,10 @@ module C3D
|
|
51
46
|
|
52
47
|
def blob args
|
53
48
|
C3D::SetupC3D.new
|
54
|
-
|
49
|
+
C3D::ConnectTorrent.supervise_as :puller, {
|
50
|
+
username: ENV['TORRENT_USER'],
|
55
51
|
password: ENV['TORRENT_PASS'],
|
56
52
|
url: ENV['TORRENT_RPC'] }
|
57
|
-
$puller = C3D::ConnectTorrent.new opts
|
58
53
|
until args.empty?
|
59
54
|
file = args.shift
|
60
55
|
c = C3D::Blobber.new file
|
data/lib/c3d/actors/assemble.rb
CHANGED
@@ -80,7 +80,7 @@ module C3D
|
|
80
80
|
end
|
81
81
|
|
82
82
|
def send_query contract, storage
|
83
|
-
|
83
|
+
Celluloid::Actor[:eth].get_storage_at contract, storage
|
84
84
|
end
|
85
85
|
|
86
86
|
def ab? contract
|
@@ -117,7 +117,7 @@ module C3D
|
|
117
117
|
end
|
118
118
|
else
|
119
119
|
link = "magnet:?xt=urn:btih:" + btih + "&dn=" + dn
|
120
|
-
torrent =
|
120
|
+
torrent = Celluloid::Actor[:puller].create link
|
121
121
|
@content << { contract => "currently acquiring please check back." }
|
122
122
|
end
|
123
123
|
return false
|
data/lib/c3d/actors/crawler.rb
CHANGED
data/lib/c3d/actors/getter.rb
CHANGED
@@ -11,7 +11,7 @@ module C3D
|
|
11
11
|
btih = blob_id[0..39]
|
12
12
|
dn = blob_id[40..-1]
|
13
13
|
mag_link = "magnet:?xt=urn:btih:" + btih + "&dn=" + dn
|
14
|
-
|
14
|
+
Celluloid::Actor[:puller].create mag_link
|
15
15
|
puts "[C3D::#{Time.now.strftime( "%F %T" )}] Getting >>\t\t" + mag_link
|
16
16
|
end
|
17
17
|
end
|
data/lib/c3d/util/blobber.rb
CHANGED
data/lib/c3d/util/purger.rb
CHANGED
@@ -7,9 +7,9 @@ module C3D
|
|
7
7
|
def initialize blob
|
8
8
|
begin
|
9
9
|
dn = blob[14..-1]
|
10
|
-
currently_downloading =
|
10
|
+
currently_downloading = Celluloid::Actor[:puller].all
|
11
11
|
downloading = currently_downloading.select{|t| t["name"] == dn}.first["id"]
|
12
|
-
|
12
|
+
Celluloid::Actor[:puller].destroy downloading if downloading
|
13
13
|
blob_file = File.join(ENV['BLOBS_DIR'], dn)
|
14
14
|
if File.exists? blob_file
|
15
15
|
File.delete blob_file
|
data/lib/c3d/util/trees.rb
CHANGED
@@ -148,7 +148,7 @@ module C3D
|
|
148
148
|
end
|
149
149
|
|
150
150
|
def send_query contract, storage
|
151
|
-
|
151
|
+
Celluloid::Actor[:eth].get_storage_at contract, storage
|
152
152
|
end
|
153
153
|
|
154
154
|
def ab? contract
|
@@ -185,7 +185,7 @@ module C3D
|
|
185
185
|
btih = blob[2..41]
|
186
186
|
dn = blob[42..-1]
|
187
187
|
link = "magnet:?xt=urn:btih:" + btih + "&dn=" + dn
|
188
|
-
torrent =
|
188
|
+
torrent = Celluloid::Actor[:puller].create link
|
189
189
|
return true
|
190
190
|
rescue
|
191
191
|
return false
|
data/lib/c3d/util/util.rb
CHANGED
@@ -5,7 +5,7 @@ module C3D
|
|
5
5
|
extend self
|
6
6
|
|
7
7
|
def save_key
|
8
|
-
key =
|
8
|
+
key = Celluloid::Actor[:eth].get_key
|
9
9
|
config_file = File.join(ENV['HOME'], '.epm', 'c3d-config.json')
|
10
10
|
config = JSON.load(File.read(config_file))
|
11
11
|
config["primary_account_key"] = key if config["primary_account_key"] != key
|
data/lib/c3d/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
VERSION ||= "0.4.
|
1
|
+
VERSION ||= "0.4.9"
|
data/spec/spec_helper.rb
CHANGED
@@ -22,10 +22,7 @@ def get_set_up
|
|
22
22
|
username: ENV['TORRENT_USER'],
|
23
23
|
password: ENV['TORRENT_PASS'],
|
24
24
|
url: ENV['TORRENT_RPC'] }
|
25
|
-
$puller = Celluloid::Actor[:puller]
|
26
|
-
|
27
25
|
C3D::ConnectEth.supervise_as :eth, :cpp
|
28
|
-
$eth = Celluloid::Actor[:eth]
|
29
26
|
|
30
27
|
unless check_for_doug
|
31
28
|
print "\nThere is No DOUG. Please Fix That."
|
@@ -43,7 +40,7 @@ def check_for_doug
|
|
43
40
|
log = File.read log_file
|
44
41
|
doug = log.split("\n").map{|l| l.split(',')}.select{|l| l[0] == ("Doug" || "DOUG" || "doug")}[-1][-1]
|
45
42
|
end
|
46
|
-
doug_check =
|
43
|
+
doug_check = Celluloid::Actor[:eth]h.get_storage_at doug, '0x10'
|
47
44
|
if doug_check != '0x'
|
48
45
|
return true
|
49
46
|
else
|