Skip to content

Commit 402fad4

Browse files
authored
Merge pull request #16 from amiaopensource/add-exception
log and continue on error
2 parents e6b2a4f + e17cc40 commit 402fad4

File tree

1 file changed

+34
-24
lines changed

1 file changed

+34
-24
lines changed

audioqc

Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,11 @@ class QcTarget
271271
end
272272

273273
def output_csv_line(options)
274-
line = [@input_path, @warnings.flatten.join(', '), @duration_normalized]
274+
if options.include?('error')
275+
line = [@input_path, 'FAILED TO PARSE']
276+
else
277+
line = [@input_path, @warnings.flatten.join(', '), @duration_normalized]
278+
end
275279
if options.include?('dropouts')
276280
line << @possible_drops
277281
end
@@ -344,33 +348,39 @@ else
344348
end
345349

346350
file_inputs.each do |fileinput|
347-
puts "Scanning: #{fileinput}"
348-
target = QcTarget.new(File.expand_path(fileinput))
349-
target.get_mediainfo
350-
if options.include?('meta')
351-
if defined? POLICY_FILE
352-
target.media_conch_scan(POLICY_FILE)
353-
else
354-
target.media_conch_scan('Valid Policy File Not Found')
351+
begin
352+
puts "Scanning: #{fileinput}"
353+
targetPath = File.expand_path(fileinput)
354+
target = QcTarget.new(targetPath)
355+
target.get_mediainfo
356+
if options.include?('meta')
357+
if defined? POLICY_FILE
358+
target.media_conch_scan(POLICY_FILE)
359+
else
360+
target.media_conch_scan('Valid Policy File Not Found')
361+
end
362+
target.check_metaedit unless TARGET_EXTENSION != 'wav'
355363
end
356-
target.check_metaedit unless TARGET_EXTENSION != 'wav'
357-
end
358-
if options.include?('bext')
359-
target.qc_encoding_history
360-
end
361-
if options.include?('md5')
362-
target.check_md5
363-
end
364-
if options.include?('signal') || options.include?('dropouts')
365-
target.get_ffprobe
366-
if options.include?('signal')
367-
target.find_peaks_loudness_n_phase
364+
if options.include?('bext')
365+
target.qc_encoding_history
368366
end
369-
if options.include?('dropouts')
370-
target.check_dropouts
367+
if options.include?('md5')
368+
target.check_md5
369+
end
370+
if options.include?('signal') || options.include?('dropouts')
371+
target.get_ffprobe
372+
if options.include?('signal')
373+
target.find_peaks_loudness_n_phase
374+
end
375+
if options.include?('dropouts')
376+
target.check_dropouts
377+
end
371378
end
379+
write_to_csv << target.output_csv_line(options)
380+
rescue
381+
puts "Error scanning: #{targetPath}"
382+
write_to_csv << target.output_csv_line('error')
372383
end
373-
write_to_csv << target.output_csv_line(options)
374384
end
375385

376386
CSV.open(output_csv, 'wb') do |csv|

0 commit comments

Comments
 (0)