From 45acf3b71d8f04ffb608ae2c9ba9e0da6030e66d Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 16 Oct 2007 01:14:39 +0100 Subject: image list, extracting conditions and regex visited --- lib/sisu/v0/remote.rb | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'lib/sisu/v0/remote.rb') diff --git a/lib/sisu/v0/remote.rb b/lib/sisu/v0/remote.rb index efa49dc0..c65c619f 100644 --- a/lib/sisu/v0/remote.rb +++ b/lib/sisu/v0/remote.rb @@ -117,20 +117,25 @@ module SiSU_Remote @rgx_skin=/(?:0~|@)skin:?\s+(\S+)/ #@rgx_skin=/^0~skin\s+(\S+)/ threads=[] for requested_page in @get_s + re_fnb=/((?:https?|file):\/\/[^\/ ]+?\/[^\/ ]+?)\/\S+?\/([^\/]+?)\.ss(t)/ #revisit and remove DO threads << Thread.new(requested_page) do |url| open(url) do |f| raise "#{url} not found" unless f - re_fnb=/((?:https?|file):\/\/[^\/ ]+?\/[^\/ ]+?)\/\S+?\/([^\/]+?)\.ss(t)/ #revisit and remove DO base_uri,fnb,instr=re_fnb.match(url)[1..3] if re_fnb - imagedir= base_uri + '/_sisu/image' #check on + imagedir=base_uri + '/_sisu/image' #check on doc_skin_dir = /((?:https?|file):\/\/\S+?)\/[^\/]+?\.sst$/.match(url).captures.join + '/_sisu/skin/doc' #"Got file, and ready to process: #{fnb}.t#{instr}" downloaded_file=File.new("#{fnb}.-sst",'w+') images=SiSU_Assemble::Remote_image.new.image(imagedir) skin=SiSU_Assemble::Remote_image.new.image(doc_skin_dir) f.collect.each do |r| # work area - skin << r.scan(@rgx_skin).uniq if r =~@rgx_skin - images << r.scan(@rgx_image).uniq if r =~@rgx_image + unless r =~/^%+\s/ + skin << r.scan(@rgx_skin).uniq if r =~@rgx_skin + if r !~/^%+\s/ \ + and r =~@rgx_image + images << r.scan(@rgx_image).uniq + end + end downloaded_file << r end if skin \ @@ -139,7 +144,10 @@ module SiSU_Remote end if images \ and images.length > 1 - images.flatten!.uniq! + images.flatten! + images.uniq! + images.delete_if {|x| x =~/http:\/\// } + images.sort! @msg,@msgs='downloading images:', [ images.join(',') ] @tell.call.warn unless @opt.cmd =~/q/ SiSU_Assemble::Remote_image.new.download_images(images) -- cgit v1.2.3