diff options
Diffstat (limited to 'lib/sisu/v0/remote.rb')
-rw-r--r-- | lib/sisu/v0/remote.rb | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/lib/sisu/v0/remote.rb b/lib/sisu/v0/remote.rb index aa7799ad..4197d62d 100644 --- a/lib/sisu/v0/remote.rb +++ b/lib/sisu/v0/remote.rb @@ -165,9 +165,10 @@ module SiSU_Remote threads.each {|thr| thr.join} if threads #and threads.length > 0 end def sisupod - if @get_p.length > 0 #% remote sisupod + get_p=@get_s + if get_p.length > 0 #% remote sisupod require 'net/http' - for requested_pod in @get_p + for requested_pod in get_p pod_info=Remote_download.new(requested_pod) @opt.fns=pod_info.pod.name Net::HTTP.start(pod_info.pod.site) do |http| @@ -180,5 +181,36 @@ module SiSU_Remote end end end + class Remote_download + def initialize(requested_file) + @requested_file=requested_file + end + def pod + re_p_div=/http:\/\/([^\/]+)(\/\S+)\/(sisupod(?:\.zip)?|\S+?(?:\.ss[mt]\.zip)?|[^\/]+?\.ssp)$/ + re_p=/(sisupod(?:\.zip)?|\S+?\.ss[mt](?:\.zip)?|[^\/]+?\.ssp)$/ + if @requested_file =~ re_p_div + @site,@pth,@pod= re_p_div.match(@requested_file).captures + elsif @requested_file =~ re_p + @pod= re_p.match(@requested_file).captures + end + def site + @site + end + def path + @pth + end + def dir_stub + re_p_stub=/.+?([^\/]+)$/ + pod_stub= re_p_stub.match(path).captures.join if path + end + def name_source + @pod + end + def name + name_source + end + self + end + end end __END__ |