• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javaandroidc++objective-ccocoa誰得c#gamebathyscaphephplinuxrubyqt翻訳pythoncomegatwindowstwitterguiframeworkbtronvb.netdirectxtestdomarduino計画中(planning stage)previewerpukiwiki

Voice data server for navigation voice changer app.


コミットメタ情報

リビジョンdc02d89282b1beb6ffcea3d8091acf28f42d9d2c (tree)
日時2018-01-25 14:13:37
作者HMML <hmml3939@gmai...>
コミッターHMML

ログメッセージ

Fix error class on creating voice preview.

変更サマリ

差分

--- 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"