about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2022-01-07 05:35:42 +0000
committerEric Wong <e@80x24.org>2022-01-11 18:21:59 +0000
commit593b3a2bd374c30ee9e62cfa7144bb371d82f10e (patch)
tree9b60d7b4667264638dd9d2008a00a2695f661aa7
parente6ca961fd5fe69afeec6c024dfbf9f12a3decde1 (diff)
downloaddtas-593b3a2bd374c30ee9e62cfa7144bb371d82f10e.tar.gz
We'll take advantage of multicore if available; because even
bums like me have SMP machines these days.
-rwxr-xr-xbin/dtas-splitfx7
1 files changed, 6 insertions, 1 deletions
diff --git a/bin/dtas-splitfx b/bin/dtas-splitfx
index 3ee812e..18ea0b4 100755
--- a/bin/dtas-splitfx
+++ b/bin/dtas-splitfx
@@ -8,7 +8,7 @@ require 'dtas/splitfx'
 usage = "#$0 [-n|--dry-run][-j [JOBS]][-s|--silent] SPLITFX_FILE.yml [TARGET]"
 overrides = {} # FIXME: not tested
 default_target = "flac"
-opts = { jobs: 1 }
+opts = { jobs: nil }
 OptionParser.new('', 24, '  ') do |op|
   op.banner = usage
   op.on('-n', '--dry-run') { opts[:dryrun] = true }
@@ -37,6 +37,11 @@ if opts[:sox_pipe] && opts[:err_suffix]
   abort '--err-suffix and --sox-pipe are mutually exclusive'
 end
 
+if opts[:jobs].nil?
+  require 'etc'
+  opts[:jobs] = Etc.nprocessors
+end
+
 args = []
 ARGV.each do |arg|
   case arg