dronejob 1.1.7 → 1.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/dronejob/version.rb +1 -1
- data/lib/dronejob/workspace_file/media.rb +2 -2
- data/lib/dronejob/workspace_file/net.rb +10 -8
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72e95a002487cbd82ec7e7d4624f0ca3b6b8f2ba
|
4
|
+
data.tar.gz: 5f91348f2960eeed742cda0aa547f07a51dc1e29
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6cd67c59b1c7127b3aa6e68e7937800b838af487b00e0633e574b1e7f8b63de81259d3b1b980ff73dad9c746f940ebf8a355ad33d5945320d159991bba20f607
|
7
|
+
data.tar.gz: 9d28731e9e9bdd512211976ea89f290e809e0dcd4c42638091b2c77a244e587aba8705aee615889cb7faaddc6a25e96b5c48b1cafb03e46d28a5175b5babf794
|
data/Gemfile.lock
CHANGED
data/lib/dronejob/version.rb
CHANGED
@@ -28,8 +28,8 @@ module Dronejob
|
|
28
28
|
def cache_assets(cache_dir, &block)
|
29
29
|
hydra = Typhoeus::Hydra.new(max_concurrency: 10)
|
30
30
|
html = contents
|
31
|
-
html.scan(/["'(]{1}((https
|
32
|
-
original_url = url
|
31
|
+
html.scan(/["'(]{1}((https:\/\/|http:\/\/|\/\/)[^"')]+\.(jpg|jpeg|png|gif|mp3|mp4))["')?#]{1}/).map{|match| match[0]}.uniq.each do |url|
|
32
|
+
original_url = url.clone
|
33
33
|
url = "http:#{url}" if url[0..1] == "//"
|
34
34
|
ext = File.extname(url).gsub(/^\./, "")
|
35
35
|
cache_file = cache_dir.file("#{Digest::MD5.hexdigest(url)}.#{ext}")
|
@@ -12,17 +12,19 @@ module Dronejob
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def queue_download(url, &block)
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
15
|
+
url = "http:#{url}" if url[0..1] == "//"
|
16
|
+
request = Typhoeus::Request.new(url)
|
17
|
+
request.on_complete do |response|
|
18
|
+
if response.success?
|
19
|
+
write(response.body)
|
20
|
+
block.call(self) if !block.nil?
|
21
|
+
end
|
22
|
+
end
|
23
|
+
request
|
23
24
|
end
|
24
25
|
|
25
26
|
def download(url)
|
27
|
+
url = "http:#{url}" if url[0..1] == "//"
|
26
28
|
contents = open(url, { ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE, allow_redirections: :safe }).read
|
27
29
|
dir.create if !dir.exists?
|
28
30
|
write(contents)
|