dtas-all
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/4] splitfx: use Etc.nprocessors for jobs if unspecified


From: Eric Wong
Subject: [PATCH 2/4] splitfx: use Etc.nprocessors for jobs if unspecified
Date: Fri, 7 Jan 2022 05:35:42 +0000

We'll take advantage of multicore if available; because even
bums like me have SMP machines these days.
---
 bin/dtas-splitfx | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

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 @@
 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 @@
   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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]