image-dumper 0.6 → 0.6.1

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: d620c7ba1dbc1bd22e170e520822d8711c1fd1f8
4
- data.tar.gz: 61eb44fd3c2ed01b948acb3993081437bf65b8ca
3
+ metadata.gz: b87f39b372cb14a7ef17e6e5da413b6337e7c5b0
4
+ data.tar.gz: 29f982e0c28c2dd7448c17eff1a92d8f8190df1d
5
5
  SHA512:
6
- metadata.gz: 8e7a28e8d7fb7b2ee24043ae8c3cbdbbcfe5ec7b1267a1445cf20d54cfd641bd0e586b1da3db9f983e61b0b8f77ecff178df72be1a54cbe467965e620c410d33
7
- data.tar.gz: b6381b814c485917103bb4bb15ed6bf6aa2092e47ad5e963f2480fd649445e8800aba1e7371e92bb183d459a7bbc2cfe84eaea5b7dd57606d7b340423ceff009
6
+ metadata.gz: 0d65683e728928a776b7333067a39ed1d8eb8da9b78ac956ee9874d68c68f4e5d7423e5f3f3fa55248b128fa81124bcb35d8231082774e3b26988db998143526
7
+ data.tar.gz: fb762aa7438ac757a50faaae629ec068dbbf6a1f5bc812d6ab78bf69eb6425194360fc464c2cd4d3d49e26df31c9706067408b8804304fb9e9e12ee09da81e30
data/lib/dumper.rb CHANGED
@@ -3,18 +3,18 @@
3
3
  #
4
4
  # This file is part of Dumper.
5
5
  #
6
- # Smogon-API is free software: you can redistribute it and/or modify
6
+ # Dumper is free software: you can redistribute it and/or modify
7
7
  # it under the terms of the GNU General Public License as published by
8
8
  # the Free Software Foundation, either version 3 of the License, or
9
9
  # (at your option) any later version.
10
10
  #
11
- # Smogon-API is distributed in the hope that it will be useful,
11
+ # Dumper is distributed in the hope that it will be useful,
12
12
  # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
13
  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
14
  # GNU General Public License for more details.
15
15
  #
16
16
  # You should have received a copy of the GNU General Public License
17
- # along with Smogon-API. If not, see <http://www.gnu.org/licenses/>.
17
+ # along with Dumper. If not, see <http://www.gnu.org/licenses/>.
18
18
  #++
19
19
 
20
20
  require 'open-uri'
@@ -33,19 +33,15 @@ module Dumper
33
33
 
34
34
  page = Nokogiri::HTML open("http://www.mangaeden.com#{p['href']}")
35
35
 
36
- page.xpath('//img[@id="mainImg"]/@src').each { |r|
37
- Dumper::Profiles.get dir, r, { filename: '1.png' }
38
- i += 1
39
- }
36
+ Dumper::Profiles.get dir, page.at_xpath('//img[@id="mainImg"]/@src'), { filename: '1.png' }
37
+ i += 1
40
38
 
41
39
  page.xpath('//a[@class="ui-state-default"]').each { |q|
42
- next unless q.text.numeric?
43
- q = q['href']
40
+ next unless q.text.numeric?
44
41
 
45
- Nokogiri::HTML(open("http://www.mangaeden.com#{q}")).xpath('//img[@id="mainImg"]/@src').each { |r|
42
+ Nokogiri::HTML(open("http://www.mangaeden.com#{q['href']}")).xpath('//img[@id="mainImg"]/@src').each { |r|
46
43
  @pool.process {
47
- Dumper::Profiles.get dir, r, { filename: "#{i}.png" }
48
- i += 1
44
+ Dumper::Profiles.get dir, r, { filename: "#{q.text.to_i}.png" }
49
45
  }
50
46
  }
51
47
  }
@@ -36,16 +36,10 @@ module Dumper
36
36
  dir = File.join path, name.sanitize_filename
37
37
  Dir.mkdir(dir) unless File.directory? dir
38
38
 
39
- option = Nokogiri::HTML(open(chapter)).xpath '//select[@class="wid60"]/option'
40
- first = option.first.text.to_i
41
- last = option.last.text.to_i
42
-
43
- first.upto(last) { |i|
39
+ Nokogiri::HTML(open(chapter)).xpath('//select[@class="wid60"]/option').each { |q|
44
40
  @pool.process {
45
- url = chapter.gsub(/\/[0-9]+\.html/, '') + i.to_s + '.html'
46
-
47
- scan = Nokogiri::HTML(open(url)).xpath('//section[@id="viewer"]/a/img/@src')[0].to_s
48
- Dumper::Profiles.get dir, scan, { filename: "#{i}.png" }
41
+ scan = Nokogiri::HTML(open(q['value'])).xpath('//section[@id="viewer"]/a/img/@src')[0].to_s
42
+ Dumper::Profiles.get dir, scan, { filename: "#{q.text}.png" }
49
43
  }
50
44
  }
51
45
  }
@@ -19,6 +19,6 @@
19
19
 
20
20
  module Dumper
21
21
  def self.version
22
- '0.6'
22
+ '0.6.1'
23
23
  end
24
24
  end
@@ -14,15 +14,15 @@ describe 'Dumper' do
14
14
  end
15
15
 
16
16
  it 'dumps a gallery from imagebam' do
17
- url = 'http://www.imagebam.com/gallery/ab4f428e9eec0c70bc53b27cfb91d902/'
17
+ url = 'http://www.imagebam.com/gallery/sb7rsktifbm6h2lpz6einoq6mou3j57k/'
18
18
  Dumper::Profiles.get_imagebam url, @dir
19
19
 
20
20
  images = Dir["#{@dir}/*"]
21
- expect(images.length).to be >= 94
21
+ expect(images.length).to be 67
22
22
 
23
23
  image = FastImage.size images.last
24
24
  expect(image).to be_kind_of(Array)
25
25
 
26
- expect(image.first).to be 511
26
+ expect(image.first).to be >= 500
27
27
  end
28
28
  end
@@ -18,11 +18,11 @@ describe 'Dumper' do
18
18
  Dumper::Profiles.get_mangaeden url, @dir, 1, 2
19
19
 
20
20
  images = Dir["#{@dir}/*_Question/*"]
21
- expect(images.length).to be 24
21
+ expect(images.length).to be 27
22
22
 
23
23
  image = FastImage.size images.first
24
24
  expect(image).to be_kind_of(Array)
25
25
 
26
- expect(image.first).to be 899
26
+ expect(image.first).to be > 500
27
27
  end
28
28
  end
@@ -20,9 +20,9 @@ describe 'Dumper' do
20
20
  images = Dir["#{@dir}/*_2/*"]
21
21
  expect(images.length).to be 41
22
22
 
23
- image = FastImage.size images.last
23
+ image = FastImage.size images.first
24
24
  expect(image).to be_kind_of(Array)
25
25
 
26
- expect(image.first).to be 730
26
+ expect(image.first).to be >= 453
27
27
  end
28
28
  end
@@ -23,6 +23,6 @@ describe 'Dumper' do
23
23
  image = FastImage.size images.last
24
24
  expect(image).to be_kind_of(Array)
25
25
 
26
- expect(image.first).to be 650
26
+ expect(image.first).to be >= 300
27
27
  end
28
28
  end
@@ -36,6 +36,6 @@ describe 'Dumper' do
36
36
  image = FastImage.size images.last
37
37
  expect(image).to be_kind_of(Array)
38
38
 
39
- expect(image.first).to be >= 400
39
+ expect(image.first).to be >= 240
40
40
  end
41
41
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: image-dumper
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.6'
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Giovanni Capuano
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-28 00:00:00.000000000 Z
11
+ date: 2014-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -181,7 +181,7 @@ files:
181
181
  - spec/teca_spec.rb
182
182
  - spec/yande_spec.rb
183
183
  - bin/dumper
184
- homepage: http://www.giovannicapuano.net
184
+ homepage: https://github.com/RoxasShadow
185
185
  licenses:
186
186
  - GPL-3
187
187
  metadata: {}