Sha256: 0d9385c15c88dbc15d59b7a417b924376a61f565db0fe40c1cc5abb11ed1b7d0
Contents?: true
Size: 825 Bytes
Versions: 1
Compression:
Stored size: 825 Bytes
Contents
module ComicWalker class ContentDownloader def initialize(client, cid) @client = client @cid = cid end def save license = @client.get_license(@cid) decoder = ItemDecoder.new(license.get_configuration_pack) img_dir = image_dir(license) decoder.pages.each.with_index do |file, i| dat_path = Pathname.new(file).join('0.dat') img_fname = dat_path.parent.basename.sub_ext('.jpg') img_path = img_dir.join(sprintf('%03d_%s', i, img_fname)) decoder.decode(file, dat_path, img_path, license.get_jpeg(file)) puts "#{dat_path} -> #{img_path}" end end def image_dir(license) info = license.get_info.first title = info['issues'].first['content_name'] Pathname.new(title).join(@cid).tap(&:mkpath) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
comic_walker-0.3.0 | lib/comic_walker/content_downloader.rb |