sbire 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7459c16fa77c58b768969b67e4138b4e6eebee27
4
- data.tar.gz: d3f4c2b622a9f0c8913b06c970db92cfdb9a6fca
3
+ metadata.gz: 78327ead8904f5db555cefe58fda34399cbdbd5d
4
+ data.tar.gz: 9577fd4a52d5960ea349a146e329329b55b71e58
5
5
  SHA512:
6
- metadata.gz: ad78ff5204dbf0a8826c85a8d4821c6e0fdce2c86a2027e0a964b3bc5e763b974e18356271854a063a9a9b17232e88af498b5e09b34feabb5da7616a7e1b85b7
7
- data.tar.gz: fc984e008248f05fa191d41dc727b44cc3388a0f028e6aa4603c00b488c874ff38a8c62262322dc78d0e7e9810880ac9b8b5d01b43aef3fbaaf57fc32bf30980
6
+ metadata.gz: 0afaa3c06d010af5dfbbff4a7e64b4618f080cea8383b367fb965c558b92b97f170eba0c9b86eeb7529d09aaeede26e56e6ac0c6c20c8392f84c5c5faeb81f6e
7
+ data.tar.gz: 0c81c2cea6e4f89f9e6b9156e55ea8c143f501e45dc5453462a22ed8c651197042f74b3cd5b19f469d83d43473a8d0ccb1efed85943f5fc8eb9a20ac1d2a364a
data/README.md CHANGED
@@ -4,13 +4,23 @@ In french, a "Sbire" is a henchman. It's the guy who do what you say. Sbire is p
4
4
 
5
5
  ## Installation
6
6
 
7
- In Ubuntu :
7
+ On linux :
8
8
 
9
9
  sudo apt-get install sox notify-osd ruby1.9.1
10
10
  gem install sbire
11
- mkdir ~\.sbire\
11
+ sbire install
12
12
 
13
- In other systems : In the ToDo list
13
+ On mac :
14
+
15
+ brew install sox
16
+ gem install sbire
17
+ sbire install
18
+
19
+ On windows :
20
+
21
+ Install ruby with [RubyInstall](http://rubyinstaller.org/)
22
+ gem install sbire
23
+ sbire install
14
24
 
15
25
  ## Usage
16
26
 
@@ -30,9 +40,11 @@ To write a text file :
30
40
  - Type `sbire save`
31
41
  - A file will be created in `~\.sbire\text`
32
42
 
43
+ If you want to see what is put in the file in real time, you can do `tail -f ~\.sbire\text`.
44
+
33
45
  ## Configuration
34
46
 
35
- By default, the language is en-US. You can change it by adding a file `~\.sbire\config.yml` and put `lang: fr-FR` in it.
47
+ By default, the language is en-us. You can change it by changing the file `~\.sbire\config.yml` and put `lang: fr-FR` in it.
36
48
 
37
49
  ## Bind phrase and commands
38
50
 
@@ -45,12 +57,6 @@ You can bind more complexe phrases with commands by adding a file`~\.sbire\comma
45
57
 
46
58
  For an obscure reason, Ubuntu does not execute ruby commands binded with a keyboard shortcut. You must to install [xbindkeys](http://doc.ubuntu-fr.org/xbindkeys) to make it working.
47
59
 
48
- ## ToDo list
49
-
50
- - Make it work with leap motion
51
- - Make it cross-platform
52
- - Enable streaming to write texts
53
-
54
60
  ## Contributing
55
61
 
56
62
  1. Fork it
@@ -1,5 +1,8 @@
1
+ require_relative 'sbire_config'
2
+
1
3
  class Notifier
2
4
  def self.call(message)
3
- system("notify-send '#{message}'")
5
+ command = SbireConfig.notify_command % { message: message }
6
+ system(command)
4
7
  end
5
8
  end
@@ -0,0 +1,23 @@
1
+ class OS
2
+ def self.familly
3
+ return "win" if OS.windows?
4
+ return "linux" if OS.unix? || OS.linux?
5
+ return "mac" if OS.mac?
6
+ end
7
+
8
+ def self.windows?
9
+ (/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil
10
+ end
11
+
12
+ def self.mac?
13
+ (/darwin/ =~ RUBY_PLATFORM) != nil
14
+ end
15
+
16
+ def self.unix?
17
+ !OS.windows?
18
+ end
19
+
20
+ def self.linux?
21
+ OS.unix? and not OS.mac?
22
+ end
23
+ end
@@ -5,6 +5,7 @@ require_relative 'audio_recorder'
5
5
  require_relative 'save_manager'
6
6
  require_relative 'sbire_config'
7
7
  require_relative 'pid_manager'
8
+ require_relative 'os'
8
9
  require 'rest_client'
9
10
 
10
11
  class Sbire
@@ -20,7 +21,7 @@ class Sbire
20
21
  end
21
22
 
22
23
  def call
23
- if command == "start" || command == "stop" || command == "save"
24
+ if ["start", "stop", "save", "install"].include?(command)
24
25
  send(command)
25
26
  else
26
27
  show("Command not found")
@@ -29,6 +30,7 @@ class Sbire
29
30
 
30
31
  private
31
32
  def start
33
+ stop
32
34
  show("Sbire is listening your voice")
33
35
  audio_recorder.start
34
36
  audio_converter.start do |results, index|
@@ -42,6 +44,7 @@ class Sbire
42
44
  end
43
45
 
44
46
  def save
47
+ stop
45
48
  show("Sbire is listening your voice")
46
49
  audio_recorder.start
47
50
  recreate_text_file
@@ -50,6 +53,13 @@ class Sbire
50
53
  end
51
54
  end
52
55
 
56
+ def install
57
+ home = Dir.home
58
+ config_file = "config_#{OS.familly}.yml"
59
+ FileUtils.mkdir_p("#{home}/.sbire/out")
60
+ FileUtils.copy("./files/#{config_file}", "#{home}/.sbire/config.yml")
61
+ end
62
+
53
63
  def recreate_text_file
54
64
  File.write(SbireConfig.text_file, '')
55
65
  end
@@ -6,7 +6,7 @@ class SbireConfig
6
6
  end
7
7
 
8
8
  def self.base_directory
9
- "~/.sbire"
9
+ "#{Dir.home}/.sbire"
10
10
  end
11
11
 
12
12
  def self.lang
@@ -29,6 +29,10 @@ class SbireConfig
29
29
  config["command_path"] ||= "#{base_directory}/commands.yml"
30
30
  end
31
31
 
32
+ def self.notify_command
33
+ config["notify_command"]
34
+ end
35
+
32
36
  private
33
37
 
34
38
  def self.config
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sbire
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guirec Corbel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-08 00:00:00.000000000 Z
11
+ date: 2013-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -35,6 +35,7 @@ files:
35
35
  - bin/sbire
36
36
  - lib/audio_converter.rb
37
37
  - lib/audio_recorder.rb
38
+ - lib/os.rb
38
39
  - lib/sbire.rb
39
40
  - lib/command_manager.rb
40
41
  - lib/save_manager.rb