addic7ed_downloader 0.1.2 → 0.2.0

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
  SHA1:
3
- metadata.gz: 7e8291a5cc00db31a5135428ffbe38b85af7026b
4
- data.tar.gz: acacc9165cdd48303465df2debec24abc6c4b192
3
+ metadata.gz: dcc85a21ccc66665f2bf28228748d05d60a4339f
4
+ data.tar.gz: 6be27f833387ee0233d30ebe0e42bfd8605c5d55
5
5
  SHA512:
6
- metadata.gz: c520ba0be1e905eb0bc8042c68d1fc8d332a9c6000e67bc9ef39e2408a8d154fda43623b83b1321beb150f5cdc4eca1c6758b2545df36a32cecbecc5b3c4f526
7
- data.tar.gz: 91e6a2056e1689d4a9100d078db36a197a23ad94529ea460debf61425cf684c8af97a12ce4aa5e9abf277c7ba44617acbf09891d102a63869cbb8a647687703a
6
+ metadata.gz: 7021f4a337497712c2869a395d48cde95c3db6e780f672d98db798dce9ab84ae5590f15dbb3a24e4cb2bde8e3301a00934c509373600db66bb004c85c5b344eb
7
+ data.tar.gz: d64063f420440ad2e1b614587e347d8459830d36c9673584ad7bf8498213acd94fb2c95bd6c2610a7e0e8c507ae34e76eb4b9f478f49a4b9599b9384dbc6cc9e
@@ -47,10 +47,9 @@ module Addic7edDownloader
47
47
  return if results.empty?
48
48
 
49
49
  # We can refine the search with tags
50
- # Only version match
51
50
  unless @tags.empty?
52
51
  results.each do |subtitle|
53
- return subtitle if @tags.include?(subtitle.version) && subtitle.completed?
52
+ return subtitle if @tags.any? { |tag| subtitle.works_with?(tag) }
54
53
  end
55
54
  end
56
55
 
@@ -102,7 +101,9 @@ module Addic7edDownloader
102
101
  list << Subtitle.new(subtitle) if subtitle.at('.NewsTitle')
103
102
  end
104
103
 
105
- subtitles.sort!.reverse!
104
+ # We return the completed subtitles, ordered by downloads desc
105
+ # Using bang methods for memory performance
106
+ subtitles.select(&:completed?).sort!.reverse!
106
107
  end
107
108
  end
108
109
  end
@@ -34,7 +34,7 @@ module Addic7edDownloader
34
34
  end
35
35
 
36
36
  def works_with?(tag)
37
- @notes[/works? with \"?([^\"\s]+)/i, 1].downcase.include? tag.downcase
37
+ @version.include?(tag) || @notes[/works? with \"?([^\"\s]+)/i, 1]&.include?(tag)
38
38
  end
39
39
 
40
40
  private
@@ -1,3 +1,3 @@
1
1
  module Addic7edDownloader
2
- VERSION = '0.1.2'.freeze
2
+ VERSION = '0.2.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: addic7ed_downloader
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Marchante
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-05-08 00:00:00.000000000 Z
11
+ date: 2016-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri