download_tv 2.6.0 → 2.6.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DownloadTV
4
- VERSION = '2.6.0'
4
+ VERSION = '2.6.5'
5
5
  end
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
 
@@ -48,7 +48,7 @@ describe DownloadTV::Configuration do
48
48
  create_dummy_config(config_path)
49
49
 
50
50
  c = DownloadTV::Configuration.new(path: config_path)
51
- c.breaking_changes?(DownloadTV::VERSION).must_be_nil
51
+ _(c.breaking_changes?(DownloadTV::VERSION)).must_be_nil
52
52
  end
53
53
 
54
54
  it "returns true when there's been a major update" do
@@ -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,14 @@ 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[:pending]).must_equal []
109
+ _(c.content[:grabber]).must_equal 'TorrentAPI'
110
+ _(c.content[:date]).must_equal(Date.today - 1)
111
+ _(c.content[:version]).must_equal DownloadTV::VERSION
113
112
  end
114
113
 
115
114
  it 'will set the cookie value to false when explicitly told so' do
@@ -120,7 +119,7 @@ describe DownloadTV::Configuration do
120
119
  end
121
120
  end
122
121
 
123
- c.content[:cookie].must_equal false
122
+ _(c.content[:cookie]).must_equal false
124
123
  end
125
124
 
126
125
  it 'will separate the ignored values by commas' do
@@ -130,7 +129,7 @@ describe DownloadTV::Configuration do
130
129
  c = DownloadTV::Configuration.new(path: config_path)
131
130
  end
132
131
  end
133
- c.content[:ignored].must_equal ['ignored1', 'itsgone', 'ignored 2']
132
+ _(c.content[:ignored]).must_equal ['ignored1', 'itsgone', 'ignored 2']
134
133
  end
135
134
  end
136
135
 
@@ -147,22 +146,21 @@ describe DownloadTV::Configuration do
147
146
  content = JSON.parse(source, symbolize_names: true)
148
147
  content[:date] = Date.parse(content[:date])
149
148
 
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
149
+ _(content[:cookie]).must_equal true
150
+ _(content[:myepisodes_user]).must_equal 'anything'
151
+ _(content[:ignored]).must_equal ['anything']
152
+ _(content[:auto]).must_equal true
153
+ _(content[:pending]).must_equal []
154
+ _(content[:grabber]).must_equal 'TorrentAPI'
155
+ _(content[:date]).must_equal Date.today - 1
156
+ _(content[:version]).must_equal DownloadTV::VERSION
159
157
  end
160
158
  end
161
159
 
162
160
  describe 'the constructor' do
163
161
  it 'will trigger a configuration change when asked to' do
164
162
  create_dummy_config(config_path, auto: false)
165
- File.exist?(config_path).must_equal true
163
+ _(File.exist?(config_path)).must_equal true
166
164
  c = nil
167
165
 
168
166
  run_silently do
@@ -171,7 +169,7 @@ describe DownloadTV::Configuration do
171
169
  end
172
170
  end
173
171
 
174
- c.content[:auto].must_equal false
172
+ _(c.content[:auto]).must_equal false
175
173
  end
176
174
  end
177
175
  end
@@ -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,24 +40,24 @@ 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
- describe 'the check_date method' do
48
- it 'exits the script when up to date' do
47
+ describe 'the date_to_check_from method' do
48
+ it 'returns the config date when offset is not given' do
49
49
  dl = DownloadTV::Downloader.new(date: Date.today, path: config_path)
50
- dl.check_date(0).must_be_nil
50
+ _(dl.date_to_check_from(0)).must_equal Date.today
51
51
  end
52
52
 
53
53
  it 'uses the offset to adjust the date' do
54
54
  # Would exit with offset 0
55
55
  dl = DownloadTV::Downloader.new(date: Date.today, path: config_path)
56
56
 
57
- date = dl.check_date(1)
57
+ date = dl.date_to_check_from(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,24 +84,24 @@ 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
 
91
91
  describe 'the get_link method' do
92
- it "returns an empty string when it can't find links" do
92
+ it "returns nil when it can't find links" do
93
93
  t = Minitest::Mock.new
94
94
  show = 'Example Show S01E01'
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, save_pending: true)).must_be_nil
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, save_pending: true)).must_be_nil
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
@@ -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('Game Of Thrones S04E01')
24
- result.must_be_instance_of Array
25
- result.wont_be :empty?
23
+ result = grabber.get_links('The Boys S02E01')
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 'THRONES'
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.0
4
+ version: 2.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - guille
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-29 00:00:00.000000000 Z
11
+ date: 2021-06-10 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: '10.0'
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: '10.0'
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:
@@ -88,8 +116,10 @@ executables:
88
116
  extensions: []
89
117
  extra_rdoc_files: []
90
118
  files:
119
+ - ".github/workflows/ruby.yml"
91
120
  - ".gitignore"
92
121
  - ".travis.yml"
122
+ - CHANGELOG.md
93
123
  - Gemfile
94
124
  - LICENSE.md
95
125
  - README.md
@@ -104,6 +134,7 @@ files:
104
134
  - lib/download_tv/grabbers/eztv.rb
105
135
  - lib/download_tv/grabbers/kat.rb
106
136
  - lib/download_tv/grabbers/torrentapi.rb
137
+ - lib/download_tv/grabbers/torrentz2.rb
107
138
  - lib/download_tv/grabbers/tpb.rb
108
139
  - lib/download_tv/linkgrabber.rb
109
140
  - lib/download_tv/myepisodes.rb
@@ -119,7 +150,7 @@ homepage: https://github.com/guille/download_tv
119
150
  licenses:
120
151
  - MIT
121
152
  metadata: {}
122
- post_install_message:
153
+ post_install_message:
123
154
  rdoc_options: []
124
155
  require_paths:
125
156
  - lib
@@ -134,8 +165,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
165
  - !ruby/object:Gem::Version
135
166
  version: '0'
136
167
  requirements: []
137
- rubygems_version: 3.0.1
138
- signing_key:
168
+ rubygems_version: 3.2.17
169
+ signing_key:
139
170
  specification_version: 4
140
171
  summary: DownloadTV is a tool that allows the user to find magnet links for tv show
141
172
  episodes. It accepts shows as arguments, from a file or it can integrate with your