Never give up
Révision | 68192ca299ad30c99dbbcef55376f11f521fe0b5 (tree) |
---|---|
l'heure | 2013-11-06 02:02:07 |
Auteur | HMML <hmml3939@gmai...> |
Commiter | HMML |
Strict check on preview target files, and translate error.
@@ -51,6 +51,7 @@ en: | ||
51 | 51 | |
52 | 52 | voice_preview: |
53 | 53 | err: "Failed to generate preview voice" |
54 | + err_missing: Audio file is missing. Check the file name in zip. | |
54 | 55 | err_concat: Failed to concat |
55 | 56 | err_not_ogg: File is not OGG/Vorbis format |
56 | 57 | err_normalize: Failed on rate/channel normalization |
@@ -71,6 +71,7 @@ ja: | ||
71 | 71 | |
72 | 72 | voice_preview: |
73 | 73 | err: プレビューの生成に失敗しました |
74 | + err_missing: 音声ファイルが見つかりません。OGGのファイル名を確認してください。 | |
74 | 75 | err_not_ogg: ファイル形式がOGG/Vorbisではありません |
75 | 76 | err_concat: 連結に失敗しました |
76 | 77 | err_normalize: サンプルレート/チャネル数の変更に失敗しました |
@@ -38,7 +38,10 @@ class VoicePreview < Paperclip::Processor | ||
38 | 38 | end |
39 | 39 | end |
40 | 40 | end |
41 | - tfiles.empty? and raise "File missing." | |
41 | + if tfiles.size < 3 | |
42 | + Rails.logger.error "Preview target is missing. zip entry count=#{Zip::ZipFile.foreach(src.path).count}" | |
43 | + raise I18n.t("voice_preview.err_missing") | |
44 | + end | |
42 | 45 | tfiles.each do |tf| |
43 | 46 | `soxi -t "#{tf}"`.chomp.downcase == 'vorbis' && |
44 | 47 | `soxi -e "#{tf}"`.chomp.downcase == 'vorbis' or |