Voice data server for navigation voice changer app.
Revision | 7587a8d995a595809929aba41a8afe4c1f108e81 (tree) |
---|---|
Zeit | 2013-11-06 02:26:25 |
Autor | ![]() |
Commiter | HMML |
Lock rubyzip to 0.9.x temporary...
@@ -58,7 +58,7 @@ gem 'client_side_validations-simple_form', git: 'git://github.com/saveritemedica | ||
58 | 58 | gem 'responders' |
59 | 59 | gem 'rspec-rails', group: [:development, :test] |
60 | 60 | gem 'paperclip' |
61 | -gem 'rubyzip', require: 'zip/zip' | |
61 | +gem 'rubyzip', '< 1.0.0', require: 'zip/zip' | |
62 | 62 | gem 'rails_admin', github: 'davebrace/rails_admin', branch: 'use-static-bootstrap-2' |
63 | 63 | group :develpment do |
64 | 64 | gem 'capistrano' |
@@ -244,7 +244,7 @@ DEPENDENCIES | ||
244 | 244 | rails_autolink (~> 1.1.5) |
245 | 245 | responders |
246 | 246 | rspec-rails |
247 | - rubyzip | |
247 | + rubyzip (< 1.0.0) | |
248 | 248 | sass-rails (~> 4.0.0) |
249 | 249 | sdoc |
250 | 250 | simple_form (~> 3.0.0.rc) |
@@ -15,26 +15,24 @@ class VoicePreview < Paperclip::Processor | ||
15 | 15 | |
16 | 16 | begin |
17 | 17 | tfiles = [] |
18 | - Zip::ZipFile.open src.path do |zf| | |
19 | - zf.each do |ze| | |
20 | - i = nil | |
21 | - case ze.name.downcase | |
22 | - when "7.ogg" | |
23 | - i = "01" | |
24 | - when "then.ogg" | |
25 | - i = "02" | |
26 | - when "12.ogg" | |
27 | - i = "03" | |
28 | - else | |
29 | - next | |
30 | - end | |
31 | - tfiles << (tf = "#{tmpdir}/#{i}.ogg") | |
32 | - open(tf, "w") do |of| | |
33 | - of.binmode | |
34 | - zs = zf.get_input_stream(ze) | |
35 | - while buf = zs.read(ZIP_BUFSIZE) | |
36 | - of << buf | |
37 | - end | |
18 | + Zip::ZipFile.foreach(src.path) do |ze| | |
19 | + i = nil | |
20 | + case ze.name.downcase | |
21 | + when "7.ogg" | |
22 | + i = "01" | |
23 | + when "then.ogg" | |
24 | + i = "02" | |
25 | + when "12.ogg" | |
26 | + i = "03" | |
27 | + else | |
28 | + next | |
29 | + end | |
30 | + tfiles << (tf = "#{tmpdir}/#{i}.ogg") | |
31 | + open(tf, "w") do |of| | |
32 | + of.binmode | |
33 | + zs = ze.get_input_stream | |
34 | + while buf = zs.read(ZIP_BUFSIZE) | |
35 | + of << buf | |
38 | 36 | end |
39 | 37 | end |
40 | 38 | end |
@@ -53,7 +51,7 @@ class VoicePreview < Paperclip::Processor | ||
53 | 51 | end |
54 | 52 | system(*['sox', tfiles.sort, dst_path].flatten) or raise I18n.t("voice_preview.err_concat") |
55 | 53 | rescue => e |
56 | - Rails.logger.error "Error: Failed to generate preview voice: #{e.message}, last error is #{$?}" | |
54 | + Rails.logger.error "Failed to generate preview voice: #{e.backtrace.first}: #{e.message}, last error is #{$?}" | |
57 | 55 | FileUtils.mkdir_p "#{Rails.root}/tmp/failed" |
58 | 56 | failed_path = "#{Rails.root}/tmp/failed/#{Time.now.to_i}.zip" |
59 | 57 | Rails.logger.error "Keeping failed archive to '#{failed_path}'" |