bin/oddb2xml in oddb2xml-1.7.9 vs bin/oddb2xml in oddb2xml-1.8.0
- old
+ new
@@ -26,12 +26,13 @@
-t S, --tag-suffix=S XML tag suffix S. Default is none. [A-z0-9]
If S is given, it is also used as prefix of filename.
-x N, --context=N context N {product|address}. product is default.
For debugging purposes
- --skip-download skips downloading files it the file is already under data/downloads.
- Downloaded files are saved under data/downloads
+ --skip-download skips downloading files it the file is already under data/download.
+ Downloaded files are saved under data/download
+ --log log important actions
-h, --help Show this help message.
EOS
end
parser = OptionParser.new
@@ -44,11 +45,12 @@
:format => :xml,
:tag_suffix => nil,
:debug => false,
:ean14 => false,
:skip_download=> false,
-}
+ :log => false,
+ }
parser.on('-a v', '--append v', /^nonpharma$/) {|v| opts[:nonpharma] = true }
parser.on('-c v', '--compress v', /^tar\.gz|zip$/){|v| opts[:compress_ext] = v }
parser.on('-e', '--extended') {|v| opts[:extended] = true
opts[:nonpharma] = :true
@@ -58,11 +60,12 @@
parser.on('-o v', '--option v', /^fi$/) {|v| opts[:fi] = true }
parser.on('-i v', '--include v', /^ean14$/) {|v| opts[:ean14] = true }
parser.on('-t v', '--tag-suffix v', /^[A-z0-9]*$/i) {|v| opts[:tag_suffix] = v.upcase }
parser.on('-x v', '--context v', /^addr(ess)*$/i){|v| opts[:address] = true }
parser.on('-p v', '--price v', /^zurrose$/) {|v| opts[:price] = v.intern }
-parser.on('--skip-download') {|v| opts[:skip_download] = true }
+parser.on('--skip-download') {|v| opts[:skip_download] = true }
+parser.on('--log') {|v| opts[:log] = :true }
parser.on_tail('-h', '--help') { puts help; exit }
args = ARGV.dup
begin
parser.parse!(args)
@@ -76,10 +79,11 @@
# TEMP
if path = args.first
opts[:transfer_dat] = path
end
+startTime = Time.now
ui = Oddb2xml::Cli.new(opts)
begin
if opts[:format] == :xml
opts[:ean14] = true # force
end
@@ -93,6 +97,7 @@
end
ui.run
rescue Interrupt
exit
end
-puts "#{Time.now}: #{__LINE__} done"; $stdout.sync
+diff = (Time.now-startTime).to_i
+puts "#{Time.now}: #{__LINE__} done. Took #{diff} seconds"; $stdout.sync