• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javaandroidc++linuxc#objective-ccocoa誰得qtrubybathyscaphegamephpguicwindows翻訳pythonomegattwitterframeworkbtronarduinovb.net計画中(planning stage)directxpreviewertestゲームエンジンdom

Voice data server for navigation voice changer app.


Commit MetaInfo

Revisiondc02d89282b1beb6ffcea3d8091acf28f42d9d2c (tree)
Time2018-01-25 14:13:37
AuthorHMML <hmml3939@gmai...>
CommiterHMML

Log Message

Fix error class on creating voice preview.

Change Summary

Incremental Difference

--- a/lib/paperclip_processors/voice_preview.rb
+++ b/lib/paperclip_processors/voice_preview.rb
@@ -38,18 +38,18 @@ class VoicePreview < Paperclip::Processor
3838 end
3939 if tfiles.size < 3
4040 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")
4242 end
4343 tfiles.each do |tf|
4444 `soxi -t "#{tf}"`.chomp.downcase == 'vorbis' &&
4545 `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")
4747 `soxi -r "#{tf}"`.to_i == 44100 && `soxi -c "#{tf}"`.to_i == 1 and next
4848 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")
5050 FileUtils.mv rtmp, tf
5151 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")
5353 rescue => e
5454 Rails.logger.error "Failed to generate preview voice: #{e.backtrace.first}: #{e.message}, last error is #{$?}"
5555 FileUtils.mkdir_p "#{Rails.root}/tmp/failed"