ruby_bittorrent 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.rdoc +14 -0
- data/VERSION +1 -1
- data/lib/bit_torrent.rb +2 -0
- data/ruby_bittorrent.gemspec +2 -2
- data/spec/bit_torrent_spec.rb +17 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: adfade802f9c86624fce5934f1a9be2fe483a407
|
4
|
+
data.tar.gz: acdcefda1479c172da244857065f42f3704643c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c234f3868aecc7c25667af2402fc2a370bac363eeb614cbb55464fa4828fef7ed44686abf178f32721b9e6566408ceb096c171f2285309cc4f0387d110290a10
|
7
|
+
data.tar.gz: 48bff1f530ec403bb2e53df2cff0bc1e9450f8ebedf349be33960849de8f4bb61525dbde0db86c62ff403f7d57d8d73c6f3d5f3892ccb0d4e62f4c42e5aa6736
|
data/README.rdoc
CHANGED
@@ -5,6 +5,20 @@ Ruby bittorrent download cli.
|
|
5
5
|
= requirements
|
6
6
|
Installed aria2 package in system (with bittorrent support).
|
7
7
|
|
8
|
+
= example usage (full possible options included)
|
9
|
+
require 'ruby_bittorrent'
|
10
|
+
|
11
|
+
manget_link = 'magnet:?xt=urn:btih:whatever'
|
12
|
+
BITTORRENT_OPTIONS = {
|
13
|
+
:upload_rate_limit => '100K',
|
14
|
+
:seed_ratio => 2.5,
|
15
|
+
:seed_time => 2880, # minutes
|
16
|
+
:connect_timeout => 120,
|
17
|
+
:timeout => 120,
|
18
|
+
:stop_timeout => 0,
|
19
|
+
:destination_directory => "#{ENV['HOME']}/Downloads"
|
20
|
+
}
|
21
|
+
BitTorrent.download!(manget_link, BITTORRENT_OPTIONS)
|
8
22
|
|
9
23
|
== Contributing to ruby_bittorrent
|
10
24
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.1
|
data/lib/bit_torrent.rb
CHANGED
@@ -6,6 +6,7 @@ class BitTorrent
|
|
6
6
|
DEFAULTS = {
|
7
7
|
:upload_rate_limit => 0,
|
8
8
|
:seed_ratio => 1.5,
|
9
|
+
:seed_time => 1440, # minutes
|
9
10
|
:connect_timeout => 60,
|
10
11
|
:timeout => 60,
|
11
12
|
:stop_timeout => 0,
|
@@ -51,6 +52,7 @@ class BitTorrent
|
|
51
52
|
'--enable-peer-exchange=true',
|
52
53
|
"--max-overall-upload-limit=#{upload_rate_limit}",
|
53
54
|
"--seed-ratio=#{seed_ratio}",
|
55
|
+
"--seed-time=#{seed_time}",
|
54
56
|
"--bt-tracker-connect-timeout=#{connect_timeout}",
|
55
57
|
"--bt-tracker-timeout=#{timeout}",
|
56
58
|
"--bt-stop-timeout=#{stop_timeout}",
|
data/ruby_bittorrent.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "ruby_bittorrent"
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.0.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Marcin Nowicki"]
|
12
|
-
s.date = "2013-08-
|
12
|
+
s.date = "2013-08-25"
|
13
13
|
s.description = "Ruby bittorrent download cli."
|
14
14
|
s.email = "pr0d1r2@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
data/spec/bit_torrent_spec.rb
CHANGED
@@ -13,19 +13,20 @@ describe BitTorrent do
|
|
13
13
|
|
14
14
|
its(:upload_rate_limit) { should == 0 }
|
15
15
|
its(:seed_ratio) { 1.5 }
|
16
|
+
its(:seed_time) { 1440 }
|
16
17
|
its(:connect_timeout) { 60 }
|
17
18
|
its(:timeout) { 60 }
|
18
19
|
its(:stop_timeout) { 0 }
|
19
20
|
its(:destination_directory) { "." }
|
20
21
|
|
21
|
-
its(:download_commmand) { should == "aria2c --dir=. --bt-enable-lpd --bt-min-crypto-level=arc4 --bt-require-crypto=true --enable-dht=true --enable-peer-exchange=true --max-overall-upload-limit=0 --seed-ratio=1.5 --bt-tracker-connect-timeout=60 --bt-tracker-timeout=60 --bt-stop-timeout=0 '#{source}'" }
|
22
|
+
its(:download_commmand) { should == "aria2c --dir=. --bt-enable-lpd --bt-min-crypto-level=arc4 --bt-require-crypto=true --enable-dht=true --enable-peer-exchange=true --max-overall-upload-limit=0 --seed-ratio=1.5 --seed-time=1440 --bt-tracker-connect-timeout=60 --bt-tracker-timeout=60 --bt-stop-timeout=0 '#{source}'" }
|
22
23
|
|
23
24
|
context "when change upload rate limit" do
|
24
25
|
let(:options) { {:upload_rate_limit => "5K" } }
|
25
26
|
|
26
27
|
its(:upload_rate_limit) { should == "5K" }
|
27
28
|
|
28
|
-
its(:download_commmand) { should == "aria2c --dir=. --bt-enable-lpd --bt-min-crypto-level=arc4 --bt-require-crypto=true --enable-dht=true --enable-peer-exchange=true --max-overall-upload-limit=5K --seed-ratio=1.5 --bt-tracker-connect-timeout=60 --bt-tracker-timeout=60 --bt-stop-timeout=0 '#{source}'" }
|
29
|
+
its(:download_commmand) { should == "aria2c --dir=. --bt-enable-lpd --bt-min-crypto-level=arc4 --bt-require-crypto=true --enable-dht=true --enable-peer-exchange=true --max-overall-upload-limit=5K --seed-ratio=1.5 --seed-time=1440 --bt-tracker-connect-timeout=60 --bt-tracker-timeout=60 --bt-stop-timeout=0 '#{source}'" }
|
29
30
|
end
|
30
31
|
|
31
32
|
context "when change seed ratio" do
|
@@ -33,7 +34,15 @@ describe BitTorrent do
|
|
33
34
|
|
34
35
|
its(:seed_ratio) { should == 1 }
|
35
36
|
|
36
|
-
its(:download_commmand) { should == "aria2c --dir=. --bt-enable-lpd --bt-min-crypto-level=arc4 --bt-require-crypto=true --enable-dht=true --enable-peer-exchange=true --max-overall-upload-limit=0 --seed-ratio=1 --bt-tracker-connect-timeout=60 --bt-tracker-timeout=60 --bt-stop-timeout=0 '#{source}'" }
|
37
|
+
its(:download_commmand) { should == "aria2c --dir=. --bt-enable-lpd --bt-min-crypto-level=arc4 --bt-require-crypto=true --enable-dht=true --enable-peer-exchange=true --max-overall-upload-limit=0 --seed-ratio=1 --seed-time=1440 --bt-tracker-connect-timeout=60 --bt-tracker-timeout=60 --bt-stop-timeout=0 '#{source}'" }
|
38
|
+
end
|
39
|
+
|
40
|
+
context "when change seed time" do
|
41
|
+
let(:options) { {:seed_time => 2880 } }
|
42
|
+
|
43
|
+
its(:seed_time) { should == 2880 }
|
44
|
+
|
45
|
+
its(:download_commmand) { should == "aria2c --dir=. --bt-enable-lpd --bt-min-crypto-level=arc4 --bt-require-crypto=true --enable-dht=true --enable-peer-exchange=true --max-overall-upload-limit=0 --seed-ratio=1.5 --seed-time=2880 --bt-tracker-connect-timeout=60 --bt-tracker-timeout=60 --bt-stop-timeout=0 '#{source}'" }
|
37
46
|
end
|
38
47
|
|
39
48
|
context "when change connect timeout" do
|
@@ -41,7 +50,7 @@ describe BitTorrent do
|
|
41
50
|
|
42
51
|
its(:connect_timeout) { should == 120 }
|
43
52
|
|
44
|
-
its(:download_commmand) { should == "aria2c --dir=. --bt-enable-lpd --bt-min-crypto-level=arc4 --bt-require-crypto=true --enable-dht=true --enable-peer-exchange=true --max-overall-upload-limit=0 --seed-ratio=1.5 --bt-tracker-connect-timeout=120 --bt-tracker-timeout=60 --bt-stop-timeout=0 '#{source}'" }
|
53
|
+
its(:download_commmand) { should == "aria2c --dir=. --bt-enable-lpd --bt-min-crypto-level=arc4 --bt-require-crypto=true --enable-dht=true --enable-peer-exchange=true --max-overall-upload-limit=0 --seed-ratio=1.5 --seed-time=1440 --bt-tracker-connect-timeout=120 --bt-tracker-timeout=60 --bt-stop-timeout=0 '#{source}'" }
|
45
54
|
end
|
46
55
|
|
47
56
|
context "when change timeout" do
|
@@ -49,7 +58,7 @@ describe BitTorrent do
|
|
49
58
|
|
50
59
|
its(:timeout) { should == 120 }
|
51
60
|
|
52
|
-
its(:download_commmand) { should == "aria2c --dir=. --bt-enable-lpd --bt-min-crypto-level=arc4 --bt-require-crypto=true --enable-dht=true --enable-peer-exchange=true --max-overall-upload-limit=0 --seed-ratio=1.5 --bt-tracker-connect-timeout=60 --bt-tracker-timeout=120 --bt-stop-timeout=0 '#{source}'" }
|
61
|
+
its(:download_commmand) { should == "aria2c --dir=. --bt-enable-lpd --bt-min-crypto-level=arc4 --bt-require-crypto=true --enable-dht=true --enable-peer-exchange=true --max-overall-upload-limit=0 --seed-ratio=1.5 --seed-time=1440 --bt-tracker-connect-timeout=60 --bt-tracker-timeout=120 --bt-stop-timeout=0 '#{source}'" }
|
53
62
|
end
|
54
63
|
|
55
64
|
context "when change stop timeout" do
|
@@ -57,7 +66,7 @@ describe BitTorrent do
|
|
57
66
|
|
58
67
|
its(:stop_timeout) { should == 120 }
|
59
68
|
|
60
|
-
its(:download_commmand) { should == "aria2c --dir=. --bt-enable-lpd --bt-min-crypto-level=arc4 --bt-require-crypto=true --enable-dht=true --enable-peer-exchange=true --max-overall-upload-limit=0 --seed-ratio=1.5 --bt-tracker-connect-timeout=60 --bt-tracker-timeout=60 --bt-stop-timeout=120 '#{source}'" }
|
69
|
+
its(:download_commmand) { should == "aria2c --dir=. --bt-enable-lpd --bt-min-crypto-level=arc4 --bt-require-crypto=true --enable-dht=true --enable-peer-exchange=true --max-overall-upload-limit=0 --seed-ratio=1.5 --seed-time=1440 --bt-tracker-connect-timeout=60 --bt-tracker-timeout=60 --bt-stop-timeout=120 '#{source}'" }
|
61
70
|
end
|
62
71
|
|
63
72
|
context "when change destination directory" do
|
@@ -65,7 +74,7 @@ describe BitTorrent do
|
|
65
74
|
|
66
75
|
its(:destination_directory) { should == "/tmp" }
|
67
76
|
|
68
|
-
its(:download_commmand) { should == "aria2c --dir=/tmp --bt-enable-lpd --bt-min-crypto-level=arc4 --bt-require-crypto=true --enable-dht=true --enable-peer-exchange=true --max-overall-upload-limit=0 --seed-ratio=1.5 --bt-tracker-connect-timeout=60 --bt-tracker-timeout=60 --bt-stop-timeout=0 '#{source}'" }
|
77
|
+
its(:download_commmand) { should == "aria2c --dir=/tmp --bt-enable-lpd --bt-min-crypto-level=arc4 --bt-require-crypto=true --enable-dht=true --enable-peer-exchange=true --max-overall-upload-limit=0 --seed-ratio=1.5 --seed-time=1440 --bt-tracker-connect-timeout=60 --bt-tracker-timeout=60 --bt-stop-timeout=0 '#{source}'" }
|
69
78
|
end
|
70
79
|
|
71
80
|
context "when have 2 sources" do
|
@@ -113,7 +122,7 @@ describe BitTorrent do
|
|
113
122
|
after { the_object.download }
|
114
123
|
|
115
124
|
it "should run download command in system" do
|
116
|
-
the_object.should_receive(:system).with("aria2c --dir=. --bt-enable-lpd --bt-min-crypto-level=arc4 --bt-require-crypto=true --enable-dht=true --enable-peer-exchange=true --max-overall-upload-limit=0 --seed-ratio=1.5 --bt-tracker-connect-timeout=60 --bt-tracker-timeout=60 --bt-stop-timeout=0 '#{source}'")
|
125
|
+
the_object.should_receive(:system).with("aria2c --dir=. --bt-enable-lpd --bt-min-crypto-level=arc4 --bt-require-crypto=true --enable-dht=true --enable-peer-exchange=true --max-overall-upload-limit=0 --seed-ratio=1.5 --seed-time=1440 --bt-tracker-connect-timeout=60 --bt-tracker-timeout=60 --bt-stop-timeout=0 '#{source}'")
|
117
126
|
end
|
118
127
|
end
|
119
128
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_bittorrent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marcin Nowicki
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-08-
|
11
|
+
date: 2013-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|