download_tv 2.4.6 → 2.4.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e377266cc2744dc9f250731064ea8c72bc41a1b7395e1d7f08d04df6e659fb6c
4
- data.tar.gz: 9761596d5643b869e501c6f6df18343944050c10f946cefd09c604ff88a301ae
3
+ metadata.gz: 3da65f8f28fbd1c2d76d9166e5e5ed8e13ddf77546e63a43955d88ca60b226da
4
+ data.tar.gz: 526cc3fffa489f0e4f9b568b196bc0c468958fab56f46e72b0fe1222b515aa62
5
5
  SHA512:
6
- metadata.gz: 2cb1468ca23f32f8a172c7d0142a2177251ac3def0c3f66c64bd63295c1b9ac431e075c897004577332a13219e74c76d16429083b0c4986fe0f4651b5797af8b
7
- data.tar.gz: 8525d7675966c1924cbb4e48740e59d2834c9c082668f87e00e1f813aea81ac7cdbdd6d8d8b63840b73e202beb8539425a0be2d7c88d95eeaf274948d397f05e
6
+ metadata.gz: 0aa3b30cf80314fe1cc88b83a89b1d548a81fd787b38b3aed26433263de54f09288e05413f0eb64654ad2a4d6acfc4c4ae82e780b37a98a40e59bf33b1857475
7
+ data.tar.gz: 738b270056911835ac14e073d8067376f43dc2dce4bdaddc7a8c36c38f3eb90ff5adddcd68f387f81d5f71a88aca831684fc086f82b859b90a089e4c2bd41f08
@@ -2,7 +2,7 @@ module DownloadTV
2
2
  ##
3
3
  # Entry point of the application
4
4
  class Downloader
5
- attr_reader :offset, :config
5
+ attr_reader :config
6
6
 
7
7
  def initialize(config = {})
8
8
  @config = Configuration.new(config) # Load configuration
@@ -7,13 +7,16 @@ module DownloadTV
7
7
  end
8
8
 
9
9
  def get_links(s)
10
+ tries = 0
11
+ max_tries = 5
12
+
10
13
  params = {
11
14
  'category': 'TV',
12
15
  'orderby': 'seeds-desc',
13
16
  'search': s
14
17
  }
15
18
 
16
- data = @agent.post(@url, params).search('table.torrents_table tbody tr td[1]')
19
+ data = @agent.post(@url, params).search('tbody tr td[1]')
17
20
 
18
21
  names = data.map { |i| i.search('a.torrents_table__torrent_title b').text }
19
22
  links = data.map { |i| i.search('div.torrents_table__actions a[3]').first.attribute('href').text }
@@ -21,6 +24,11 @@ module DownloadTV
21
24
  raise NoTorrentsError if data.empty?
22
25
 
23
26
  names.zip(links)
27
+ rescue Net::HTTP::Persistent::Error => e
28
+ raise unless e.message =~ /too many connection resets/
29
+ raise if tries >= max_tries
30
+ tries += 1
31
+ retry
24
32
  end
25
33
  end
26
34
  end
@@ -5,8 +5,7 @@ module DownloadTV
5
5
  attr_reader :g_instances, :tries
6
6
 
7
7
  def grabbers
8
- # %w[TorrentAPI ThePirateBay Eztv KAT]
9
- %w[TorrentAPI ThePirateBay Eztv]
8
+ %w[TorrentAPI ThePirateBay Eztv KAT]
10
9
  end
11
10
 
12
11
  def initialize(default_grabber = nil)
@@ -1,3 +1,3 @@
1
1
  module DownloadTV
2
- VERSION = '2.4.6'.freeze
2
+ VERSION = '2.4.7'.freeze
3
3
  end
data/test/torrent_test.rb CHANGED
@@ -1,17 +1,18 @@
1
1
  require 'test_helper'
2
2
 
3
3
  describe DownloadTV::Torrent do
4
+ grabber_names = DownloadTV::Torrent.new(nil).grabbers
4
5
  describe 'when creating the object' do
5
6
  before do
6
7
  @t = DownloadTV::Torrent.new
7
8
  end
8
9
 
9
10
  it 'will populate the instances' do
10
- @t.g_instances.size.must_equal @t.grabbers.size
11
+ @t.g_instances.size.must_equal grabber_names.size
11
12
  end
12
13
 
13
14
  it 'will start with all tries available' do
14
- @t.tries.must_equal @t.grabbers.size - 1
15
+ @t.tries.must_equal grabber_names.size - 1
15
16
  end
16
17
 
17
18
  it 'will call get_links on its grabber' do
@@ -24,11 +25,11 @@ describe DownloadTV::Torrent do
24
25
  describe 'when giving it a default grabber' do
25
26
  it 'has a default order' do
26
27
  t = DownloadTV::Torrent.new(nil)
27
- expected = t.grabbers.map { |i| "DownloadTV::#{i}"}
28
+ expected = grabber_names.map { |i| "DownloadTV::#{i}"}
28
29
  t.g_instances.map { |i| i.class.name}.must_equal expected
29
30
  end
30
31
 
31
- %w[Eztv KAT ThePirateBay TorrentAPI].each do |g|
32
+ grabber_names.each do |g|
32
33
  it 'correctly uses the given grabber first' do
33
34
  t = DownloadTV::Torrent.new(g)
34
35
  t.g_instances.first.class.name.must_equal "DownloadTV::#{g}"
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.6
4
+ version: 2.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - guille
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-19 00:00:00.000000000 Z
11
+ date: 2018-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler