Voice data server for navigation voice changer app.
Revisión | dc02d89282b1beb6ffcea3d8091acf28f42d9d2c (tree) |
---|---|
Tiempo | 2018-01-25 14:13:37 |
Autor | HMML <hmml3939@gmai...> |
Commiter | HMML |
Fix error class on creating voice preview.
@@ -38,18 +38,18 @@ class VoicePreview < Paperclip::Processor | ||
38 | 38 | end |
39 | 39 | if tfiles.size < 3 |
40 | 40 | Rails.logger.error "Preview target is missing. zip entry count=#{Zip::ZipFile.foreach(src.path).count}" |
41 | - raise I18n.t("voice_preview.err_missing") | |
41 | + raise Paperclip::Error, I18n.t("voice_preview.err_missing") | |
42 | 42 | end |
43 | 43 | tfiles.each do |tf| |
44 | 44 | `soxi -t "#{tf}"`.chomp.downcase == 'vorbis' && |
45 | 45 | `soxi -e "#{tf}"`.chomp.downcase == 'vorbis' or |
46 | - raise I18n.t("voice_preview.err_not_ogg") | |
46 | + raise Paperclip::Error, I18n.t("voice_preview.err_not_ogg") | |
47 | 47 | `soxi -r "#{tf}"`.to_i == 44100 && `soxi -c "#{tf}"`.to_i == 1 and next |
48 | 48 | rtmp = "#{tmpdir}/rate-convert-tmp-#{$$}.ogg" |
49 | - system('sox', tf, '-c', '1', '-r', '44100', rtmp) or raise I18n.t("voice_preview.err_normalize") | |
49 | + system('sox', tf, '-c', '1', '-r', '44100', rtmp) or raise Paperclip::Error, I18n.t("voice_preview.err_normalize") | |
50 | 50 | FileUtils.mv rtmp, tf |
51 | 51 | end |
52 | - system(*['sox', tfiles.sort, dst_path].flatten) or raise I18n.t("voice_preview.err_concat") | |
52 | + system(*['sox', tfiles.sort, dst_path].flatten) or raise Paperclip::Error, I18n.t("voice_preview.err_concat") | |
53 | 53 | rescue => e |
54 | 54 | Rails.logger.error "Failed to generate preview voice: #{e.backtrace.first}: #{e.message}, last error is #{$?}" |
55 | 55 | FileUtils.mkdir_p "#{Rails.root}/tmp/failed" |