speak 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.rdoc +4 -0
  2. data/bin/speak +9 -3
  3. data/lib/speak/version.rb +1 -1
  4. metadata +2 -2
@@ -25,6 +25,10 @@ Save the speech into a mp3 file
25
25
 
26
26
  $ speak Hello world -o > hello.mp3
27
27
 
28
+ Read text to speech from STDIN
29
+
30
+ $ speak -i < text.txt
31
+
28
32
  == Questions or problems?
29
33
 
30
34
  If you have any issues with rplot please add an {issue on
data/bin/speak CHANGED
@@ -10,6 +10,8 @@ optparse = OptionParser.new do |opts|
10
10
  opts.banner = "Usage: #{opts.program_name} [options] text_to_speech"
11
11
  options[:locale] = 'en'
12
12
  opts.on('-l', '--locale LOCALE', 'Set language to speech (default EN)' ) { |locale| options[:locale] = locale }
13
+ options[:in] = false
14
+ opts.on('-i', 'Get input from STDIN' ) { |i| options[:in] = true }
13
15
  options[:out] = false
14
16
  opts.on('-o', 'Print speech data as mp3 to STDOUT' ) { |out| options[:out] = true }
15
17
  opts.on('-v', '--version', 'Display version') do
@@ -28,14 +30,18 @@ rescue OptionParser::InvalidOption
28
30
  puts optparse.help
29
31
  exit
30
32
  end
31
- if ARGV.size == 0
33
+ if ARGV.size == 0 && !options[:in]
32
34
  puts optparse.help
33
35
  exit
34
36
  end
35
37
 
36
38
  # START
37
39
 
38
- text2speech = ARGV.join(' ')
40
+ if options[:in]
41
+ text2speech = $stdin.read.chomp
42
+ else
43
+ text2speech = ARGV.join(' ')
44
+ end
39
45
  uri = "http://translate.google.com/translate_tts?tl=#{CGI.escape(options[:locale])}&q=#{CGI.escape(text2speech)}"
40
46
 
41
47
  if options[:out]
@@ -44,4 +50,4 @@ if options[:out]
44
50
  else
45
51
  require "#{$APP_PATH}/lib/speak"
46
52
  Speak::play(uri)
47
- end
53
+ end
@@ -1,3 +1,3 @@
1
1
  module Speak
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: speak
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.1
5
+ version: 0.0.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Enrico Pilotto
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-05-06 00:00:00 Z
13
+ date: 2011-05-12 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: pkg-config