comic_walker 0.2.1 → 0.2.2

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: bc332a43582cb967395943b6013f0ab99fcf5fdd
4
- data.tar.gz: 6069256b1d66ef11fadea09a3244b8d71ccc1511
3
+ metadata.gz: 31c86d5ee6917c1d2443b444ad0af64ea30312b7
4
+ data.tar.gz: ad9a19cdaba4cc3ef9e78caaf4283e1024e25e1e
5
5
  SHA512:
6
- metadata.gz: 102121a8021d81e8e198bac79376c903d28519ae1809cac411cc0aad7f675f29d6030d5800576b4b59a363009e8ae5f5c2e93055b26b3314e065abdb3f140f47
7
- data.tar.gz: acd044111e10b6f6e4268432b5bc5bc66da3670499bfb911389def51acd682c4267b4f82a26705e94513b98b665293f3600bb099993d07ca367ccc964e4788ac
6
+ metadata.gz: 484678c62454decd50c4153b0f3b9f2ab5e018f4cf08d26ffa61196a3d3132968a1c6cf09df458aef884a179874936c90e4d3a5fdadcb18989eaee0b83d56034
7
+ data.tar.gz: 0265eec741fde6d0d8a647d4023ab5578e66d3e6917341295fa5fe53c8d414606965a12225da895d2dedb9bdad3c688555b2be4cf54f4d16c5358e368de2ccce
@@ -1,3 +1,6 @@
1
+ # 0.2.2 (2014-05-11)
2
+ - Fix image fetch errors for recent comics
3
+
1
4
  # 0.2.1 (2014-04-19)
2
5
  - Take account of dummy width and height (#2)
3
6
 
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # ComicWalker
2
2
  [![Gem Version](https://badge.fury.io/rb/comic_walker.svg)](http://badge.fury.io/rb/comic_walker)
3
+ [![Code Climate](https://codeclimate.com/github/eagletmt/comic_walker.png)](https://codeclimate.com/github/eagletmt/comic_walker)
3
4
 
4
5
  Client library for [ComicWalker](http://comic-walker.com/).
5
6
 
@@ -101,11 +101,15 @@ module ComicWalker
101
101
  img_dir = Pathname.new(title).join(cid).tap(&:mkpath)
102
102
  decoder.pages.each.with_index do |file, i|
103
103
  dat_path = Pathname.new(file).join('0.dat')
104
- data = items[dat_path.to_s]
105
104
  img_fname = dat_path.parent.basename.sub_ext('.jpg')
106
105
  img_path = img_dir.join(sprintf('%03d_%s', i, img_fname))
106
+
107
+ if data = items[dat_path.to_s]
108
+ decoder.decode_b64(file, dat_path, img_path, data)
109
+ else
110
+ decoder.decode(file, dat_path, img_path, license.get_jpeg(file))
111
+ end
107
112
  puts "#{dat_path} -> #{img_path}"
108
- decoder.decode(file, dat_path, img_path, data)
109
113
  end
110
114
  end
111
115
  end
@@ -15,11 +15,15 @@ module ComicWalker
15
15
  end
16
16
 
17
17
  def jar_url
18
- agreement['url_prefix'] + agreement['jar_file_name']
18
+ url_prefix + agreement['jar_file_name']
19
19
  end
20
20
 
21
21
  def info_url
22
- agreement['url_prefix'] + agreement['info_file_name']
22
+ url_prefix + agreement['info_file_name']
23
+ end
24
+
25
+ def url_prefix
26
+ agreement['url_prefix']
23
27
  end
24
28
 
25
29
  def key
@@ -41,6 +45,13 @@ module ComicWalker
41
45
  end
42
46
  JSON.parse(body)
43
47
  end
48
+
49
+ def get_jpeg(file)
50
+ uri = Addressable::URI.parse(url_prefix + file + '/0.jpeg')
51
+ Net::HTTP.start(uri.host) do |http|
52
+ http.get(uri.request_uri).body
53
+ end
54
+ end
44
55
  end
45
56
  end
46
57
  end
@@ -5,11 +5,15 @@ module ComicWalker
5
5
  class ItemDecoder
6
6
  attr_reader :pages
7
7
 
8
+ DEFAULT_CT = '20000101000000'
9
+ DEFAULT_ST = '20000101000000'
10
+ DEFAULT_ET = '99991231235959'
11
+
8
12
  def initialize(configuration_pack)
9
13
  fname = '0.dat'
10
- ct = configuration_pack['ct']
11
- st = configuration_pack['st']
12
- et = configuration_pack['et']
14
+ ct = configuration_pack['ct'] || DEFAULT_CT
15
+ st = configuration_pack['st'] || DEFAULT_ST
16
+ et = configuration_pack['et'] || DEFAULT_ET
13
17
  @key1 = (ct + st + fname).unpack('C*')
14
18
  @key2 = (ct + fname + et).unpack('C*')
15
19
  @key3 = (fname + st + et).unpack('C*')
@@ -23,7 +27,7 @@ module ComicWalker
23
27
  end
24
28
  end
25
29
 
26
- def decode(file, dat_path, img_path, b64data)
30
+ def decode_b64(file, dat_path, img_path, b64data)
27
31
  bs = 128
28
32
  hs = 1024
29
33
  blob = Unknown.finish(@key1, hs,
@@ -33,7 +37,10 @@ module ComicWalker
33
37
  )
34
38
  )
35
39
  ).pack('C*')
40
+ decode(file, dat_path, img_path, blob)
41
+ end
36
42
 
43
+ def decode(file, dat_path, img_path, blob)
37
44
  src = Magick::Image.from_blob(blob).first
38
45
  width = src.columns
39
46
  height = src.rows
@@ -1,5 +1,5 @@
1
1
  module ComicWalker
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
 
4
- VIEWER_VERSION = "1.0.2_2014-03-20"
4
+ VIEWER_VERSION = "1.0.5_2014-04-11"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: comic_walker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kohei Suzuki
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-19 00:00:00.000000000 Z
11
+ date: 2014-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler