download_tv 2.6.0 → 2.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/bin/tv +7 -1
- data/download_tv.gemspec +3 -1
- data/lib/download_tv.rb +1 -1
- data/lib/download_tv/downloader.rb +1 -0
- data/lib/download_tv/grabbers/eztv.rb +8 -5
- data/lib/download_tv/grabbers/torrentapi.rb +3 -1
- data/lib/download_tv/torrent.rb +1 -1
- data/lib/download_tv/version.rb +1 -1
- data/test/config_test.rb +30 -30
- data/test/downloader_test.rb +19 -19
- data/test/grabbers_test.rb +11 -11
- data/test/torrent_test.rb +5 -5
- metadata +37 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7ab8410da063b896958e54d0a18e2fdc19b4ed9b45919fc714f536444041bc3e
|
|
4
|
+
data.tar.gz: 8435e14058dedd5e269d7819e301936c1a636619acb7a506f66cc944b1055fbf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 90bb2c2d281914071bf70097f771c0bc1dec85a3a8054907edb3c1f05b4aef915e813f55b38aa2825cb8ad7835830c9beb127d183e441c37fa7c140ee3cc83f4
|
|
7
|
+
data.tar.gz: d8ac37531a40b571fe5dcfe4f73c316860c39034befb8f05b67cdaf3a05c060447fe2b09f717ff28236c2d9ef12f54986cb0a30425b0f0da385f99e6af478172
|
data/.gitignore
CHANGED
data/bin/tv
CHANGED
|
@@ -92,7 +92,13 @@ opt_parser = OptionParser.new do |opts|
|
|
|
92
92
|
end
|
|
93
93
|
end
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
begin
|
|
96
|
+
opt_parser.parse!(ARGV)
|
|
97
|
+
rescue OptionParser::InvalidOption => e
|
|
98
|
+
warn e.message
|
|
99
|
+
puts opt_parser.help
|
|
100
|
+
exit 1
|
|
101
|
+
end
|
|
96
102
|
|
|
97
103
|
begin
|
|
98
104
|
case options[:cmd]
|
data/download_tv.gemspec
CHANGED
|
@@ -24,7 +24,9 @@ Gem::Specification.new do |s|
|
|
|
24
24
|
|
|
25
25
|
s.add_development_dependency 'bundler', '~> 2.0'
|
|
26
26
|
s.add_development_dependency 'minitest', '~> 5.0'
|
|
27
|
-
s.add_development_dependency
|
|
27
|
+
s.add_development_dependency "rake", ">= 12.3.3"
|
|
28
|
+
s.add_development_dependency 'pry', '~> 0.13'
|
|
29
|
+
s.add_development_dependency 'byebug', '~> 11.1'
|
|
28
30
|
|
|
29
31
|
s.add_dependency('json')
|
|
30
32
|
s.add_dependency('mechanize')
|
data/lib/download_tv.rb
CHANGED
|
@@ -12,20 +12,23 @@ module DownloadTV
|
|
|
12
12
|
# Format the url
|
|
13
13
|
search = format(@url, show)
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
raw_data = @agent.get(search)
|
|
16
|
+
raw_links = raw_data.search('a.magnet')
|
|
17
|
+
raw_seeders = raw_data.search('td.forum_thread_post_end').map { |e| e.children[0].text.to_i }
|
|
18
|
+
raw_links = raw_links.sort_by.with_index { |_, index| raw_seeders[index] }.reverse
|
|
16
19
|
|
|
17
|
-
# Torrent name in
|
|
20
|
+
# Torrent name in raw_links[i].attribute 'title'
|
|
18
21
|
# 'Suits S04E01 HDTV x264-LOL Torrent: Magnet Link'
|
|
19
22
|
|
|
20
23
|
# EZTV shows 50 latest releases if it can't find the torrent
|
|
21
|
-
raise NoTorrentsError if
|
|
24
|
+
raise NoTorrentsError if raw_links.size == 50
|
|
22
25
|
|
|
23
|
-
names =
|
|
26
|
+
names = raw_links.collect do |i|
|
|
24
27
|
i.attribute('title')
|
|
25
28
|
.text
|
|
26
29
|
.chomp(' Magnet Link')
|
|
27
30
|
end
|
|
28
|
-
links =
|
|
31
|
+
links = raw_links.collect do |i|
|
|
29
32
|
i.attribute('href')
|
|
30
33
|
.text
|
|
31
34
|
end
|
|
@@ -21,13 +21,15 @@ module DownloadTV
|
|
|
21
21
|
@agent.read_timeout = 2
|
|
22
22
|
renew_token
|
|
23
23
|
true
|
|
24
|
-
rescue Mechanize::ResponseCodeError
|
|
24
|
+
rescue Mechanize::ResponseCodeError => e
|
|
25
25
|
if e.response_code == '429'
|
|
26
26
|
sleep(@wait)
|
|
27
27
|
retry
|
|
28
28
|
else
|
|
29
29
|
false
|
|
30
30
|
end
|
|
31
|
+
rescue Net::HTTP::Persistent::Error => e
|
|
32
|
+
false
|
|
31
33
|
end
|
|
32
34
|
|
|
33
35
|
##
|
data/lib/download_tv/torrent.rb
CHANGED
data/lib/download_tv/version.rb
CHANGED
data/test/config_test.rb
CHANGED
|
@@ -18,28 +18,28 @@ describe DownloadTV::Configuration do
|
|
|
18
18
|
create_dummy_config(config_path)
|
|
19
19
|
|
|
20
20
|
c = DownloadTV::Configuration.new(path: config_path)
|
|
21
|
-
c.content.must_equal(path: config_path, version: DownloadTV::VERSION)
|
|
21
|
+
_(c.content).must_equal(path: config_path, version: DownloadTV::VERSION)
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
it 'will load the existing configuration (existing)' do
|
|
25
25
|
create_dummy_config(config_path, auto: false, myepisodes_user: 'dummy')
|
|
26
26
|
|
|
27
27
|
c = DownloadTV::Configuration.new(path: config_path)
|
|
28
|
-
c.content.must_equal(path: config_path, auto: false, myepisodes_user: 'dummy', version: DownloadTV::VERSION)
|
|
28
|
+
_(c.content).must_equal(path: config_path, auto: false, myepisodes_user: 'dummy', version: DownloadTV::VERSION)
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
it 'will get overwritten by the parameters given' do
|
|
32
32
|
create_dummy_config(config_path, myepisodes_user: 'dummy')
|
|
33
33
|
|
|
34
34
|
c = DownloadTV::Configuration.new(path: config_path, myepisodes_user: 'fake')
|
|
35
|
-
c.content.must_equal(path: config_path, myepisodes_user: 'fake', version: DownloadTV::VERSION)
|
|
35
|
+
_(c.content).must_equal(path: config_path, myepisodes_user: 'fake', version: DownloadTV::VERSION)
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
it 'will downcase ignored shows' do
|
|
39
39
|
create_dummy_config(config_path, ignored: %w[duMMy String])
|
|
40
40
|
|
|
41
41
|
c = DownloadTV::Configuration.new(path: config_path)
|
|
42
|
-
c.content[:ignored].must_equal %w[dummy string]
|
|
42
|
+
_(c.content[:ignored]).must_equal %w[dummy string]
|
|
43
43
|
end
|
|
44
44
|
end
|
|
45
45
|
|
|
@@ -58,7 +58,7 @@ describe DownloadTV::Configuration do
|
|
|
58
58
|
split[0] = (split[0].to_i - 1).to_s
|
|
59
59
|
new_version = split.join('.')
|
|
60
60
|
c = DownloadTV::Configuration.new(path: config_path)
|
|
61
|
-
c.breaking_changes?(new_version).must_equal true
|
|
61
|
+
_(c.breaking_changes?(new_version)).must_equal true
|
|
62
62
|
end
|
|
63
63
|
|
|
64
64
|
it "returns true when there's been a minor update" do
|
|
@@ -68,7 +68,7 @@ describe DownloadTV::Configuration do
|
|
|
68
68
|
split[1] = (split[1].to_i - 1).to_s
|
|
69
69
|
new_version = split.join('.')
|
|
70
70
|
c = DownloadTV::Configuration.new(path: config_path)
|
|
71
|
-
c.breaking_changes?(new_version).must_equal true
|
|
71
|
+
_(c.breaking_changes?(new_version)).must_equal true
|
|
72
72
|
end
|
|
73
73
|
|
|
74
74
|
it "returns false when it's a small patch" do
|
|
@@ -78,7 +78,7 @@ describe DownloadTV::Configuration do
|
|
|
78
78
|
split[2] = (split[2].to_i - 1).to_s
|
|
79
79
|
new_version = split.join('.')
|
|
80
80
|
c = DownloadTV::Configuration.new(path: config_path)
|
|
81
|
-
c.breaking_changes?(new_version).must_equal false
|
|
81
|
+
_(c.breaking_changes?(new_version)).must_equal false
|
|
82
82
|
end
|
|
83
83
|
end
|
|
84
84
|
|
|
@@ -90,7 +90,7 @@ describe DownloadTV::Configuration do
|
|
|
90
90
|
end
|
|
91
91
|
end
|
|
92
92
|
|
|
93
|
-
File.exist?(config_path).must_equal true
|
|
93
|
+
_(File.exist?(config_path)).must_equal true
|
|
94
94
|
end
|
|
95
95
|
|
|
96
96
|
it 'will have the right values' do
|
|
@@ -101,15 +101,15 @@ describe DownloadTV::Configuration do
|
|
|
101
101
|
end
|
|
102
102
|
end
|
|
103
103
|
|
|
104
|
-
c.content[:myepisodes_user].must_equal 'anything'
|
|
105
|
-
c.content[:cookie].must_equal true
|
|
106
|
-
c.content[:ignored].must_equal ['anything']
|
|
107
|
-
c.content[:auto].must_equal true
|
|
108
|
-
c.content[:subs].must_equal true
|
|
109
|
-
c.content[:pending].must_equal []
|
|
110
|
-
c.content[:grabber].must_equal 'TorrentAPI'
|
|
111
|
-
c.content[:date].must_equal(Date.today - 1)
|
|
112
|
-
c.content[:version].must_equal DownloadTV::VERSION
|
|
104
|
+
_(c.content[:myepisodes_user]).must_equal 'anything'
|
|
105
|
+
_(c.content[:cookie]).must_equal true
|
|
106
|
+
_(c.content[:ignored]).must_equal ['anything']
|
|
107
|
+
_(c.content[:auto]).must_equal true
|
|
108
|
+
_(c.content[:subs]).must_equal true
|
|
109
|
+
_(c.content[:pending]).must_equal []
|
|
110
|
+
_(c.content[:grabber]).must_equal 'TorrentAPI'
|
|
111
|
+
_(c.content[:date]).must_equal(Date.today - 1)
|
|
112
|
+
_(c.content[:version]).must_equal DownloadTV::VERSION
|
|
113
113
|
end
|
|
114
114
|
|
|
115
115
|
it 'will set the cookie value to false when explicitly told so' do
|
|
@@ -120,7 +120,7 @@ describe DownloadTV::Configuration do
|
|
|
120
120
|
end
|
|
121
121
|
end
|
|
122
122
|
|
|
123
|
-
c.content[:cookie].must_equal false
|
|
123
|
+
_(c.content[:cookie]).must_equal false
|
|
124
124
|
end
|
|
125
125
|
|
|
126
126
|
it 'will separate the ignored values by commas' do
|
|
@@ -130,7 +130,7 @@ describe DownloadTV::Configuration do
|
|
|
130
130
|
c = DownloadTV::Configuration.new(path: config_path)
|
|
131
131
|
end
|
|
132
132
|
end
|
|
133
|
-
c.content[:ignored].must_equal ['ignored1', 'itsgone', 'ignored 2']
|
|
133
|
+
_(c.content[:ignored]).must_equal ['ignored1', 'itsgone', 'ignored 2']
|
|
134
134
|
end
|
|
135
135
|
end
|
|
136
136
|
|
|
@@ -147,22 +147,22 @@ describe DownloadTV::Configuration do
|
|
|
147
147
|
content = JSON.parse(source, symbolize_names: true)
|
|
148
148
|
content[:date] = Date.parse(content[:date])
|
|
149
149
|
|
|
150
|
-
content[:cookie].must_equal true
|
|
151
|
-
content[:myepisodes_user].must_equal 'anything'
|
|
152
|
-
content[:ignored].must_equal ['anything']
|
|
153
|
-
content[:auto].must_equal true
|
|
154
|
-
content[:subs].must_equal true
|
|
155
|
-
content[:pending].must_equal []
|
|
156
|
-
content[:grabber].must_equal 'TorrentAPI'
|
|
157
|
-
content[:date].must_equal Date.today - 1
|
|
158
|
-
content[:version].must_equal DownloadTV::VERSION
|
|
150
|
+
_(content[:cookie]).must_equal true
|
|
151
|
+
_(content[:myepisodes_user]).must_equal 'anything'
|
|
152
|
+
_(content[:ignored]).must_equal ['anything']
|
|
153
|
+
_(content[:auto]).must_equal true
|
|
154
|
+
_(content[:subs]).must_equal true
|
|
155
|
+
_(content[:pending]).must_equal []
|
|
156
|
+
_(content[:grabber]).must_equal 'TorrentAPI'
|
|
157
|
+
_(content[:date]).must_equal Date.today - 1
|
|
158
|
+
_(content[:version]).must_equal DownloadTV::VERSION
|
|
159
159
|
end
|
|
160
160
|
end
|
|
161
161
|
|
|
162
162
|
describe 'the constructor' do
|
|
163
163
|
it 'will trigger a configuration change when asked to' do
|
|
164
164
|
create_dummy_config(config_path, auto: false)
|
|
165
|
-
File.exist?(config_path).must_equal true
|
|
165
|
+
_(File.exist?(config_path)).must_equal true
|
|
166
166
|
c = nil
|
|
167
167
|
|
|
168
168
|
run_silently do
|
|
@@ -171,7 +171,7 @@ describe DownloadTV::Configuration do
|
|
|
171
171
|
end
|
|
172
172
|
end
|
|
173
173
|
|
|
174
|
-
c.content[:auto].must_equal false
|
|
174
|
+
_(c.content[:auto]).must_equal false
|
|
175
175
|
end
|
|
176
176
|
end
|
|
177
177
|
end
|
data/test/downloader_test.rb
CHANGED
|
@@ -17,8 +17,8 @@ describe DownloadTV::Downloader do
|
|
|
17
17
|
describe 'when creating the object' do
|
|
18
18
|
it 'can receive an optional configuration hash' do
|
|
19
19
|
dl = DownloadTV::Downloader.new(auto: true, grabber: 'KAT', path: config_path)
|
|
20
|
-
dl.config.content[:auto].must_equal true
|
|
21
|
-
dl.config.content[:grabber].must_equal 'KAT'
|
|
20
|
+
_(dl.config.content[:auto]).must_equal true
|
|
21
|
+
_(dl.config.content[:grabber]).must_equal 'KAT'
|
|
22
22
|
end
|
|
23
23
|
end
|
|
24
24
|
|
|
@@ -30,7 +30,7 @@ describe DownloadTV::Downloader do
|
|
|
30
30
|
'Baz The Story S05E22']
|
|
31
31
|
|
|
32
32
|
dl = DownloadTV::Downloader.new(ignored: [], path: config_path)
|
|
33
|
-
dl.fix_names(shows).must_equal result
|
|
33
|
+
_(dl.fix_names(shows)).must_equal result
|
|
34
34
|
end
|
|
35
35
|
end
|
|
36
36
|
|
|
@@ -40,14 +40,14 @@ describe DownloadTV::Downloader do
|
|
|
40
40
|
result = ['Bar S00E22']
|
|
41
41
|
|
|
42
42
|
dl = DownloadTV::Downloader.new(ignored: ['ignored'], path: config_path)
|
|
43
|
-
dl.reject_ignored(shows).must_equal result
|
|
43
|
+
_(dl.reject_ignored(shows)).must_equal result
|
|
44
44
|
end
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
describe 'the check_date method' do
|
|
48
48
|
it 'exits the script when up to date' do
|
|
49
49
|
dl = DownloadTV::Downloader.new(date: Date.today, path: config_path)
|
|
50
|
-
dl.check_date(0).must_be_nil
|
|
50
|
+
_(dl.check_date(0)).must_be_nil
|
|
51
51
|
end
|
|
52
52
|
|
|
53
53
|
it 'uses the offset to adjust the date' do
|
|
@@ -56,8 +56,8 @@ describe DownloadTV::Downloader do
|
|
|
56
56
|
|
|
57
57
|
date = dl.check_date(1)
|
|
58
58
|
|
|
59
|
-
date.must_equal(Date.today - 1)
|
|
60
|
-
dl.config.content[:date].must_equal Date.today
|
|
59
|
+
_(date).must_equal(Date.today - 1)
|
|
60
|
+
_(dl.config.content[:date]).must_equal Date.today
|
|
61
61
|
end
|
|
62
62
|
end
|
|
63
63
|
|
|
@@ -67,7 +67,7 @@ describe DownloadTV::Downloader do
|
|
|
67
67
|
dl = DownloadTV::Downloader.new(path: config_path, filters: f)
|
|
68
68
|
links = [['Link 1', ''], ['Link 2 2160p', ''], ['Link 3', '']]
|
|
69
69
|
res = [['Link 1', ''], ['Link 3', '']]
|
|
70
|
-
dl.filter_shows(links).must_equal res
|
|
70
|
+
_(dl.filter_shows(links)).must_equal res
|
|
71
71
|
end
|
|
72
72
|
|
|
73
73
|
it 'removes names without include words in them' do
|
|
@@ -76,7 +76,7 @@ describe DownloadTV::Downloader do
|
|
|
76
76
|
links = [['Link 1', ''], ['Link 2 2160p', ''], ['Link 3', ''],
|
|
77
77
|
['Link REPACK 5', '']]
|
|
78
78
|
res = [['Link REPACK 5', '']]
|
|
79
|
-
dl.filter_shows(links).must_equal res
|
|
79
|
+
_(dl.filter_shows(links)).must_equal res
|
|
80
80
|
end
|
|
81
81
|
|
|
82
82
|
it "doesn't apply a filter if it would reject every option" do
|
|
@@ -84,7 +84,7 @@ describe DownloadTV::Downloader do
|
|
|
84
84
|
dl = DownloadTV::Downloader.new(path: config_path, filters: f)
|
|
85
85
|
links = [['Link 1 720p', ''], ['Link 2 2160p', ''], ['Link 720p 3', '']]
|
|
86
86
|
res = [['Link 1 720p', ''], ['Link 720p 3', '']]
|
|
87
|
-
dl.filter_shows(links).must_equal res
|
|
87
|
+
_(dl.filter_shows(links)).must_equal res
|
|
88
88
|
end
|
|
89
89
|
end
|
|
90
90
|
|
|
@@ -95,13 +95,13 @@ describe DownloadTV::Downloader do
|
|
|
95
95
|
|
|
96
96
|
t.expect(:get_links, [], [show])
|
|
97
97
|
dl = DownloadTV::Downloader.new(auto: true, path: config_path, pending: ['show 11'])
|
|
98
|
-
dl.get_link(t, show, true).must_equal ''
|
|
99
|
-
dl.config.content[:pending].must_equal ['show 11', show]
|
|
98
|
+
_(dl.get_link(t, show, true)).must_equal ''
|
|
99
|
+
_(dl.config.content[:pending]).must_equal ['show 11', show]
|
|
100
100
|
|
|
101
101
|
t.expect(:get_links, [], [show])
|
|
102
102
|
dl = DownloadTV::Downloader.new(auto: false, path: config_path, pending: [])
|
|
103
|
-
dl.get_link(t, show, true).must_equal ''
|
|
104
|
-
dl.config.content[:pending].must_include show
|
|
103
|
+
_(dl.get_link(t, show, true)).must_equal ''
|
|
104
|
+
_(dl.config.content[:pending]).must_include show
|
|
105
105
|
|
|
106
106
|
t.verify
|
|
107
107
|
end
|
|
@@ -112,7 +112,7 @@ describe DownloadTV::Downloader do
|
|
|
112
112
|
|
|
113
113
|
t.expect(:get_links, [['Name 1', 'Link 1'], ['Name 2', 'Link 2']], [show])
|
|
114
114
|
dl = DownloadTV::Downloader.new(auto: true, path: config_path)
|
|
115
|
-
dl.get_link(t, show).must_equal 'Link 1'
|
|
115
|
+
_(dl.get_link(t, show)).must_equal 'Link 1'
|
|
116
116
|
t.verify
|
|
117
117
|
end
|
|
118
118
|
end
|
|
@@ -123,7 +123,7 @@ describe DownloadTV::Downloader do
|
|
|
123
123
|
RbConfig::CONFIG['host_os'] = 'linux-gnu'
|
|
124
124
|
|
|
125
125
|
dl = DownloadTV::Downloader.new(path: config_path)
|
|
126
|
-
dl.detect_os.must_equal 'xdg-open'
|
|
126
|
+
_(dl.detect_os).must_equal 'xdg-open'
|
|
127
127
|
|
|
128
128
|
RbConfig::CONFIG['host_os'] = prev
|
|
129
129
|
end
|
|
@@ -133,7 +133,7 @@ describe DownloadTV::Downloader do
|
|
|
133
133
|
RbConfig::CONFIG['host_os'] = 'darwin15.6.0'
|
|
134
134
|
|
|
135
135
|
dl = DownloadTV::Downloader.new(path: config_path)
|
|
136
|
-
dl.detect_os.must_equal 'open'
|
|
136
|
+
_(dl.detect_os).must_equal 'open'
|
|
137
137
|
|
|
138
138
|
RbConfig::CONFIG['host_os'] = prev
|
|
139
139
|
end
|
|
@@ -144,8 +144,8 @@ describe DownloadTV::Downloader do
|
|
|
144
144
|
|
|
145
145
|
dl = DownloadTV::Downloader.new(path: config_path)
|
|
146
146
|
|
|
147
|
-
to_run = -> { run_silently { dl.detect_os.must_equal 'xdg-open' } }
|
|
148
|
-
to_run.must_raise SystemExit
|
|
147
|
+
to_run = -> { run_silently { _(dl.detect_os).must_equal 'xdg-open' } }
|
|
148
|
+
_(to_run).must_raise SystemExit
|
|
149
149
|
|
|
150
150
|
RbConfig::CONFIG['host_os'] = prev
|
|
151
151
|
end
|
data/test/grabbers_test.rb
CHANGED
|
@@ -11,30 +11,30 @@ describe DownloadTV::LinkGrabber do
|
|
|
11
11
|
next unless grabber.online?
|
|
12
12
|
|
|
13
13
|
it 'will have a url attribute on creation' do
|
|
14
|
-
grabber.url.wont_be_nil
|
|
14
|
+
_(grabber.url).wont_be_nil
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
it "will raise NoTorrentsError when torrent can't be found" do
|
|
18
18
|
notfound = -> { grabber.get_links('Totally Fake Show askjdgsaudas') }
|
|
19
|
-
notfound.must_raise DownloadTV::NoTorrentsError
|
|
19
|
+
_(notfound).must_raise DownloadTV::NoTorrentsError
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
it 'will return an array with names and links of results when a torrent can be found' do
|
|
23
|
-
result = grabber.get_links('
|
|
24
|
-
result.must_be_instance_of Array
|
|
25
|
-
result.wont_be :empty?
|
|
23
|
+
result = grabber.get_links('The Boys S01E01')
|
|
24
|
+
_(result).must_be_instance_of Array
|
|
25
|
+
_(result).wont_be :empty?
|
|
26
26
|
result.each do |r|
|
|
27
|
-
r.size.must_equal 2
|
|
28
|
-
r[0].must_be_instance_of String
|
|
29
|
-
r[0].upcase.must_include '
|
|
30
|
-
r[1].must_be_instance_of String
|
|
31
|
-
r[1].must_include 'magnet:'
|
|
27
|
+
_(r.size).must_equal 2
|
|
28
|
+
_(r[0]).must_be_instance_of String
|
|
29
|
+
_(r[0].upcase).must_include 'BOYS'
|
|
30
|
+
_(r[1]).must_be_instance_of String
|
|
31
|
+
_(r[1]).must_include 'magnet:'
|
|
32
32
|
end
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
it "raises an error if the instance doesn't implement get_links" do
|
|
38
|
-
-> { DownloadTV::LinkGrabber.new('').get_links('test') }.must_raise NotImplementedError
|
|
38
|
+
_(-> { DownloadTV::LinkGrabber.new('').get_links('test') }).must_raise NotImplementedError
|
|
39
39
|
end
|
|
40
40
|
end
|
data/test/torrent_test.rb
CHANGED
|
@@ -10,16 +10,16 @@ describe DownloadTV::Torrent do
|
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
it 'will populate the instances' do
|
|
13
|
-
@t.g_instances.size.must_equal grabber_names.size
|
|
13
|
+
_(@t.g_instances.size).must_equal grabber_names.size
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
it 'will start with all tries available' do
|
|
17
|
-
@t.tries.must_equal grabber_names.size - 1
|
|
17
|
+
_(@t.tries).must_equal grabber_names.size - 1
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
it 'will call get_links on its grabber' do
|
|
21
21
|
@t.g_instances.first.stub :get_links, %w[test result] do
|
|
22
|
-
@t.get_links('test show').must_equal %w[test result]
|
|
22
|
+
_(@t.get_links('test show')).must_equal %w[test result]
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
25
|
end
|
|
@@ -28,13 +28,13 @@ describe DownloadTV::Torrent do
|
|
|
28
28
|
it 'has a default order' do
|
|
29
29
|
t = DownloadTV::Torrent.new(nil)
|
|
30
30
|
expected = grabber_names.map { |i| "DownloadTV::#{i}" }
|
|
31
|
-
t.g_instances.map { |i| i.class.name }.must_equal expected
|
|
31
|
+
_(t.g_instances.map { |i| i.class.name }).must_equal expected
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
grabber_names.each do |g|
|
|
35
35
|
it 'correctly uses the given grabber first' do
|
|
36
36
|
t = DownloadTV::Torrent.new(g)
|
|
37
|
-
t.g_instances.first.class.name.must_equal "DownloadTV::#{g}"
|
|
37
|
+
_(t.g_instances.first.class.name).must_equal "DownloadTV::#{g}"
|
|
38
38
|
end
|
|
39
39
|
end
|
|
40
40
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: download_tv
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.6.
|
|
4
|
+
version: 2.6.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- guille
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2020-09-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -40,18 +40,46 @@ dependencies:
|
|
|
40
40
|
version: '5.0'
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: rake
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ">="
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: 12.3.3
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - ">="
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: 12.3.3
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: pry
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - "~>"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0.13'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - "~>"
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0.13'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: byebug
|
|
43
71
|
requirement: !ruby/object:Gem::Requirement
|
|
44
72
|
requirements:
|
|
45
73
|
- - "~>"
|
|
46
74
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: '
|
|
75
|
+
version: '11.1'
|
|
48
76
|
type: :development
|
|
49
77
|
prerelease: false
|
|
50
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
79
|
requirements:
|
|
52
80
|
- - "~>"
|
|
53
81
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: '
|
|
82
|
+
version: '11.1'
|
|
55
83
|
- !ruby/object:Gem::Dependency
|
|
56
84
|
name: json
|
|
57
85
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -80,7 +108,7 @@ dependencies:
|
|
|
80
108
|
- - ">="
|
|
81
109
|
- !ruby/object:Gem::Version
|
|
82
110
|
version: '0'
|
|
83
|
-
description:
|
|
111
|
+
description:
|
|
84
112
|
email:
|
|
85
113
|
- guillerg96@gmail.com
|
|
86
114
|
executables:
|
|
@@ -119,7 +147,7 @@ homepage: https://github.com/guille/download_tv
|
|
|
119
147
|
licenses:
|
|
120
148
|
- MIT
|
|
121
149
|
metadata: {}
|
|
122
|
-
post_install_message:
|
|
150
|
+
post_install_message:
|
|
123
151
|
rdoc_options: []
|
|
124
152
|
require_paths:
|
|
125
153
|
- lib
|
|
@@ -134,8 +162,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
134
162
|
- !ruby/object:Gem::Version
|
|
135
163
|
version: '0'
|
|
136
164
|
requirements: []
|
|
137
|
-
rubygems_version: 3.
|
|
138
|
-
signing_key:
|
|
165
|
+
rubygems_version: 3.1.2
|
|
166
|
+
signing_key:
|
|
139
167
|
specification_version: 4
|
|
140
168
|
summary: DownloadTV is a tool that allows the user to find magnet links for tv show
|
|
141
169
|
episodes. It accepts shows as arguments, from a file or it can integrate with your
|