report all the errors

This commit is contained in:
ccd0 2014-05-01 01:31:22 -07:00
parent 5f0021842e
commit 345e176f67

View File

@ -376,14 +376,14 @@ QR =
img = new Image() img = new Image()
img.onload = => img.onload = =>
{height, width} = img {height, width} = img
pass = true
if height > QR.max_height or width > QR.max_width if height > QR.max_height or width > QR.max_width
QR.error "#{file.name}: Image too large (image: #{height}x#{width}px, max: #{QR.max_height}x#{QR.max_width}px)" QR.error "#{file.name}: Image too large (image: #{height}x#{width}px, max: #{QR.max_height}x#{QR.max_width}px)"
cb false pass = false
else if height < QR.min_height or width < QR.min_width if height < QR.min_height or width < QR.min_width
QR.error "#{file.name}: Image too small (image: #{height}x#{width}px, min: #{QR.min_height}x#{QR.min_width}px)" QR.error "#{file.name}: Image too small (image: #{height}x#{width}px, min: #{QR.min_height}x#{QR.min_width}px)"
cb false pass = false
else cb pass
cb true
img.src = URL.createObjectURL file img.src = URL.createObjectURL file
else if /^video\//.test file.type else if /^video\//.test file.type
video = $.el 'video' video = $.el 'video'
@ -392,20 +392,20 @@ QR =
{videoHeight, videoWidth, duration} = video {videoHeight, videoWidth, duration} = video
max_height = Math.min(QR.max_height, QR.max_height_video) max_height = Math.min(QR.max_height, QR.max_height_video)
max_width = Math.min(QR.max_width, QR.max_width_video) max_width = Math.min(QR.max_width, QR.max_width_video)
pass = true
if videoHeight > max_height or videoWidth > max_width if videoHeight > max_height or videoWidth > max_width
QR.error "#{file.name}: Video too large (video: #{videoHeight}x#{videoWidth}px, max: #{max_height}x#{max_width}px)" QR.error "#{file.name}: Video too large (video: #{videoHeight}x#{videoWidth}px, max: #{max_height}x#{max_width}px)"
cb false pass = false
else if videoHeight < QR.min_height or videoWidth < QR.min_width if videoHeight < QR.min_height or videoWidth < QR.min_width
QR.error "#{file.name}: Video too small (video: #{videoHeight}x#{videoWidth}px, min: #{QR.min_height}x#{QR.min_width}px)" QR.error "#{file.name}: Video too small (video: #{videoHeight}x#{videoWidth}px, min: #{QR.min_height}x#{QR.min_width}px)"
cb false pass = false
else unless isFinite video.duration unless isFinite video.duration
QR.error "#{file.name}: Video lacks duration metadata (try remuxing)" QR.error "#{file.name}: Video lacks duration metadata (try remuxing)"
cb false pass = false
else if duration > QR.max_duration_video if duration > QR.max_duration_video
QR.error "#{file.name}: Video too long (video: #{duration}s, max: #{QR.max_duration_video}s)" QR.error "#{file.name}: Video too long (video: #{duration}s, max: #{QR.max_duration_video}s)"
cb false pass = false
else cb pass
cb true
cb = null cb = null
$.on video, 'error', => $.on video, 'error', =>
return unless cb? return unless cb?