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 +4 -4
- data/lib/e621_export_downloader/export.rb +4 -3
- data/lib/e621_export_downloader/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 43252e47acad14d67c217eb56a4a654a7e2c23b6ad94d9ae5270b4567aa783b7
|
|
4
|
+
data.tar.gz: 80937ac83a3b7e140e3ee357ae0882661de6b4e4ced8d014172adfb08067bcff
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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,
|
|
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
|
|