shelr 0.16.0 → 0.16.1

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/lib/shelr/player.rb CHANGED
@@ -29,8 +29,12 @@ module Shelr
29
29
 
30
30
  def self.list
31
31
  (Dir[File.join(Shelr::DATA_DIR, "**")] - ['.', '..']).sort.each do |dir|
32
- metadata = JSON.parse(IO.read(File.join(dir, 'meta')))
33
- puts "#{metadata["recorded_at"]} : #{metadata["title"]}"
32
+ begin
33
+ metadata = JSON.parse(IO.read(File.join(dir, 'meta')))
34
+ puts "#{metadata["recorded_at"]} : #{metadata["title"]}"
35
+ rescue Errno::ENOENT
36
+ puts "Corrupted shellcast in #{dir}"
37
+ end
34
38
  end
35
39
  end
36
40
 
@@ -55,7 +59,7 @@ module Shelr
55
59
 
56
60
  def start_sound_player
57
61
  return unless File.exist?(record_file('sound.ogg'))
58
- at_exit { system('stty echo') }
62
+ # at_exit { system('stty echo') }
59
63
  STDOUT.puts "=> Starting sound player..."
60
64
  @sox_pid = fork do
61
65
  `play #{record_file('sound.ogg')} 2>&1`
@@ -65,7 +69,7 @@ module Shelr
65
69
  def stop_sound_player
66
70
  return unless File.exist?(record_file('sound.ogg'))
67
71
  STDOUT.puts "=> Stopping sound player..."
68
- Process.kill("HUP", @sox_pid)
72
+ Process.waitpid(@sox_pid)
69
73
  end
70
74
 
71
75
  def self.scriptreplay(typescript_file, timing_file)
@@ -112,17 +112,16 @@ module Shelr
112
112
  def start_sound_recording
113
113
  STDOUT.puts "Sound file stored in #{record_file('sound.ogg')}"
114
114
  @sox_pid = fork do
115
- Signal.trap("HUP") { puts "Sound recording finished!"; exit }
116
- run_sound_recorder
115
+ Signal.trap("INT") { puts "=> Sound recording finished!"; exit }
116
+ `rec -C 1 --channels 1 --rate 16k --comment 'Recorded for http://shelr.tv/' #{record_file('sound.ogg')} 2>&1`
117
117
  end
118
118
  end
119
119
 
120
120
  def stop_sound_recording
121
- Process.kill("HUP", @sox_pid)
122
- end
123
-
124
- def run_sound_recorder
125
- `rec -C 1 --channels 1 --rate 8k --comment 'Recorded for http://shelr.tv/' #{record_file('sound.ogg')} 2>&1`
121
+ STDOUT.puts "=> Stopping sound recorder"
122
+ sleep 2 # otherwise record will be cropped for some reason
123
+ Process.kill("INT", @sox_pid)
124
+ Process.waitpid(@sox_pid)
126
125
  end
127
126
 
128
127
  def recorder_cmd
data/lib/shelr/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Shelr
2
- VERSION = '0.16.0'
2
+ VERSION = '0.16.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shelr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.0
4
+ version: 0.16.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -88,7 +88,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
88
88
  version: '0'
89
89
  segments:
90
90
  - 0
91
- hash: -611569918164860445
91
+ hash: 1189951139247372912
92
92
  required_rubygems_version: !ruby/object:Gem::Requirement
93
93
  none: false
94
94
  requirements:
@@ -97,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
97
97
  version: '0'
98
98
  segments:
99
99
  - 0
100
- hash: -611569918164860445
100
+ hash: 1189951139247372912
101
101
  requirements: []
102
102
  rubyforge_project:
103
103
  rubygems_version: 1.8.21