mktorrent 1.6.5 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3c9a64b02d9c54494ae9e4b17bc3bddd409fee6b
4
- data.tar.gz: 1b833ccc2122ae097d990d8bc01517946d972286
3
+ metadata.gz: 7dd90d928e52f60a40a6d8c3ea67bd2f71116845
4
+ data.tar.gz: 9484945530b8a24bfe7e967a8d0048065778a950
5
5
  SHA512:
6
- metadata.gz: 80de07abfaee27f1e8042bc577d11ea086051b10039cac446d4a6cd2450231e3b7407168c8f6dc9979e60999d99d978ebbd597faea6c7efe458aaa1d5e78366d
7
- data.tar.gz: c8133e83a7b300e1d5065361a37cb43f753ae0a999462d1aae3cfd3dce5ac01bac7e4775080d5cb1b8866e189be3e473ef061da40c76f464aceb08e3ad306621
6
+ metadata.gz: a5d92adceb227dfaa0b9d181bad6686eeea079d4247041d35efeeae12b97f08d0044a055bbdb6e97d533ac545adef34f1a186feefc04dd74364e437e3eb525d6
7
+ data.tar.gz: 14ce32a6cc26d6bee8ac5826eec5be4dec2003481fcba968f4a5362cf6b4267be5de735c03b72cb33579fb61826b6f567447f65991120c6297ef3bddb5e39f53
@@ -10,7 +10,7 @@ require 'uri'
10
10
 
11
11
  class Torrent
12
12
  attr_reader :torrent_file, :infohash
13
- attr_accessor :info, :filehashes, :piecelength, :files, :defaultdir, :tracker, :size, :privacy, :webseed
13
+ attr_accessor :info, :filehashes, :piecelength, :files, :defaultdir, :tracker, :size, :privacy, :webseed, :tracker_list
14
14
 
15
15
  # optionally initialize filename
16
16
  def initialize(tracker)
@@ -19,6 +19,7 @@ class Torrent
19
19
  @files = []
20
20
  @filehashes = []
21
21
  @size = 0
22
+ @tracker_list = [ [@tracker] ]
22
23
  @defaultdir = "torrent"
23
24
  @privacy = 0
24
25
  @webseed = ""
@@ -72,6 +73,7 @@ class Torrent
72
73
  def build
73
74
  @info = {
74
75
  :announce => @tracker,
76
+ :'announce-list' => @tracker_list,
75
77
  :'creation date' => DateTime.now.strftime("%s"),
76
78
  :info => {
77
79
  :name => @defaultdir,
@@ -152,6 +154,10 @@ class Torrent
152
154
  @webseed = url
153
155
  end
154
156
 
157
+ def add_tracker(tracker)
158
+ @tracker_list << [tracker]
159
+ end
160
+
155
161
  def set_private
156
162
  @privacy = 1
157
163
  end
@@ -23,6 +23,17 @@ class MktorrentTest < Minitest::Test
23
23
  assert(@torrent.info[:info][:files].select { |f| f[:name] == VALIDFILENAME })
24
24
  end
25
25
 
26
+ def test_add_second_tracker
27
+ @torrent.add_tracker(SNDTRACKER)
28
+ assert_equal 2, @torrent.tracker_list.count
29
+ end
30
+
31
+ def test_add_multiple_trackers
32
+ @torrent.add_tracker(SNDTRACKER)
33
+ @torrent.add_tracker(THDTRACKER)
34
+ assert_equal SNDTRACKER, @torrent.tracker_list[1][0]
35
+ end
36
+
26
37
  def test_add_valid_file_as_path_array
27
38
  @torrent.add_file(VALIDFILEPATH)
28
39
  path = @torrent.info[:info][:files].first[:path]
@@ -11,6 +11,8 @@ Minitest::Reporters.use! [
11
11
 
12
12
 
13
13
  TRACKER = "http://test.example.com"
14
+ SNDTRACKER = "udp://test.tracker.tk:80"
15
+ THDTRACKER = "udp://open.testtracker.com:6500/announce"
14
16
  WEBSEED = "http://seed.example.com/webseed"
15
17
  EXPECTED_INFOHASH = "a8036d51ada8fb699c9f29d7861e5589f2d20cf9"
16
18
  VALIDPATH = File.expand_path("#{File.dirname(__FILE__)}/test_data")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mktorrent
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.5
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Timothy Mukaibo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-08 00:00:00.000000000 Z
11
+ date: 2015-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bencode