fix tests, better error handling in pixiv ugoira converter

This commit is contained in:
Albert Yi
2016-10-25 16:20:47 -07:00
parent 79842f7a3b
commit 24d44dd4f8
3 changed files with 14 additions and 4 deletions

View File

@@ -38,8 +38,7 @@ class PixivUgoiraConverter
end end
ext = folder.first.name.match(/\.(\w{,4})$/)[1] ext = folder.first.name.match(/\.(\w{,4})$/)[1]
ffmpeg_out, status_ = Open3.capture2e("ffmpeg -i #{tmpdir}/images/%06d.#{ext} -codec:v libvpx -crf 4 -b:v 5000k -an #{tmpdir}/tmp.webm") ffmpeg_out, status = Open3.capture2e("ffmpeg -i #{tmpdir}/images/%06d.#{ext} -codec:v libvpx -crf 4 -b:v 5000k -an #{tmpdir}/tmp.webm")
mkvmerge_out, status = Open3.capture2e("mkvmerge -o #{write_path} --webm --timecodes 0:#{tmpdir}/timecodes.tc #{tmpdir}/tmp.webm")
if !status.success? if !status.success?
Rails.logger.error "[write_webm] ******************************" Rails.logger.error "[write_webm] ******************************"
@@ -48,10 +47,21 @@ class PixivUgoiraConverter
ffmpeg_out.split(/\n/).each do |line| ffmpeg_out.split(/\n/).each do |line|
Rails.logger.error "[write_webm][ffmpeg] #{line}" Rails.logger.error "[write_webm][ffmpeg] #{line}"
end end
Rails.logger.error "[write_webm] ******************************"
return
end
mkvmerge_out, status = Open3.capture2e("mkvmerge -o #{write_path} --webm --timecodes 0:#{tmpdir}/timecodes.tc #{tmpdir}/tmp.webm")
if !status.success?
Rails.logger.error "[write_webm] ******************************"
Rails.logger.error "[write_webm] failed write_path=#{write_path}"
Rails.logger.error "[write_webm] mkvmerge output:" Rails.logger.error "[write_webm] mkvmerge output:"
mkvmerge_out.split(/\n/).each do |line| mkvmerge_out.split(/\n/).each do |line|
Rails.logger.error "[write_webm][mkvmerge] #{line}" Rails.logger.error "[write_webm][mkvmerge] #{line}"
end end
Rails.logger.error "[write_webm] ******************************"
return
end end
end end
end end

View File

@@ -27,7 +27,7 @@ class TagAliasCorrectionTest < ActiveSupport::TestCase
should "have the correct statistics hash" do should "have the correct statistics hash" do
assert_equal("zzz", @correction.statistics_hash["antecedent_cache"]) assert_equal("zzz", @correction.statistics_hash["antecedent_cache"])
assert_equal("bbb", @correction.statistics_hash["consequent_cache"]) assert_equal(nil, @correction.statistics_hash["consequent_cache"])
assert_equal(-3, @correction.statistics_hash["antecedent_count"]) assert_equal(-3, @correction.statistics_hash["antecedent_count"])
assert_equal(1, @correction.statistics_hash["consequent_count"]) assert_equal(1, @correction.statistics_hash["consequent_count"])
end end

View File

@@ -53,7 +53,7 @@ class WikiPageTest < ActiveSupport::TestCase
should "not allow the is_locked attribute to be updated" do should "not allow the is_locked attribute to be updated" do
@wiki_page.update_attributes(:is_locked => true) @wiki_page.update_attributes(:is_locked => true)
assert_equal(["Is locked can be modified by moderators only", "Is locked and cannot be updated"], @wiki_page.errors.full_messages) assert_equal(["Is locked can be modified by builders only", "Is locked and cannot be updated"], @wiki_page.errors.full_messages)
@wiki_page.reload @wiki_page.reload
assert_equal(false, @wiki_page.is_locked?) assert_equal(false, @wiki_page.is_locked?)
end end