From: Colin P. Mccabe Date: Mon, 23 Aug 2021 06:09:54 +0000 (-0700) Subject: superrip.rb: update for latest ruby X-Git-Url: http://club.cc.cmu.edu/~cmccabe/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c643c5b764d6fd09aaf8708a8593ca944802ae1b;p=cmccabe-bin superrip.rb: update for latest ruby --- diff --git a/superrip.rb b/superrip.rb index cc413db..e7acb5e 100755 --- a/superrip.rb +++ b/superrip.rb @@ -56,14 +56,14 @@ end # Process the WAV file into an MP3 and FLAC file. # This is done in a background process. def process_wav(track) - FileUtils.mkdir_p(track.flac_dir, $fu_args) + FileUtils.mkdir_p(track.flac_dir, verbose: true, noop: !$opts.dry_run) my_system("flac -f '#{track.wav_file_name}' \ --output-name='#{track.flac_file_name}' &>/dev/null") my_system("flac --test '#{track.flac_file_name}' &>/dev/null") - FileUtils.mkdir_p(track.mp3_dir, $fu_args) + FileUtils.mkdir_p(track.mp3_dir, verbose: true, noop: !$opts.dry_run) my_system("lame -q 1 -b 192 '#{track.wav_file_name}' \ '#{track.mp3_file_name}' &>/dev/null") - FileUtils.rm_f(track.wav_file_name, $fu_args) + FileUtils.rm_f(track.wav_file_name, verbose: true, noop: !$opts.dry_run) end def audiorip(tnum, track) @@ -73,7 +73,7 @@ def audiorip(tnum, track) raise "failed to rip track #{tnum} (#{track.name})" end # cdparanoia always outputs to cdda.wav - FileUtils.mv("cdda.wav", track.wav_file_name, $fu_args) + FileUtils.mv("cdda.wav", track.wav_file_name, verbose: true, noop: !$opts.dry_run) # If there are too many processes, wait for one of them to terminate if ($children.keys.length > $opts.max_children) then @@ -108,7 +108,6 @@ class MyOptions opts.dry_run = false opts.max_children = 4 opts.cd_dev = "/dev/cdrom" - $fu_args = { :verbose => true } # Fill in opts values parser = OptionParser.new do |myparser| @@ -121,7 +120,6 @@ class MyOptions myparser.on("--dry-run", "-d", "Show what would be done, without doing it.") do |a| opts.dry_run = true - $fu_args = { :verbose => true, :noop => true } end myparser.on("--tracklist [FILE]", "-t", "Provide a list of tracks to use.") do |file|