Sha256: 1a14cc6bdb274bfa149bf5a32856199dcb5a0071cbab227c279b8977a3ab9310
Contents?: true
Size: 1.73 KB
Versions: 2
Compression:
Stored size: 1.73 KB
Contents
#!/usr/bin/env ruby $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib') require 'djatoka' require 'trollop' require 'pp' opts = Trollop::options do banner <<-EOS This script take a Djatoka resolver base URL and returns a full URI for a particular identifier. Usage: djatoka_url [options] --resolver http://african.lanl.gov/adore-djatoka/resolver --rftid info:lanl-repo/ds/5aa182c2-c092-4596-af6e-e95d2e263de3 where options are: EOS opt :resolver, "A Djatoka resolver base URL", :required => true, :type => String opt :rftid, "Resource identifier", :required => true, :type => String, :short => :i opt :level, 'Level', :type => String opt :rotate, 'Rotate', :type => String opt :region, 'Region', :type => String opt :scale, "Scale", :type => String opt :format, 'Format', :type => String opt :clayer, 'clayer', :type => String opt :square, 'Squares the image by cropping' opt :smallbox, 'Creates a 75x75 image' opt :metadata, 'Output metadata' opt :levels, 'Output Levels' opt :browser, 'Set the browser to open JSON and images with', :type => String end resolver = Djatoka::Resolver.new(opts[:resolver]) region = resolver.region(opts[:rftid]) [:level, :rotate, :region, :scale, :format, :clayer].each do |param| region.send(param, opts[param]) if opts[param] end if opts[:smallbox] region.smallbox end if opts[:square] region.square end if opts[:metadata] or opts[:levels] metadata = resolver.metadata(opts[:rftid]) metadata.perform if opts[:metadata] puts metadata.url `#{opts[:browser]} "#{metadata.url}"` if opts[:browser] pp metadata.response end if opts[:levels] pp metadata.all_levels end end pp region.query puts region.url `#{opts[:browser]} "#{region.url}"` if opts[:browser]
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
djatoka-0.0.7 | bin/djatoka_url |
djatoka-0.0.6 | bin/djatoka_url |