download_tv 2.7.0 → 2.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +1 -1
- data/lib/download_tv/configuration.rb +1 -1
- data/lib/download_tv/grabbers/eztv.rb +1 -2
- data/lib/download_tv/grabbers/torrentgalaxy.rb +23 -0
- data/lib/download_tv/torrent.rb +1 -1
- data/lib/download_tv/version.rb +1 -1
- data/spec/download_tv/torrent_spec.rb +20 -10
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13ad5f3b8009d3571a7605d9ef2c9778b15cb66c8797929e7d1d796398f57e03
|
4
|
+
data.tar.gz: bdffc3722d4433a135ecdc8bfe6e9a0b936a72f96e9aa550f28f653771acfdde
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40a783075196df666de95646d2026839e2dbbbfe335b96d6478b061b1108e56f4ddb480660922dffe577a8ed4356e0e9d4cee23026cfa7fb76b2b24a027f414b
|
7
|
+
data.tar.gz: 6dc4dbaf94c68a351fe64f89996a352f8061a78b1850c5a6080742284322b9684db05741a800811e9d9a32460a90178a86ddd935540ee7317df00eab8c9ba5d3
|
data/CHANGELOG.md
CHANGED
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 TorrentGalaxy. 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] ||= 'TorrentGalaxy'
|
144
144
|
self[:date] ||= Date.today - 1
|
145
145
|
self[:filters] ||= default_filters
|
146
146
|
self[:pending] ||= []
|
@@ -13,8 +13,7 @@ module DownloadTV
|
|
13
13
|
raw_seeders = raw_data.search('td.forum_thread_post_end').map { |e| e.children[0].text.to_i }
|
14
14
|
raw_links = raw_data.search('a.magnet').sort_by.with_index { |_, index| raw_seeders[index] }.reverse
|
15
15
|
|
16
|
-
|
17
|
-
raise NoTorrentsError if raw_links.size == 50
|
16
|
+
raise NoTorrentsError if raw_links.size == 0
|
18
17
|
|
19
18
|
raw_links.collect do |i|
|
20
19
|
[i.attribute('title').text.chomp(' Magnet Link'),
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DownloadTV
|
4
|
+
##
|
5
|
+
# TorrentGalaxy grabber
|
6
|
+
class TorrentGalaxy < LinkGrabber
|
7
|
+
def initialize
|
8
|
+
super('https://torrentgalaxy.to/torrents.php?search=%s&sort=seeders&order=desc')
|
9
|
+
end
|
10
|
+
|
11
|
+
def get_links(show)
|
12
|
+
raw_data = agent.get(format(@url, show))
|
13
|
+
rows = raw_data.search('div.tgxtablerow')
|
14
|
+
|
15
|
+
raise NoTorrentsError if rows.size == 0
|
16
|
+
|
17
|
+
rows.map do |row|
|
18
|
+
[row.children[4].text.strip,
|
19
|
+
row.children[5].children[1].attribute('href').text]
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/download_tv/torrent.rb
CHANGED
data/lib/download_tv/version.rb
CHANGED
@@ -5,14 +5,17 @@ describe DownloadTV::Torrent do
|
|
5
5
|
let(:eztv_mock) { double('eztv') }
|
6
6
|
let(:torrentz_mock) { double('torrentz') }
|
7
7
|
let(:tpb_mock) { double('tpb') }
|
8
|
+
let(:torrentgalaxy_mock) { double('torrentgalaxy') }
|
8
9
|
let(:test_show) { double('test_show') }
|
9
10
|
subject { described_class.new(default_grabber) }
|
10
11
|
|
11
12
|
before :each do
|
13
|
+
allow(DownloadTV::TorrentGalaxy).to receive(:new).and_return torrentgalaxy_mock
|
12
14
|
allow(DownloadTV::Torrentz).to receive(:new).and_return torrentz_mock
|
13
15
|
allow(DownloadTV::Eztv).to receive(:new).and_return eztv_mock
|
14
16
|
# allow(DownloadTV::ThePirateBay).to receive(:new).and_return tpb_mock
|
15
17
|
|
18
|
+
allow(torrentgalaxy_mock).to receive(:online?).and_return(true)
|
16
19
|
allow(torrentz_mock).to receive(:online?).and_return(true)
|
17
20
|
allow(eztv_mock).to receive(:online?).and_return(true)
|
18
21
|
end
|
@@ -20,7 +23,7 @@ describe DownloadTV::Torrent do
|
|
20
23
|
describe 'Torrent.grabbers' do
|
21
24
|
it 'returns the list of grabbers' do
|
22
25
|
# This order is assumed in the other specs, so explicitly checking it here
|
23
|
-
expect(described_class.grabbers).to eq %w[Torrentz Eztv]
|
26
|
+
expect(described_class.grabbers).to eq %w[TorrentGalaxy Torrentz Eztv]
|
24
27
|
|
25
28
|
end
|
26
29
|
end
|
@@ -28,19 +31,20 @@ describe DownloadTV::Torrent do
|
|
28
31
|
describe '#get_links' do
|
29
32
|
it 'will use the first grabber and return its #get_link result' do
|
30
33
|
result = double('result')
|
31
|
-
expect(
|
34
|
+
expect(torrentgalaxy_mock).to receive(:get_links).with(test_show).and_return(result)
|
32
35
|
|
33
36
|
result = subject.get_links(test_show)
|
34
37
|
end
|
35
38
|
|
36
39
|
context 'when the first grabber is offline' do
|
37
40
|
before do
|
38
|
-
allow(
|
41
|
+
allow(torrentgalaxy_mock).to receive(:online?).and_return(false)
|
39
42
|
end
|
40
43
|
|
41
44
|
it 'will use the second grabber' do
|
42
|
-
expect(
|
43
|
-
expect(
|
45
|
+
expect(torrentgalaxy_mock).not_to receive(:get_links)
|
46
|
+
expect(torrentz_mock).to receive(:get_links).with(test_show)
|
47
|
+
expect(eztv_mock).not_to receive(:get_links)
|
44
48
|
# Add other torrents here with expectation #not_to receive
|
45
49
|
|
46
50
|
result = subject.get_links(test_show)
|
@@ -49,11 +53,13 @@ describe DownloadTV::Torrent do
|
|
49
53
|
|
50
54
|
context 'when all the grabbers are offline' do
|
51
55
|
before do
|
56
|
+
allow(torrentgalaxy_mock).to receive(:online?).and_return(false)
|
52
57
|
allow(torrentz_mock).to receive(:online?).and_return(false)
|
53
58
|
allow(eztv_mock).to receive(:online?).and_return(false)
|
54
59
|
end
|
55
60
|
|
56
61
|
it 'will exit' do
|
62
|
+
expect(torrentgalaxy_mock).not_to receive(:get_links)
|
57
63
|
expect(torrentz_mock).not_to receive(:get_links)
|
58
64
|
expect(eztv_mock).not_to receive(:get_links)
|
59
65
|
|
@@ -63,12 +69,12 @@ describe DownloadTV::Torrent do
|
|
63
69
|
|
64
70
|
context 'when one grabber does not find a link' do
|
65
71
|
before do
|
66
|
-
allow(
|
72
|
+
allow(torrentgalaxy_mock).to receive(:get_links).with(test_show).and_raise(DownloadTV::NoTorrentsError)
|
67
73
|
end
|
68
74
|
|
69
75
|
it 'will keep trying until one does' do
|
76
|
+
expect(torrentgalaxy_mock).to receive(:get_links).ordered
|
70
77
|
expect(torrentz_mock).to receive(:get_links).ordered
|
71
|
-
expect(eztv_mock).to receive(:get_links).ordered
|
72
78
|
|
73
79
|
result = subject.get_links(test_show)
|
74
80
|
end
|
@@ -76,11 +82,13 @@ describe DownloadTV::Torrent do
|
|
76
82
|
|
77
83
|
context 'when no grabber can find a link' do
|
78
84
|
before do
|
85
|
+
allow(torrentgalaxy_mock).to receive(:get_links).with(test_show).and_raise(DownloadTV::NoTorrentsError)
|
79
86
|
allow(torrentz_mock).to receive(:get_links).with(test_show).and_raise(DownloadTV::NoTorrentsError)
|
80
87
|
allow(eztv_mock).to receive(:get_links).with(test_show).and_raise(DownloadTV::NoTorrentsError)
|
81
88
|
end
|
82
89
|
|
83
90
|
it 'will return an empty array' do
|
91
|
+
expect(torrentgalaxy_mock).to receive(:get_links).ordered
|
84
92
|
expect(torrentz_mock).to receive(:get_links).ordered
|
85
93
|
expect(eztv_mock).to receive(:get_links).ordered
|
86
94
|
|
@@ -93,6 +101,7 @@ describe DownloadTV::Torrent do
|
|
93
101
|
|
94
102
|
it 'will use that grabber preferently' do
|
95
103
|
test_show = double('test_show')
|
104
|
+
expect(torrentgalaxy_mock).not_to receive(:get_links)
|
96
105
|
expect(torrentz_mock).not_to receive(:get_links)
|
97
106
|
expect(eztv_mock).to receive(:get_links).with(test_show)
|
98
107
|
|
@@ -103,7 +112,7 @@ describe DownloadTV::Torrent do
|
|
103
112
|
context 'when a grabber fails on a run and it is called twice' do
|
104
113
|
before do
|
105
114
|
count = 0
|
106
|
-
allow(
|
115
|
+
allow(torrentgalaxy_mock).to receive(:get_links).exactly(2).times.with(test_show) do
|
107
116
|
count += 1
|
108
117
|
raise DownloadTV::NoTorrentsError if count == 1
|
109
118
|
end
|
@@ -111,8 +120,9 @@ describe DownloadTV::Torrent do
|
|
111
120
|
end
|
112
121
|
|
113
122
|
it 'the second run will use the original order' do
|
114
|
-
expect(
|
115
|
-
expect(
|
123
|
+
expect(torrentgalaxy_mock).to receive(:get_links).exactly(2).times
|
124
|
+
expect(torrentz_mock).to receive(:get_links).exactly(1).time
|
125
|
+
expect(eztv_mock).not_to receive(:get_links)
|
116
126
|
|
117
127
|
result = subject.get_links(test_show)
|
118
128
|
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.
|
4
|
+
version: 2.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- guille
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -132,6 +132,7 @@ files:
|
|
132
132
|
- lib/download_tv/downloader.rb
|
133
133
|
- lib/download_tv/filterer.rb
|
134
134
|
- lib/download_tv/grabbers/eztv.rb
|
135
|
+
- lib/download_tv/grabbers/torrentgalaxy.rb
|
135
136
|
- lib/download_tv/grabbers/torrentz.rb
|
136
137
|
- lib/download_tv/grabbers/tpb.rb
|
137
138
|
- lib/download_tv/linkgrabber.rb
|