download_tv 2.8.2 → 2.8.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +2 -6
- data/CHANGELOG.md +12 -0
- data/README.md +1 -1
- data/lib/download_tv/configuration.rb +1 -1
- data/lib/download_tv/downloader.rb +3 -2
- data/lib/download_tv/grabbers/tpb.rb +27 -12
- data/lib/download_tv/torrent.rb +1 -1
- data/lib/download_tv/version.rb +1 -1
- data/spec/download_tv/torrent_spec.rb +41 -40
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c39ab8c419d632acdd80ea9a072dbb119e27bec036d8e631bd1fe677a7cdc133
|
4
|
+
data.tar.gz: 6df0b53c0faedfa474631b8fb9c071b2bb3465a0b2172e599e2cd57d3d07b995
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e455efa1fb3c2a86b480f3e1cbc814dc97297e45f26eb3b611cd740d19033682980e2f4a85a69b8f9b16f2575806d625a63290b631966788838bde3001b9c803
|
7
|
+
data.tar.gz: 65d73597d67dc3f03280d18d32d11a1b32d10e1c53ea3b8bac6cdda910de4af2800e90010d6a558906830837d770a2e96229059a620d62307b8935832b20ec61
|
data/.github/workflows/ruby.yml
CHANGED
@@ -15,19 +15,15 @@ on:
|
|
15
15
|
|
16
16
|
jobs:
|
17
17
|
test:
|
18
|
-
|
19
18
|
runs-on: ubuntu-latest
|
20
19
|
strategy:
|
21
20
|
matrix:
|
22
|
-
ruby-version: ['2.
|
21
|
+
ruby-version: ['2.7', '3.0']
|
23
22
|
|
24
23
|
steps:
|
25
24
|
- uses: actions/checkout@v2
|
26
25
|
- name: Set up Ruby
|
27
|
-
|
28
|
-
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
29
|
-
# uses: ruby/setup-ruby@v1
|
30
|
-
uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
|
26
|
+
uses: ruby/setup-ruby@v1
|
31
27
|
with:
|
32
28
|
ruby-version: ${{ matrix.ruby-version }}
|
33
29
|
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,18 @@
|
|
2
2
|
|
3
3
|
## Next (unreleased)
|
4
4
|
|
5
|
+
## 2.8.4 (2024-08-19)
|
6
|
+
|
7
|
+
* Grabbers
|
8
|
+
* ThePirateBay: fix with upstream. Use tpb api.
|
9
|
+
|
10
|
+
## 2.8.3 (2024-02-20)
|
11
|
+
|
12
|
+
* Grabbers
|
13
|
+
* TorrentGalaxy: disable grabber.
|
14
|
+
* Torrentz: made the new default.
|
15
|
+
* ThePirateBay: re-enable grabber with new proxy URL.
|
16
|
+
|
5
17
|
## 2.8.2 (2024-02-16)
|
6
18
|
|
7
19
|
* Improvements
|
data/README.md
CHANGED
@@ -69,7 +69,7 @@ The `-f` flag can be used to read the list of episodes to download from a file.
|
|
69
69
|
|
70
70
|
### Available link grabbers
|
71
71
|
|
72
|
-
With `-g` and `--show-grabbers`, the user can see what grabbers are available and choose one of these as their preferred option. By default, the application searches for torrents using
|
72
|
+
With `-g` and `--show-grabbers`, the user can see what grabbers are available and choose one of these as their preferred option. By default, the application searches for torrents using Torrentz. When a grabber doesn't have a torrent for said episode, is offline, or causes any error to appear, it skips to the next grabber until exhausting the list.
|
73
73
|
|
74
74
|
I usually publish a patch update to the gem when I detect one of them isn't working, disabling it or fixing it altogether. If a specific grabber is giving you problems, check whether you're running the latest version of the gem before opening an issue here.
|
75
75
|
|
@@ -140,7 +140,7 @@ module DownloadTV
|
|
140
140
|
# Maintains the previous values, in case it's an update from an existing file.
|
141
141
|
def set_default_values
|
142
142
|
self[:auto] ||= true
|
143
|
-
self[:grabber] ||= '
|
143
|
+
self[:grabber] ||= 'Torrentz'
|
144
144
|
self[:date] ||= Date.today - 1
|
145
145
|
self[:filters] ||= default_filters
|
146
146
|
self[:pending] ||= []
|
@@ -180,8 +180,9 @@ module DownloadTV
|
|
180
180
|
def reject_ignored(shows)
|
181
181
|
shows.reject do |i|
|
182
182
|
# Remove season+episode
|
183
|
-
@config[:ignored]
|
184
|
-
|
183
|
+
@config[:ignored].include?(
|
184
|
+
i.split(' ')[0..-2].join(' ').downcase
|
185
|
+
)
|
185
186
|
end
|
186
187
|
end
|
187
188
|
|
@@ -4,27 +4,42 @@ module DownloadTV
|
|
4
4
|
##
|
5
5
|
# ThePirateBay grabber
|
6
6
|
class ThePirateBay < LinkGrabber
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
TRACKERS = %w[
|
8
|
+
udp://tracker.coppersurfer.tk:6969/announce
|
9
|
+
udp://tracker.openbittorrent.com:6969/announce
|
10
|
+
udp://tracker.opentrackr.org:1337
|
11
|
+
udp://movies.zsw.ca:6969/announce
|
12
|
+
udp://tracker.dler.org:6969/announce
|
13
|
+
udp://opentracker.i2p.rocks:6969/announce
|
14
|
+
udp://open.stealth.si:80/announce
|
15
|
+
udp://tracker.0x.tf:6969/announce
|
16
|
+
]
|
17
|
+
|
18
|
+
def initialize
|
19
|
+
super("https://tpb36.ukpass.co/apibay/q.php?q=%s&cat=")
|
11
20
|
end
|
12
21
|
|
13
22
|
def get_links(show)
|
14
23
|
search = format(@url, show)
|
15
24
|
|
16
|
-
|
17
|
-
|
25
|
+
data = agent.get(search)
|
26
|
+
parsed = JSON.parse(data.body)
|
27
|
+
|
28
|
+
raise NoTorrentsError if parsed.size == 1 && parsed.first['name'] == 'No results returned'
|
18
29
|
|
19
|
-
|
30
|
+
parsed.map do |elem|
|
31
|
+
[elem['name'], build_magnet(elem['info_hash'], elem['name'])]
|
32
|
+
end
|
33
|
+
end
|
20
34
|
|
21
|
-
|
22
|
-
results = data.map { |d| d.search('td')[1] }
|
35
|
+
private
|
23
36
|
|
24
|
-
|
25
|
-
|
37
|
+
def build_magnet(torrent_hash, name)
|
38
|
+
"magnet:?xt=urn:btih:#{torrent_hash}&dn=#{CGI.escape(name)}#{trackers_params}"
|
39
|
+
end
|
26
40
|
|
27
|
-
|
41
|
+
def trackers_params
|
42
|
+
trackers_params ||= "&tr=#{TRACKERS.map { |tracker| CGI.escape(tracker) }.join('&tr=')}"
|
28
43
|
end
|
29
44
|
end
|
30
45
|
end
|
data/lib/download_tv/torrent.rb
CHANGED
data/lib/download_tv/version.rb
CHANGED
@@ -2,28 +2,29 @@
|
|
2
2
|
|
3
3
|
describe DownloadTV::Torrent do
|
4
4
|
let(:default_grabber) { nil }
|
5
|
-
let(:
|
6
|
-
let(:
|
7
|
-
let(:
|
8
|
-
let(:
|
5
|
+
let(:third_grabber) { double('eztv') }
|
6
|
+
let(:second_grabber) { double('torrentz') }
|
7
|
+
let(:fourth_grabber) { double('tpb') }
|
8
|
+
let(:first_grabber) { double('torrentgalaxy') }
|
9
9
|
let(:test_show) { double('test_show') }
|
10
10
|
subject { described_class.new(default_grabber) }
|
11
11
|
|
12
12
|
before :each do
|
13
|
-
allow(DownloadTV::
|
14
|
-
allow(DownloadTV::
|
15
|
-
allow(DownloadTV::Eztv).to receive(:new).and_return
|
16
|
-
# allow(DownloadTV::
|
17
|
-
|
18
|
-
allow(
|
19
|
-
allow(
|
20
|
-
allow(
|
13
|
+
allow(DownloadTV::Torrentz).to receive(:new).and_return first_grabber
|
14
|
+
allow(DownloadTV::ThePirateBay).to receive(:new).and_return second_grabber
|
15
|
+
allow(DownloadTV::Eztv).to receive(:new).and_return third_grabber
|
16
|
+
# allow(DownloadTV::TorrentGalaxy).to receive(:new).and_return fourth_grabber
|
17
|
+
|
18
|
+
allow(first_grabber).to receive(:online?).and_return(true)
|
19
|
+
allow(second_grabber).to receive(:online?).and_return(true)
|
20
|
+
allow(third_grabber).to receive(:online?).and_return(true)
|
21
|
+
# allow(fourth_grabber).to receive(:online?).and_return(true)
|
21
22
|
end
|
22
23
|
|
23
24
|
describe 'Torrent.grabbers' do
|
24
25
|
it 'returns the list of grabbers' do
|
25
26
|
# This order is assumed in the other specs, so explicitly checking it here
|
26
|
-
expect(described_class.grabbers).to eq %w[
|
27
|
+
expect(described_class.grabbers).to eq %w[Torrentz ThePirateBay Eztv]
|
27
28
|
|
28
29
|
end
|
29
30
|
end
|
@@ -31,20 +32,20 @@ describe DownloadTV::Torrent do
|
|
31
32
|
describe '#get_links' do
|
32
33
|
it 'will use the first grabber and return its #get_link result' do
|
33
34
|
result = double('result')
|
34
|
-
expect(
|
35
|
+
expect(first_grabber).to receive(:get_links).with(test_show).and_return(result)
|
35
36
|
|
36
37
|
result = subject.get_links(test_show)
|
37
38
|
end
|
38
39
|
|
39
40
|
context 'when the first grabber is offline' do
|
40
41
|
before do
|
41
|
-
allow(
|
42
|
+
allow(first_grabber).to receive(:online?).and_return(false)
|
42
43
|
end
|
43
44
|
|
44
45
|
it 'will use the second grabber' do
|
45
|
-
expect(
|
46
|
-
expect(
|
47
|
-
expect(
|
46
|
+
expect(first_grabber).not_to receive(:get_links)
|
47
|
+
expect(second_grabber).to receive(:get_links).with(test_show)
|
48
|
+
expect(third_grabber).not_to receive(:get_links)
|
48
49
|
# Add other torrents here with expectation #not_to receive
|
49
50
|
|
50
51
|
result = subject.get_links(test_show)
|
@@ -53,15 +54,15 @@ describe DownloadTV::Torrent do
|
|
53
54
|
|
54
55
|
context 'when all the grabbers are offline' do
|
55
56
|
before do
|
56
|
-
allow(
|
57
|
-
allow(
|
58
|
-
allow(
|
57
|
+
allow(first_grabber).to receive(:online?).and_return(false)
|
58
|
+
allow(second_grabber).to receive(:online?).and_return(false)
|
59
|
+
allow(third_grabber).to receive(:online?).and_return(false)
|
59
60
|
end
|
60
61
|
|
61
62
|
it 'will exit' do
|
62
|
-
expect(
|
63
|
-
expect(
|
64
|
-
expect(
|
63
|
+
expect(first_grabber).not_to receive(:get_links)
|
64
|
+
expect(second_grabber).not_to receive(:get_links)
|
65
|
+
expect(third_grabber).not_to receive(:get_links)
|
65
66
|
|
66
67
|
expect { subject.get_links(test_show) }.to raise_error(SystemExit)
|
67
68
|
end
|
@@ -69,12 +70,12 @@ describe DownloadTV::Torrent do
|
|
69
70
|
|
70
71
|
context 'when one grabber does not find a link' do
|
71
72
|
before do
|
72
|
-
allow(
|
73
|
+
allow(first_grabber).to receive(:get_links).with(test_show).and_raise(DownloadTV::NoTorrentsError)
|
73
74
|
end
|
74
75
|
|
75
76
|
it 'will keep trying until one does' do
|
76
|
-
expect(
|
77
|
-
expect(
|
77
|
+
expect(first_grabber).to receive(:get_links).ordered
|
78
|
+
expect(second_grabber).to receive(:get_links).ordered
|
78
79
|
|
79
80
|
result = subject.get_links(test_show)
|
80
81
|
end
|
@@ -82,15 +83,15 @@ describe DownloadTV::Torrent do
|
|
82
83
|
|
83
84
|
context 'when no grabber can find a link' do
|
84
85
|
before do
|
85
|
-
allow(
|
86
|
-
allow(
|
87
|
-
allow(
|
86
|
+
allow(first_grabber).to receive(:get_links).with(test_show).and_raise(DownloadTV::NoTorrentsError)
|
87
|
+
allow(second_grabber).to receive(:get_links).with(test_show).and_raise(DownloadTV::NoTorrentsError)
|
88
|
+
allow(third_grabber).to receive(:get_links).with(test_show).and_raise(DownloadTV::NoTorrentsError)
|
88
89
|
end
|
89
90
|
|
90
91
|
it 'will return an empty array' do
|
91
|
-
expect(
|
92
|
-
expect(
|
93
|
-
expect(
|
92
|
+
expect(first_grabber).to receive(:get_links).ordered
|
93
|
+
expect(second_grabber).to receive(:get_links).ordered
|
94
|
+
expect(third_grabber).to receive(:get_links).ordered
|
94
95
|
|
95
96
|
expect(subject.get_links(test_show)).to eq []
|
96
97
|
end
|
@@ -101,9 +102,9 @@ describe DownloadTV::Torrent do
|
|
101
102
|
|
102
103
|
it 'will use that grabber preferently' do
|
103
104
|
test_show = double('test_show')
|
104
|
-
expect(
|
105
|
-
expect(
|
106
|
-
expect(
|
105
|
+
expect(first_grabber).not_to receive(:get_links)
|
106
|
+
expect(second_grabber).not_to receive(:get_links)
|
107
|
+
expect(third_grabber).to receive(:get_links).with(test_show)
|
107
108
|
|
108
109
|
result = subject.get_links(test_show)
|
109
110
|
end
|
@@ -112,7 +113,7 @@ describe DownloadTV::Torrent do
|
|
112
113
|
context 'when a grabber fails on a run and it is called twice' do
|
113
114
|
before do
|
114
115
|
count = 0
|
115
|
-
allow(
|
116
|
+
allow(first_grabber).to receive(:get_links).exactly(2).times.with(test_show) do
|
116
117
|
count += 1
|
117
118
|
raise DownloadTV::NoTorrentsError if count == 1
|
118
119
|
end
|
@@ -120,9 +121,9 @@ describe DownloadTV::Torrent do
|
|
120
121
|
end
|
121
122
|
|
122
123
|
it 'the second run will use the original order' do
|
123
|
-
expect(
|
124
|
-
expect(
|
125
|
-
expect(
|
124
|
+
expect(first_grabber).to receive(:get_links).exactly(2).times
|
125
|
+
expect(second_grabber).to receive(:get_links).exactly(1).time
|
126
|
+
expect(third_grabber).not_to receive(:get_links)
|
126
127
|
|
127
128
|
result = subject.get_links(test_show)
|
128
129
|
result = subject.get_links(test_show)
|
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.8.
|
4
|
+
version: 2.8.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- guille
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|