download_tv 2.7.0 → 2.8.0
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/CHANGELOG.md +5 -0
- data/README.md +1 -1
- data/lib/download_tv/configuration.rb +1 -1
- 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: f8276a91948a8fc6701546da7229c00f1789a3fe1e992766189bf7ffe8bcbe0a
|
|
4
|
+
data.tar.gz: 3fa1290e6b9a9280562776a43ec9f202840edfc882a5884a3abc492aed2143c4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e45a182bed172f934e9dc0eb84feb65ee69b14df387fad4409b6ddc4f0e9bcf5e832c47e8217897298e193104dcf005b70c7e234564be3142b381a10bea8ae6b
|
|
7
|
+
data.tar.gz: 1c95a6c3cbdb3f9201f43b7d536f412e09879bea63c2352e59412dfd0f453b5ca59b37eceb30ba8429f97cef90d80922ad011e881819d0a059e03b39a87960f2
|
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] ||= []
|
|
@@ -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.0
|
|
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-06-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
|