kindai 1.7.0 → 1.7.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.7.0
1
+ 1.7.1
data/kindai.gemspec CHANGED
@@ -5,15 +5,14 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{kindai}
8
- s.version = "1.7.0"
8
+ s.version = "1.7.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["hitode909"]
12
- s.date = %q{2011-05-24}
13
- s.default_executable = %q{kindai.rb}
11
+ s.authors = [%q{hitode909}]
12
+ s.date = %q{2011-10-23}
14
13
  s.description = %q{kindai.rb is kindai digital library downloader.}
15
14
  s.email = %q{hitode909@gmail.com}
16
- s.executables = ["kindai.rb"]
15
+ s.executables = [%q{kindai.rb}]
17
16
  s.extra_rdoc_files = [
18
17
  "LICENSE.txt",
19
18
  "README.rdoc"
@@ -48,10 +47,10 @@ Gem::Specification.new do |s|
48
47
  "spec/spread_spec.rb"
49
48
  ]
50
49
  s.homepage = %q{http://github.com/hitode909/kindairb}
51
- s.licenses = ["MIT"]
52
- s.rdoc_options = ["--main", "README.rdoc", "--exclude", "spec"]
53
- s.require_paths = ["lib"]
54
- s.rubygems_version = %q{1.5.2}
50
+ s.licenses = [%q{MIT}]
51
+ s.rdoc_options = [%q{--main}, %q{README.rdoc}, %q{--exclude}, %q{spec}]
52
+ s.require_paths = [%q{lib}]
53
+ s.rubygems_version = %q{1.8.6}
55
54
  s.summary = %q{kindai digital library downloader}
56
55
  s.test_files = [
57
56
  "spec/book_downloader_spec.rb",
data/lib/kindai/book.rb CHANGED
@@ -51,8 +51,8 @@ module Kindai
51
51
  Kindai::Util.logger.debug "fetch permalink page"
52
52
  page_uri = URI.parse(permalink_uri) + permalink_page.at('frame[name="W_BODY"]')['src']
53
53
 
54
- page_file = Kindai::Util.fetch_uri page_uri.to_s
55
- uri = page_file.base_uri.to_s + '&vs=10000,10000,0,0,0,0,0,0'
54
+ page_base_uri = Kindai::Util.get_redirected_uri page_uri.to_s
55
+ uri = page_base_uri.to_s + '&vs=10000,10000,0,0,0,0,0,0'
56
56
  unless self.trimming.keys.empty?
57
57
  %w{x y w h resize_w resize_h}.map(&:to_sym).each{ |key|
58
58
  self.trimming[key] ||= 0
data/lib/kindai/util.rb CHANGED
@@ -4,6 +4,7 @@ require 'tempfile'
4
4
  require 'digest/sha1'
5
5
  require 'RMagick'
6
6
  require 'zipruby'
7
+ require 'net/http'
7
8
 
8
9
  module Kindai::Util
9
10
  def self.logger
@@ -115,6 +116,17 @@ module Kindai::Util
115
116
  return got
116
117
  end
117
118
 
119
+ def self.get_redirected_uri(uri)
120
+ uri = URI.parse(uri) unless uri.kind_of? URI
121
+ self.logger.debug "get_redirected_uri #{uri}"
122
+
123
+ response = nil
124
+ Net::HTTP.start(uri.host, uri.port) {|http|
125
+ response = http.head(uri.request_uri)
126
+ }
127
+ response['Location']
128
+ end
129
+
118
130
  def self.trim_info_auto(book, files)
119
131
  info = nil
120
132
  item = Kindai::Util::Database.item_for_book(book)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kindai
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.7.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-05-24 00:00:00.000000000 +09:00
13
- default_executable: kindai.rb
12
+ date: 2011-10-23 00:00:00.000000000Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: nokogiri
17
- requirement: &2156017080 !ruby/object:Gem::Requirement
16
+ requirement: &70353209086680 !ruby/object:Gem::Requirement
18
17
  none: false
19
18
  requirements:
20
19
  - - ! '>='
@@ -22,10 +21,10 @@ dependencies:
22
21
  version: '0'
23
22
  type: :runtime
24
23
  prerelease: false
25
- version_requirements: *2156017080
24
+ version_requirements: *70353209086680
26
25
  - !ruby/object:Gem::Dependency
27
26
  name: rmagick
28
- requirement: &2156014800 !ruby/object:Gem::Requirement
27
+ requirement: &70353209086100 !ruby/object:Gem::Requirement
29
28
  none: false
30
29
  requirements:
31
30
  - - ! '>='
@@ -33,10 +32,10 @@ dependencies:
33
32
  version: '0'
34
33
  type: :runtime
35
34
  prerelease: false
36
- version_requirements: *2156014800
35
+ version_requirements: *70353209086100
37
36
  - !ruby/object:Gem::Dependency
38
37
  name: zipruby
39
- requirement: &2156013420 !ruby/object:Gem::Requirement
38
+ requirement: &70353209085380 !ruby/object:Gem::Requirement
40
39
  none: false
41
40
  requirements:
42
41
  - - ! '>='
@@ -44,10 +43,10 @@ dependencies:
44
43
  version: '0'
45
44
  type: :runtime
46
45
  prerelease: false
47
- version_requirements: *2156013420
46
+ version_requirements: *70353209085380
48
47
  - !ruby/object:Gem::Dependency
49
48
  name: json
50
- requirement: &2156012280 !ruby/object:Gem::Requirement
49
+ requirement: &70353209084740 !ruby/object:Gem::Requirement
51
50
  none: false
52
51
  requirements:
53
52
  - - ! '>='
@@ -55,10 +54,10 @@ dependencies:
55
54
  version: '1.4'
56
55
  type: :runtime
57
56
  prerelease: false
58
- version_requirements: *2156012280
57
+ version_requirements: *70353209084740
59
58
  - !ruby/object:Gem::Dependency
60
59
  name: rspec
61
- requirement: &2156011420 !ruby/object:Gem::Requirement
60
+ requirement: &70353209084220 !ruby/object:Gem::Requirement
62
61
  none: false
63
62
  requirements:
64
63
  - - ~>
@@ -66,10 +65,10 @@ dependencies:
66
65
  version: 2.3.0
67
66
  type: :development
68
67
  prerelease: false
69
- version_requirements: *2156011420
68
+ version_requirements: *70353209084220
70
69
  - !ruby/object:Gem::Dependency
71
70
  name: bundler
72
- requirement: &2156010180 !ruby/object:Gem::Requirement
71
+ requirement: &70353209083580 !ruby/object:Gem::Requirement
73
72
  none: false
74
73
  requirements:
75
74
  - - ~>
@@ -77,10 +76,10 @@ dependencies:
77
76
  version: 1.0.0
78
77
  type: :development
79
78
  prerelease: false
80
- version_requirements: *2156010180
79
+ version_requirements: *70353209083580
81
80
  - !ruby/object:Gem::Dependency
82
81
  name: jeweler
83
- requirement: &2156008360 !ruby/object:Gem::Requirement
82
+ requirement: &70353209080900 !ruby/object:Gem::Requirement
84
83
  none: false
85
84
  requirements:
86
85
  - - ~>
@@ -88,10 +87,10 @@ dependencies:
88
87
  version: 1.5.2
89
88
  type: :development
90
89
  prerelease: false
91
- version_requirements: *2156008360
90
+ version_requirements: *70353209080900
92
91
  - !ruby/object:Gem::Dependency
93
92
  name: rcov
94
- requirement: &2156004900 !ruby/object:Gem::Requirement
93
+ requirement: &70353209072700 !ruby/object:Gem::Requirement
95
94
  none: false
96
95
  requirements:
97
96
  - - ! '>='
@@ -99,7 +98,7 @@ dependencies:
99
98
  version: '0'
100
99
  type: :development
101
100
  prerelease: false
102
- version_requirements: *2156004900
101
+ version_requirements: *70353209072700
103
102
  description: kindai.rb is kindai digital library downloader.
104
103
  email: hitode909@gmail.com
105
104
  executables:
@@ -136,7 +135,6 @@ files:
136
135
  - spec/spec_helper.rb
137
136
  - spec/spread_downloader_spec.rb
138
137
  - spec/spread_spec.rb
139
- has_rdoc: true
140
138
  homepage: http://github.com/hitode909/kindairb
141
139
  licenses:
142
140
  - MIT
@@ -156,7 +154,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
156
154
  version: '0'
157
155
  segments:
158
156
  - 0
159
- hash: 4261753351778255770
157
+ hash: 3219370653941978797
160
158
  required_rubygems_version: !ruby/object:Gem::Requirement
161
159
  none: false
162
160
  requirements:
@@ -165,7 +163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
165
163
  version: '0'
166
164
  requirements: []
167
165
  rubyforge_project:
168
- rubygems_version: 1.5.2
166
+ rubygems_version: 1.8.6
169
167
  signing_key:
170
168
  specification_version: 3
171
169
  summary: kindai digital library downloader