text-to-noise 0.2.1 → 0.2.2
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.
- data/README.md +3 -1
- data/bin/text_to_noise +6 -5
- data/features/commandline.feature +6 -5
- data/features/configuration.feature +32 -0
- data/lib/text_to_noise/mapping.rb +2 -2
- data/lib/text_to_noise/version.rb +1 -1
- data/sample.sounds.rb +4 -4
- data/sounds/birds/{crow-1.wav → crow-long.wav} +0 -0
- data/sounds/birds/hawk.wav +0 -0
- data/sounds/birds/{meadow_lark_short.wav → meadow_lark.wav} +0 -0
- data/sounds/crickets.wav +0 -0
- metadata +4 -5
- data/test.rb +0 -26
data/README.md
CHANGED
@@ -119,7 +119,9 @@ At the moment, this only supports playing some free bird songs that are included
|
|
119
119
|
Highest priority is the ability to add your own sound sets for playback.
|
120
120
|
|
121
121
|
* Add sounds to the available noises for playback
|
122
|
+
* Capistrano integration
|
122
123
|
* Automatically refresh configurations
|
124
|
+
* Add an 'every' option to throttle sounds for comman events
|
123
125
|
* Add generators to create stub configurations
|
124
126
|
* Support sound themes?
|
125
127
|
|
@@ -129,4 +131,4 @@ Highest priority is the ability to add your own sound sets for playback.
|
|
129
131
|
[sdlmixer]:http://www.libsdl.org/projects/SDL_mixer/
|
130
132
|
[MatchData:RDoc]:http://ruby-doc.org/core/classes/MatchData.html
|
131
133
|
[Features]:https://github.com/tobytripp/text_to_noise/blob/master/features/configuration.feature
|
132
|
-
[SampleConfig]:https://github.com/tobytripp/text_to_noise/blob/master/sample.sounds.rb
|
134
|
+
[SampleConfig]:https://github.com/tobytripp/text_to_noise/blob/master/sample.sounds.rb
|
data/bin/text_to_noise
CHANGED
@@ -47,12 +47,13 @@ Specify a configuration with the -c option.
|
|
47
47
|
|
48
48
|
Try this one if you're processing a Rails log:
|
49
49
|
|
50
|
-
match /
|
51
|
-
match /
|
52
|
-
match /User Load/ => "nightingale"
|
53
|
-
match /Processing/ => "finch"
|
54
|
-
match /SessionsController#new/ => "owl"
|
50
|
+
match /User Load/ => "nightingale"
|
51
|
+
match /Processing/ => "finch"
|
55
52
|
match /404 Not Found/ => "hawk"
|
53
|
+
match /SessionsController#new/ => "owl"
|
54
|
+
|
55
|
+
you'll probably want to tune this yourself. It can get a bit ridiculous if
|
56
|
+
you have any substantial amount of traffic.
|
56
57
|
|
57
58
|
Or maybe you're watching your ssh access:
|
58
59
|
|
@@ -13,12 +13,13 @@ Feature: Running text_to_noise
|
|
13
13
|
|
14
14
|
Try this one if you're processing a Rails log:
|
15
15
|
|
16
|
-
match /
|
17
|
-
match /
|
18
|
-
match /User Load/ => "nightingale"
|
19
|
-
match /Processing/ => "finch"
|
20
|
-
match /SessionsController#new/ => "owl"
|
16
|
+
match /User Load/ => "nightingale"
|
17
|
+
match /Processing/ => "finch"
|
21
18
|
match /404 Not Found/ => "hawk"
|
19
|
+
match /SessionsController#new/ => "owl"
|
20
|
+
|
21
|
+
you'll probably want to tune this yourself. It can get a bit ridiculous if
|
22
|
+
you have any substantial amount of traffic.
|
22
23
|
|
23
24
|
Or maybe you're watching your ssh access:
|
24
25
|
|
@@ -78,3 +78,35 @@ Feature: Mapping input lines to sounds for playback
|
|
78
78
|
|
79
79
|
Then the output should contain "Playing crow.wav"
|
80
80
|
And the output should contain "Playing chicken.wav"
|
81
|
+
|
82
|
+
@wip
|
83
|
+
Scenario: Throttling a match
|
84
|
+
Given a file named "sound_mapping" with:
|
85
|
+
"""
|
86
|
+
map /Rendered/ => 'crickets', :every => 5
|
87
|
+
map( /page/ ).to( 'crickets' ).every( 5 )
|
88
|
+
"""
|
89
|
+
|
90
|
+
And a file named "input.short.log" with:
|
91
|
+
"""
|
92
|
+
Rendered a page
|
93
|
+
Rendered a page
|
94
|
+
Rendered a page
|
95
|
+
"""
|
96
|
+
|
97
|
+
And a file named "input.long.log" with:
|
98
|
+
"""
|
99
|
+
Rendered a page
|
100
|
+
Rendered a page
|
101
|
+
Rendered a page
|
102
|
+
Rendered a page
|
103
|
+
Rendered a page
|
104
|
+
"""
|
105
|
+
|
106
|
+
When I run `text_to_noise -c sound_mapping -f input.short.log -m`
|
107
|
+
|
108
|
+
Then the output should not contain "Playing crickets.wav"
|
109
|
+
|
110
|
+
When I run `text_to_noise -c sound_mapping -f input.long.log -m`
|
111
|
+
|
112
|
+
Then the output should contain "Playing crickets.wav"
|
@@ -8,8 +8,8 @@ module TextToNoise
|
|
8
8
|
when Regexp
|
9
9
|
@regex = expression_or_map
|
10
10
|
when Hash
|
11
|
-
@regex = expression_or_map.
|
12
|
-
self.to
|
11
|
+
@regex, target = expression_or_map.to_a.flatten
|
12
|
+
self.to target
|
13
13
|
else
|
14
14
|
raise ArgumentError, "Unrecognized Mapping configuration: #{expression_or_map.inspect}"
|
15
15
|
end
|
data/sample.sounds.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
match /Rendered/ => %w(crickets canary)
|
2
|
-
match /Rendering/ => "cardinal"
|
3
|
-
match /User Load/ => "nightingale"
|
4
|
-
match /Processing/ => "
|
1
|
+
# match /Rendered/ => %w(crickets canary), :every => 6
|
2
|
+
# match /Rendering/ => "cardinal"
|
3
|
+
match /User Load/ => %w"nightingale crickets canary"
|
4
|
+
match /Processing/ => "crickets"
|
5
5
|
match /SessionsController#new/ => "owl"
|
6
6
|
match /404 Not Found/ => "hawk"
|
File without changes
|
data/sounds/birds/hawk.wav
CHANGED
Binary file
|
File without changes
|
data/sounds/crickets.wav
CHANGED
Binary file
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: text-to-noise
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.2.
|
5
|
+
version: 0.2.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Toby Tripp
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2011-
|
14
|
+
date: 2011-05-03 00:00:00 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rubygame
|
@@ -97,14 +97,14 @@ files:
|
|
97
97
|
- sounds/birds/canary2.wav
|
98
98
|
- sounds/birds/cardinal.wav
|
99
99
|
- sounds/birds/chicken.wav
|
100
|
-
- sounds/birds/crow-
|
100
|
+
- sounds/birds/crow-long.wav
|
101
101
|
- sounds/birds/crow.wav
|
102
102
|
- sounds/birds/finch.wav
|
103
103
|
- sounds/birds/geese.wav
|
104
104
|
- sounds/birds/hawk.wav
|
105
105
|
- sounds/birds/lapwing.wav
|
106
|
+
- sounds/birds/meadow_lark.wav
|
106
107
|
- sounds/birds/meadow_lark_long.wav
|
107
|
-
- sounds/birds/meadow_lark_short.wav
|
108
108
|
- sounds/birds/mexican_red_parrot.wav
|
109
109
|
- sounds/birds/mockingbird.wav
|
110
110
|
- sounds/birds/nightingale.wav
|
@@ -124,7 +124,6 @@ files:
|
|
124
124
|
- spec/text_to_noise/mapping_spec.rb
|
125
125
|
- spec/text_to_noise/sound_map.rb
|
126
126
|
- ssh.sounds.rb
|
127
|
-
- test.rb
|
128
127
|
- text_to_noise.gemspec
|
129
128
|
- ts.gems
|
130
129
|
- watchr.rb
|
data/test.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require 'rubygame'
|
3
|
-
include Rubygame
|
4
|
-
|
5
|
-
# Stuff that I had to do to get this running:
|
6
|
-
#
|
7
|
-
# brew install sdl sdl_mixer
|
8
|
-
# gem install rubygame rsdl
|
9
|
-
|
10
|
-
# Let's start by trying to play a random mp3 passed as an argument
|
11
|
-
mp3 = ARGV.pop
|
12
|
-
raise "No Mixer found! Make sure sdl_mixer is installed." unless defined? Sound
|
13
|
-
APP_ROOT = File.dirname File.expand_path( __FILE__ )
|
14
|
-
|
15
|
-
Sound.autoload_dirs << File.join( APP_ROOT, "sounds" )
|
16
|
-
|
17
|
-
# http://rubygame.org/wiki/NamedResources_tutorial#Autoloading_Resources
|
18
|
-
sound = Sound[mp3]
|
19
|
-
# sound = Sound.load mp3
|
20
|
-
sound.play :stop_after => 4, :fade_out => 2
|
21
|
-
|
22
|
-
while sound.playing?
|
23
|
-
sleep 1
|
24
|
-
end
|
25
|
-
|
26
|
-
# Kick Ass!
|