google_speech 0.4.0 → 0.4.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6813210970cbd391fc353833b73cf483fecb35be
4
- data.tar.gz: 9800a202fb0bb0a66cf6e74f921021cb1f89f4f8
3
+ metadata.gz: 469b1c22ae469fdf3d7d0877455bb36a08d65475
4
+ data.tar.gz: 8a926d4d14f29c329d629c6b489d078a536c2b03
5
5
  SHA512:
6
- metadata.gz: f77c8400be4f09302c472fa3da92679ff557e8f1a44b1bf12830c76d233130e500bba99583e62d2921a7d8d6a5850fe717b716f923cd754f9b9a8e87ba52156b
7
- data.tar.gz: c998ca0fee9037f8691ae0c68dd994b555a3c13073afde8f93d58e5e47f179555df5beb4f669356ef8bcff5297c5c7d1db379e98b016a3fc4dd6aef3457fca12
6
+ metadata.gz: b47651a2503f10d7c21dc803af0fed8879fa8071b064b6c6476288b5d5829722b70bbdf7c52220f426d238d76f28efb10c49c552ff50b95511397523747f8b74
7
+ data.tar.gz: ffa05213e7ba7f28c5ca3a29e42a68aaebcb541742b3eac3e09d72ccba60e54f7b1558f40757dcd5bec2b1c7241b33fa20a008510105a3ca4f05db4277a2dff2
@@ -8,12 +8,14 @@ module GoogleSpeech
8
8
  attr_accessor :original_file, :original_duration, :start_time, :duration, :chunk_file, :rate
9
9
 
10
10
  def initialize(original_file, original_duration, start_time, duration, rate)
11
+ FileUtils.mkdir_p(GoogleSpeech::TMP_FILE_DIR) unless File.exists?(GoogleSpeech::TMP_FILE_DIR)
12
+
11
13
  @original_file = original_file
12
14
  @original_duration = original_duration
13
15
  @start_time = start_time
14
16
  @duration = [duration, (@original_duration - @start_time)].min
15
17
  @rate = rate
16
- @chunk_file = Tempfile.new([File.basename(@original_file), '.wav'])
18
+ @chunk_file = Tempfile.new([File.basename(@original_file), '.wav'], GoogleSpeech::TMP_FILE_DIR)
17
19
  # puts "@chunk_file: #{@chunk_file.path}"
18
20
  Utility.trim_and_encode(@original_file.path, @chunk_file.path, @start_time, @duration, @rate)
19
21
  end
@@ -35,6 +35,7 @@ module GoogleSpeech
35
35
  def open_working_file
36
36
  Utility.check_local_file(@original_file.path)
37
37
  wf_path = random_file_name(@original_file.path)
38
+ FileUtils.mkdir_p(GoogleSpeech::TMP_FILE_DIR) unless File.exists?(GoogleSpeech::TMP_FILE_DIR)
38
39
  FileUtils.ln(@original_file.path, wf_path)
39
40
  File.open(wf_path, 'r') {|f|
40
41
  yield f
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
3
  module GoogleSpeech
4
- VERSION = "0.4.0"
4
+ VERSION = "0.4.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google_speech
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kuklewicz