e621_export_downloader 0.0.14 → 0.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 89d525162aa1da43623f66a8bab4618ac17910c2c3e0db7a272e8149be91efb8
4
- data.tar.gz: 6152f2a56d9ad995dd5868f2762d4a95c38e2b4d95a289b8806ef74870b50ea7
3
+ metadata.gz: 43252e47acad14d67c217eb56a4a654a7e2c23b6ad94d9ae5270b4567aa783b7
4
+ data.tar.gz: 80937ac83a3b7e140e3ee357ae0882661de6b4e4ced8d014172adfb08067bcff
5
5
  SHA512:
6
- metadata.gz: 494ccb09c9727311ec327cdc8926816bd0957f9d0a9455b6b5789364b30d4728d95763a99707b5861fb1d858092acaed1c220abd97dfb22f3f66e9de05fc6eaf
7
- data.tar.gz: a0dbdb4a693365f88b5986ffcdef1a23190a3c6ce85e98297d344bf74b91bf4794700d5f0cdf4ab087cb695e0017f6464d21dfe5013419a29930d438e1786f43
6
+ metadata.gz: 7720d7aef0ee5766d73228f5c7dad458ed0259c7e23b36c68b2bd276ebd4a44fccea5906c1a5f25b8d755d689dbda3072fecaf961fe34f8231472d434b3c842f
7
+ data.tar.gz: 859435375a092f027b814399106cdbdebcea9643587634d54b0d4db166006c1305e27e914edb1d471188220c3fd57cc0da89c71bb6734d0f813ec7b662ea2551
@@ -40,8 +40,8 @@ module E621ExportDownloader
40
40
  true
41
41
  end
42
42
 
43
- sig { returns(String) }
44
- def download
43
+ sig { params(block: T.nilable(T.proc.params(received: Integer, total: Integer).void)).returns(String) }
44
+ def download(&block)
45
45
  raise(ResolveError, "Export #{type.serialize} does not exist") unless exists?
46
46
  if check_downloaded
47
47
  client.debug("using cached export", header: ["export:#{type.serialize}"])
@@ -55,9 +55,10 @@ module E621ExportDownloader
55
55
  inflater = Zlib::Inflate.new(Zlib::MAX_WBITS + 16)
56
56
 
57
57
  res = client.connection.get(data.url) do |req|
58
- req.options.on_data = proc do |chunk, _total|
58
+ req.options.on_data = proc do |chunk, received|
59
59
  decompressed = inflater.inflate(chunk)
60
60
  file.write(decompressed) if decompressed && !decompressed.empty?
61
+ block.call(received, data.file_size) if block
61
62
  end
62
63
  end
63
64
 
@@ -4,7 +4,7 @@
4
4
  # loaded by bundler
5
5
  module E621ExportDownloader
6
6
  module Constants
7
- VERSION = "0.0.14"
7
+ VERSION = "0.0.15"
8
8
  WEBSITE = "https://github.com/DonovanDMC/E621ExportDownloader.rb"
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: e621_export_downloader
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.14
4
+ version: 0.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Donovan_DMC