json-waveform 0.0.3 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/json-waveform +13 -2
- data/lib/json-waveform/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd2e33a91089ceb6931b15602438bdd1cc4a3c9d
|
4
|
+
data.tar.gz: 9122243fe4acaef1954a929f17e53acf4cd44e8f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e3489489c328093edc783aea97563b9f9e14997dfe9df02fe17cf3cc7ce2b641f1f839c434f84710c847dfa53d2fd3a497f33f971808796dfbf673b65101fb5
|
7
|
+
data.tar.gz: b0fcc8bb42c729fbe4bbc5a3b6c0a224cf21ebecec5421ebc065420844b8cdb1eafbfd528f3708eaa79c9385c455a8767b4740e7607a162433d865fc43160952
|
data/bin/json-waveform
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require "json-waveform"
|
3
|
+
require "json"
|
3
4
|
require "optparse"
|
4
5
|
|
5
6
|
options = JsonWaveform::DEFAULT_OPTIONS
|
@@ -7,6 +8,10 @@ optparse = OptionParser.new do |o|
|
|
7
8
|
o.banner = "Usage: json-waveform [options] source_audio"
|
8
9
|
o.version = JsonWaveform::VERSION
|
9
10
|
|
11
|
+
o.on("-o", "--output FILE", "File where to write the JSON -- Default is stdout.") do |output|
|
12
|
+
options[:output] = output
|
13
|
+
end
|
14
|
+
|
10
15
|
o.on("-s", "--samples SAMPLES", "Samples generated from the original file (i.e.: waveform width) -- Default #{JsonWaveform::DEFAULT_OPTIONS[:samples]}.") do |samples|
|
11
16
|
options[:samples] = samples.to_i
|
12
17
|
end
|
@@ -32,8 +37,14 @@ end
|
|
32
37
|
optparse.parse!
|
33
38
|
|
34
39
|
begin
|
35
|
-
result = JsonWaveform.generate(ARGV[0], options)
|
36
|
-
|
40
|
+
result = JSON.dump(JsonWaveform.generate(ARGV[0], options))
|
41
|
+
if options[:output]
|
42
|
+
File.open(options[:output], 'w') do |file|
|
43
|
+
file.write result
|
44
|
+
end
|
45
|
+
else
|
46
|
+
puts result
|
47
|
+
end
|
37
48
|
rescue JsonWaveform::ArgumentError => e
|
38
49
|
puts e.message + "\n\n"
|
39
50
|
puts optparse
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json-waveform
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Esteban Pastorino
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-audio
|