142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
|
# File 'lib/sisu/remote.rb', line 142
def fns
begin
require 'open-uri'
require 'pp'
rescue LoadError
SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
error('open-uri or pp NOT FOUND (LoadError)')
end
require_relative 'ao_composite' @rgx_image=/(?:^|[^_\\])\{\s*(\S+?\.(?:png|jpg|gif))/
threads=[]
for requested_page in @get_s
re_fnb=/((?:https?|file):\/\/[^\/ ]+?\/[^\/ ]+?)\/\S+?\/([^\/]+?)\.ss(t)/ threads << Thread.new(requested_page) do |url|
open(url) do |f|
raise "#{url} not found" unless f
base_uri,fnb=re_fnb.match(url)[1..2] if re_fnb
imagedir=base_uri + '/_sisu/image' downloaded_file=File.new("#{fnb}.-sst",'w+')
image_download_url=SiSU_Assemble::RemoteImage.new.image(imagedir)
images=[]
f.collect.each do |r| unless r =~/^%+\s/
if r !~/^%+\s/ \
and r =~@rgx_image
images << r.scan(@rgx_image).uniq
end
end
downloaded_file << r
end
if images \
and images.length > 1
images=images.flatten.uniq
images.delete_if {|x| x =~/https?:\/\// }
images=images.sort
@msg,@msgs='downloading images:', [ images.join(',') ]
@tell.call.warn unless @opt.act[:quiet][:set]==:on
image_info=image_download_url + images
SiSU_Assemble::RemoteImage.new.download_images(image_info)
@msg,@msgs='downloading done',nil
@tell.call.warn unless @opt.act[:quiet][:set]==:on
end
downloaded_file.close
end
end
end
threads.each {|thr| thr.join} if threads end
|