Skip to content

Commit 56ac5e4

Browse files
committed
allow user specified output path
1 parent f23274a commit 56ac5e4

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

audioqc

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,12 @@ if Gem::Platform.local.os == 'mingw32'
1919
System = 'windows'
2020
elsif Gem::Platform.local.os == 'linux'
2121
System = 'linux'
22-
else
23-
#needs to be updated with actual check for mac!
22+
elsif
23+
Gem::Platform.local.os == 'darwin'
2424
System = 'mac'
25+
else
26+
puts "Operating system has not been correctly detected. Linux will be assumed - errors may occur!"
27+
System = 'linux'
2528
end
2629

2730

@@ -73,6 +76,18 @@ end
7376
# set up arrays and variables
7477
TARGET_EXTENSION = Configurations['default_extension'] unless defined? TARGET_EXTENSION
7578

79+
# set up output CSV path
80+
timestamp = Time.now.strftime('%Y-%m-%d_%H-%M-%S')
81+
if Configurations['csv_output_path'].empty?
82+
output_csv = ENV['HOME'] + "/Desktop/audioqc-out_#{timestamp}.csv"
83+
else
84+
output_csv = Configurations['csv_output_path'] + "/audioqc-out_#{timestamp}.csv"
85+
end
86+
if ! Dir.exist?(File.dirname(output_csv))
87+
puts "Output directory not found. Please configure a valid output directory"
88+
exit 1
89+
end
90+
7691
# Start embedded WAV Mediaconch policy section
7792
# Policy derived from MediaConch Public Policies. Original Maintainer Peter B. License: CC-BY-4.0+
7893
mc_policy = <<~EOS
@@ -357,9 +372,6 @@ file_inputs.each do |fileinput|
357372
write_to_csv << target.output_csv_line(options)
358373
end
359374

360-
timestamp = Time.now.strftime('%Y-%m-%d_%H-%M-%S')
361-
output_csv = ENV['HOME'] + "/Desktop/audioqc-out_#{timestamp}.csv"
362-
363375
CSV.open(output_csv, 'wb') do |csv|
364376
headers = ['Filename', 'Warnings', 'Duration']
365377
if options.include?('dropouts')

audioqc.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ dualmono_audio_phase_limit: 0.95
77
generic_audio_phase_limit: -0.25
88
high_level_warning: -2.0
99
default_extension: 'wav'
10+
csv_output_path: ''
1011
default_options: [signal, meta, bext, md5]

0 commit comments

Comments
 (0)