dtas 0.19.0 → 0.20.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/Documentation/dtas-splitfx.pod +36 -9
  3. data/Documentation/dtas-tl.pod +3 -1
  4. data/GIT-VERSION-FILE +1 -1
  5. data/GIT-VERSION-GEN +2 -2
  6. data/INSTALL +13 -7
  7. data/NEWS +54 -0
  8. data/README +1 -1
  9. data/bin/dtas-archive +6 -2
  10. data/bin/dtas-console +36 -4
  11. data/bin/dtas-msinkctl +2 -3
  12. data/bin/dtas-partstats +3 -9
  13. data/bin/dtas-player +1 -2
  14. data/bin/dtas-readahead +11 -25
  15. data/bin/dtas-sinkedit +3 -4
  16. data/bin/dtas-sourceedit +3 -4
  17. data/bin/dtas-splitfx +10 -5
  18. data/bin/dtas-tl +32 -27
  19. data/dtas.gemspec +3 -3
  20. data/dtas.sh +4 -3
  21. data/examples/splitfx.sample.yml +1 -1
  22. data/examples/tfx.sample.yml +1 -1
  23. data/lib/dtas/buffer/fiddle_splice.rb +2 -1
  24. data/lib/dtas/buffer/read_write.rb +1 -2
  25. data/lib/dtas/buffer/splice.rb +2 -1
  26. data/lib/dtas/buffer.rb +2 -2
  27. data/lib/dtas/edit_client.rb +2 -3
  28. data/lib/dtas/fadefx.rb +2 -2
  29. data/lib/dtas/mcache.rb +14 -3
  30. data/lib/dtas/mlib.rb +5 -7
  31. data/lib/dtas/partstats.rb +2 -3
  32. data/lib/dtas/pipe.rb +2 -3
  33. data/lib/dtas/pipeline.rb +1 -4
  34. data/lib/dtas/player/client_handler.rb +3 -3
  35. data/lib/dtas/player.rb +6 -12
  36. data/lib/dtas/process.rb +3 -5
  37. data/lib/dtas/rg_state.rb +2 -2
  38. data/lib/dtas/sigevent/fiddle_efd.rb +3 -4
  39. data/lib/dtas/sigevent/pipe.rb +2 -3
  40. data/lib/dtas/sink.rb +1 -2
  41. data/lib/dtas/source/av_ff_common.rb +3 -3
  42. data/lib/dtas/source/sox.rb +3 -3
  43. data/lib/dtas/source/splitfx.rb +2 -3
  44. data/lib/dtas/splitfx.rb +14 -3
  45. data/lib/dtas/state_file.rb +2 -2
  46. data/lib/dtas/track.rb +1 -1
  47. data/lib/dtas/unix_accepted.rb +12 -37
  48. data/lib/dtas/unix_client.rb +2 -2
  49. data/lib/dtas/unix_server.rb +2 -14
  50. data/lib/dtas/version.rb +1 -1
  51. data/lib/dtas/watchable/fiddle_ino.rb +3 -3
  52. data/lib/dtas/watchable.rb +1 -2
  53. data/lib/dtas.rb +6 -22
  54. data/man/dtas-archive.1 +1 -1
  55. data/man/dtas-console.1 +1 -1
  56. data/man/dtas-ctl.1 +1 -1
  57. data/man/dtas-cueedit.1 +1 -1
  58. data/man/dtas-enq.1 +1 -1
  59. data/man/dtas-env.7 +1 -1
  60. data/man/dtas-msinkctl.1 +1 -1
  61. data/man/dtas-player.1 +1 -1
  62. data/man/dtas-player_effects.7 +1 -1
  63. data/man/dtas-player_protocol.7 +1 -1
  64. data/man/dtas-player_sink_examples.7 +1 -1
  65. data/man/dtas-sinkedit.1 +1 -1
  66. data/man/dtas-sourceedit.1 +1 -1
  67. data/man/dtas-splitfx.1 +38 -13
  68. data/man/dtas-tl.1 +4 -2
  69. data/man/dtas-xdelay.1 +1 -1
  70. data/{perl → script}/dtas-graph +1 -1
  71. data/test/player_integration.rb +1 -2
  72. data/test/test_buffer.rb +2 -2
  73. data/test/test_encoding.rb +2 -3
  74. data/test/test_format_change.rb +2 -2
  75. data/test/test_mcache.rb +15 -5
  76. data/test/test_player_client_handler.rb +2 -2
  77. data/test/test_player_integration.rb +7 -8
  78. data/test/test_rg_integration.rb +9 -9
  79. data/test/test_sink.rb +2 -2
  80. data/test/test_splitfx.rb +2 -5
  81. data/test/test_tfx.rb +2 -3
  82. data/test/test_unixserver.rb +1 -1
  83. metadata +5 -8
  84. data/lib/dtas/compat_onenine.rb +0 -17
  85. data/lib/dtas/nonblock.rb +0 -24
  86. data/lib/dtas/spawn_fix.rb +0 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a438c78c4e4d0f01c8eb39a7f1b485908aada064999fff95a4a0af5adb6250b8
4
- data.tar.gz: fc98612cd6e13dcd16d2f7e0cfc46830c182b5812be0c1c4b82d063c1e7d8d2f
3
+ metadata.gz: 8f1bef240a616d74eeffa033144a1323c2a82b29d270c3620654af293bd2fe42
4
+ data.tar.gz: 2c48a6d95b4d5adebe16ce99bd14e18c997cd9011dd77dae2331d98b7df794de
5
5
  SHA512:
6
- metadata.gz: 5346176f2434ec3250a3cd890731cc239cfc1725df45d18c3c1ce3683ab7e512783aa28a94b5158eb0cdab33bb9a7c194c29495e26c8724120de8246211bb512
7
- data.tar.gz: 8696a91edff35cc7b35f930d59d9d62be4835042ac9be6b7f3737395f719f4715c0f8e6af35ca00815d6efdf2d208fd42536b195f0dc661bf0738e890ed4b224
6
+ metadata.gz: a32d0952afed05e71ad637012be3e8622fc889c6217e6baa4322f7bc711c66df1a7c31100cc0f751e8d7f2a862e301789f7e3475ae823f4cd336a7139540661c
7
+ data.tar.gz: d46c3e1b6b48091a9fafeeb0d15af21e01a5f0bfe02d89028165f20fdd0ba026c3de3509308dd959968dd76c5e110fbcc842bc7e86ea2139ec0a0f9cc981ec09
@@ -26,7 +26,8 @@ to use L<ecasound(1)>, too.
26
26
  =item -j, --jobs [JOBS]
27
27
 
28
28
  Number of jobs to run in parallel. If no number is specified, all
29
- jobs are run in parallel.
29
+ jobs are run in parallel. Default: number of CPUS (dtas 0.20.0+),
30
+ previous versions of dtas defaulted to 1.
30
31
 
31
32
  =item -n, --dry-run
32
33
 
@@ -76,6 +77,16 @@ outputs the result as a single file with the TRACKNUMBER
76
77
  of "000". For ease-of-typing, commas in this command-line
77
78
  argument are automatically expanded to spaces when passed to sox.
78
79
 
80
+ This switch may not be combined with L</--filter>
81
+
82
+ =item -f, --filter [FIELD=]VALUE
83
+
84
+ Only process tracks matching a given comment FIELD and VALUE.
85
+ If no C<=> is exists, then all comment fields are matched
86
+ against the specified VALUE.
87
+
88
+ This switch may not be combined with L</--trim>
89
+
79
90
  =item -p, --sox-pipe
80
91
 
81
92
  Used in place of an output target to specify outputting audio data in
@@ -90,9 +101,9 @@ moves printing of output to stderr and disables parallel job invocation.
90
101
 
91
102
  =item infile - string, the pathname of the original audio file
92
103
 
93
- =item env - ordered hash of environment variables to set for all commands
104
+ =item env - hash of environment variables to set for all commands
94
105
 
95
- env: !omap
106
+ env:
96
107
  FX: gain 3 stats
97
108
 
98
109
  =item comments - hash of common tags for all audio (e.g. ARTIST, ALBUM, YEAR)
@@ -121,7 +132,12 @@ highest-numbered track. Default: true
121
132
 
122
133
  =item targets - hash, see "TARGETS" section
123
134
 
124
- =item command - used only by L<dtas-player(1)>
135
+ =item command - override the default sox invocation
136
+
137
+ This command may be used to specify an alternate command to process each
138
+ track.
139
+
140
+ Default: sox "$INFILE" $COMMENTS $OUTFMT $OUTDST $TRIMFX $FX $RATEFX $DITHERFX
125
141
 
126
142
  =back
127
143
 
@@ -133,11 +149,22 @@ segment.
133
149
 
134
150
  =over
135
151
 
136
- =item t TIME TITLE [fade_in/fade_out=FADE_ARGS]
152
+ =item t TIME TITLE [fade_in/fade_out=FADE_ARGS] [.FIELD=VALUE] [env.X=Y]
153
+
154
+ The start of a new track at TIME with TITLE.
155
+ An optional L</fade_in> and L</fade_out> may be specified for any tracks.
156
+ Per-track comments may be specified in the form of C<.FIELD=VALUE>.
157
+ Using per-track C<.ARTIST=FOO> allows proper tagging of multi-artist
158
+ compilations.
137
159
 
138
- The start of a new track
139
- at TIME with TITLE. An optional fade_in and fade_out may be specified
140
- for the first/last tracks.
160
+ Per-track environment variables may be specified in the form
161
+ of C<env.K=V> where C<K> is the environment variable name and
162
+ C<V> is its value. Per-track environment variables do not affect
163
+ playback of YAML files via L<dtas-player(1)> nor use of the L</--trim>
164
+ command-line option. However, per-track environment variables do affect
165
+ any tracks written to the filesystem, including those using the L</--filter>
166
+ switch. These environment variables are intended to affect the specified
167
+ L</command> or default L<sox(1)> invocation.
141
168
 
142
169
  =item skip TIME - skip a segment starting at TIME
143
170
 
@@ -268,7 +295,7 @@ imbalance in a live concert recording from the audience:
268
295
 
269
296
  =head1 COPYRIGHT
270
297
 
271
- Copyright 2013-2020 all contributors L<mailto:dtas-all@nongnu.org>
298
+ Copyright all contributors L<mailto:dtas-all@nongnu.org>
272
299
 
273
300
  License: GPL-3.0+ L<https://www.gnu.org/licenses/gpl-3.0.txt>
274
301
 
@@ -60,6 +60,8 @@ optionally seek to POS. POS should be a timestamp in HH:MM:SS.FRAC format.
60
60
 
61
61
  =item prev - play the previous track in the tracklist
62
62
 
63
+ =item prune - cull non-existent pathnames from the tracklist
64
+
63
65
  =item repeat 1 - repeat the current track
64
66
 
65
67
  =item repeat false - disable repeat
@@ -120,7 +122,7 @@ No subscription is necessary to post to the mailing list.
120
122
 
121
123
  =head1 COPYRIGHT
122
124
 
123
- Copyright 2013-2020 all contributors L<mailto:dtas-all@nongnu.org>
125
+ Copyright all contributors L<mailto:dtas-all@nongnu.org>
124
126
 
125
127
  License: GPL-3.0+ L<https://www.gnu.org/licenses/gpl-3.0.txt>
126
128
 
data/GIT-VERSION-FILE CHANGED
@@ -1 +1 @@
1
- VERSION = 0.19.0
1
+ VERSION = 0.20.0
data/GIT-VERSION-GEN CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env ruby
2
- # Copyright (C) 2013-2021 all contributors <dtas-all@nongnu.org>
2
+ # Copyright (C) all contributors <dtas-all@nongnu.org>
3
3
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
4
4
  # frozen_string_literal: true
5
5
  CONSTANT = "DTAS::VERSION"
6
6
  RVF = "lib/dtas/version.rb"
7
7
  GVF = "GIT-VERSION-FILE"
8
- DEF_VER = "v0.19.0"
8
+ DEF_VER = "v0.20.0"
9
9
  vn = DEF_VER
10
10
 
11
11
  # First see if there is a version file (included in release tarballs),
data/INSTALL CHANGED
@@ -1,7 +1,8 @@
1
- Uncommon for audio software, dtas is currently implemented in Ruby.
1
+ Uncommon for audio software, dtas is currently implemented in Ruby
2
+ (and some Perl5).
2
3
 
3
4
  The latest stable release or development snapshot of Ruby is recommended.
4
- However, Ruby 1.9.3 and later works, but older versions of Ruby do not.
5
+ However, Ruby 2.3 and later works, but older versions of Ruby do not.
5
6
 
6
7
  SoX is a dependency of dtas-player. While not _strictly_ required,
7
8
  dtas-player uses SoX by default and you will need it unless you've
@@ -25,14 +26,19 @@ For future upgrades of dtas
25
26
 
26
27
  sudo gem install dtas
27
28
 
28
- # installing dtas via tarball and setup.rb
29
+ # installing dtas via tarball
29
30
 
30
31
  Grab the latest tarball from our HTTPS site:
31
32
 
32
- https://80x24.org/dtas/2021/dtas-0.19.0.tar.gz
33
+ https://80x24.org/dtas/2022/dtas-0.20.0.tar.gz
33
34
 
34
- $ tar zxvf dtas-0.19.0.tar.gz
35
- $ cd dtas-0.19.0
35
+ $ tar zxvf dtas-0.20.0.tar.gz
36
+ $ cd dtas-0.20.0
37
+
38
+ # To install symlinks into ~/bin (assuming your Ruby executable is "ruby")
39
+ $ make symlink-install
40
+
41
+ # or using setup.rb:
36
42
  $ sudo ruby setup.rb
37
43
 
38
44
  # CONTACT
@@ -45,5 +51,5 @@ No subscription is necessary to post to the mailing list.
45
51
 
46
52
  # COPYRIGHT
47
53
 
48
- Copyright 2013-2021 all contributors <dtas-all@nongnu.org>
54
+ Copyright all contributors <dtas-all@nongnu.org>
49
55
  License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
data/NEWS CHANGED
@@ -1,3 +1,57 @@
1
+ # 0.20.0 / 2022-02-03
2
+
3
+ dtas 0.20.0 - ruby 3.1+ compatibility, splitfx improvements
4
+
5
+
6
+ This release catches up with Psych (YAML) changes in Ruby 3.1+
7
+ Ruby 2.3+ is now the minimum version, though keep in mind the
8
+ ruby-core team already dropped support for it long ago.
9
+
10
+ Most of the features are focused on audio engineering
11
+ capabilities of dtas-splitfx. dtas-splitfx gains the --filter
12
+ switch, along with per-track environment variables and comments.
13
+ These new features have made my workflow significantly better.
14
+
15
+ dtas-archive supports explicit comments, and omits the default
16
+ SoX comment. To better cope with temporary and modified files
17
+ during editing, dtas-player metadata now checks ctime before
18
+ reusing the cache, handy for frequently-modified files.
19
+ "dtas-tl prune" is now supported to cull temporary files from
20
+ the player tracklist.
21
+
22
+ There's a few dtas-console improvements, too.
23
+
24
+ 28 changes since v0.19.0 (2021-09-05):
25
+
26
+ archive: support comments, default to none
27
+ splitfx: use Etc.nprocessors for jobs if unspecified
28
+ dtas-console: set X11 terminal title iff DISPLAY is set
29
+ dtas-console: add 'i' toggle to show comments (metadata)
30
+ splitfx: fix track_zpad with integer arg
31
+ doc: drop ordered map from examples
32
+ player: reduce syscalls when splicing to single target
33
+ dtas-console: support Wayland terminal titles, too
34
+ console: workaround safe warnings in outdated `curses' gem
35
+ require Ruby 2.3+
36
+ get rid of DTAS.dedupe_str wrapper
37
+ move dtas-graph into script/, support Perl for dtas.sh
38
+ use YAML.unsafe_load in Psych 4.x (Ruby 3.1+)
39
+ deduplicate and freeze pathnames + metadata
40
+ player: remove omap conversion
41
+ dtas: drop unnecessary "require 'yaml'" statements
42
+ dtas-tl prune: cull missing files from tracklist
43
+ dtas-tl: drop encoding hacks, use binary stdout+stderr
44
+ use IO#wait_readable consistently
45
+ get rid of DTAS::Nonblock wrapper for Ruby <= 2.0
46
+ unix_accepted: drop Ruby < 2.3 support code
47
+ do not check IO#closed? before calling IO#close
48
+ splitfx: support per-track environment variables
49
+ splitfx: add --filter option to limit match to comments
50
+ player: expire sox metadata cache on file st_ctime changes
51
+ readahead: do not call -@ on non-String
52
+ splitfx: disallow combining --trim and --filter
53
+ splitfx: document changes ahead of 0.20.0 release
54
+
1
55
  # 0.19.0 / 2021-09-05
2
56
 
3
57
  dtas 0.19.0 - odd pathname fixes
data/README CHANGED
@@ -92,7 +92,7 @@ Atom: <https://80x24.org/dtas-all/new.atom>
92
92
 
93
93
  ## Copyright
94
94
 
95
- Copyright 2013-2021 all contributors <dtas-all@nongnu.org>
95
+ Copyright all contributors <dtas-all@nongnu.org>
96
96
  License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
97
97
 
98
98
  dtas is copyrighted Free Software by all contributors, see logs
data/bin/dtas-archive CHANGED
@@ -29,6 +29,7 @@ repeat = 1
29
29
  stats = false
30
30
  keep_going = false
31
31
  compression = []
32
+ comment = []
32
33
 
33
34
  OptionParser.new('', 24, ' ') do |op|
34
35
  op.banner = usage
@@ -36,6 +37,7 @@ OptionParser.new('', 24, ' ') do |op|
36
37
  op.on('-C', '--compression [FACTOR]', 'compression factor for sox') { |c|
37
38
  compression = [ '-C', c ]
38
39
  }
40
+ op.on('--comment=TEXT', String) { |c| comment.push('--comment', c) }
39
41
  op.on('-j', '--jobs [JOBS]', Integer) { |j| jobs = j }
40
42
  op.on('-S', '--stats', 'save stats on the file') { stats = true }
41
43
  op.on('-k', '--keep-going', 'continue after error') { keep_going = true }
@@ -53,6 +55,8 @@ OptionParser.new('', 24, ' ') do |op|
53
55
  op.parse!(ARGV)
54
56
  end
55
57
 
58
+ comment.push('--comment', '') if comment.empty?
59
+
56
60
  dst = ARGV.pop
57
61
  src = ARGV.dup
58
62
 
@@ -137,7 +141,7 @@ thrs = jobs.times.map do |i|
137
141
 
138
142
  if dry_run || !silent
139
143
  names = job.map { |x| Shellwords.escape(x) }
140
- cmd = [ 'sox', *names ]
144
+ cmd = [ 'sox', names[0], *compression, *comment, names[1] ]
141
145
  if stats
142
146
  cmd << 'stats'
143
147
  cmd << "2>#{Shellwords.escape(stats_out)}"
@@ -151,7 +155,7 @@ thrs = jobs.times.map do |i|
151
155
  end
152
156
  end
153
157
 
154
- cmd = [ 'sox', input, *compression, output ]
158
+ cmd = [ 'sox', input, *compression, *comment, output ]
155
159
  if stats
156
160
  cmd << 'stats'
157
161
  cmd = [ *cmd, { err: stats_out } ]
data/bin/dtas-console CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- # Copyright (C) 2013-2021 all contributors <dtas-all@nongnu.org>
2
+ # Copyright (C) all contributors <dtas-all@nongnu.org>
3
3
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
4
4
  # frozen_string_literal: true
5
5
  #
@@ -11,21 +11,24 @@ require 'dtas/sigevent'
11
11
  require 'dtas/process'
12
12
  require 'dtas/format'
13
13
  include DTAS::Process
14
- require 'yaml'
15
14
  begin
16
15
  require 'curses'
17
16
  rescue LoadError
18
17
  abort "please install the 'curses' RubyGem to use #$0"
19
18
  end
20
19
 
20
+ # workaround https://bugs.debian.org/958973
21
+ $VERBOSE = nil if RUBY_VERSION.to_f < 3.0
22
+
21
23
  tsec = false
22
24
  se = DTAS::Sigevent.new
23
25
  trap(:WINCH) { se.signal }
24
26
  w = DTAS::UNIXClient.new
25
27
  w.req_ok('watch')
26
28
  c = DTAS::UNIXClient.new
27
- cur = YAML.load(c.req('current'))
29
+ cur = DTAS.yaml_load(c.req('current'))
28
30
  readable = [ se, w, $stdin ]
31
+ set_title = (ENV['DISPLAY'] || ENV['WAYLAND_DISPLAY']) ? $stdout : nil
29
32
 
30
33
  # current rg mode
31
34
  rg_mode = DTAS::RGState::RG_MODE.keys.unshift("off")
@@ -34,6 +37,7 @@ if (rg = cur["rg"]) && (rg = rg["mode"])
34
37
  else
35
38
  rg_mode_i = 0
36
39
  end
40
+ show_info = false
37
41
 
38
42
  def update_tfmt(prec, tsec)
39
43
  if tsec
@@ -167,6 +171,10 @@ begin
167
171
  # and risk mojibake...
168
172
  infile.encode(enc_locale,
169
173
  undef: :replace, invalid: :replace, replace: '?')
174
+ if set_title
175
+ dir, base = File.split(infile)
176
+ set_title.syswrite("\033]0;#{base} dtas-console\07")
177
+ end
170
178
  Curses.setpos(lineno += 1, 0)
171
179
  Curses.clrtoeol
172
180
  Curses.addstr(infile)
@@ -203,6 +211,27 @@ begin
203
211
  Curses.addstr(extra.join(' '))
204
212
  pre_mute_vol = cur_vol if cur_vol != 0
205
213
 
214
+ if show_info && current && comments = current['comments']
215
+ Curses.setpos(lineno += 1, 0)
216
+ Curses.clrtoeol
217
+ Curses.addstr('comments:')
218
+ comments.each do |k,v|
219
+ v = v.split(/\n+/)
220
+ k = k.dump if /[[:cntrl:]]/ =~ k
221
+ if first = v.shift
222
+ Curses.setpos(lineno += 1, 0)
223
+ Curses.clrtoeol
224
+ first = first.dump if /[[:cntrl:]]/ =~ first
225
+ Curses.addstr(" #{k}: #{first}")
226
+ v.each do |val|
227
+ val = val.dump if /[[:cntrl:]]/ =~ val
228
+ Curses.setpos(lineno += 1, 0)
229
+ Curses.clrtoeol
230
+ Curses.addstr(" #{val}")
231
+ end
232
+ end
233
+ end
234
+ end
206
235
  show_events(lineno, screen, events)
207
236
 
208
237
  Curses.refresh # draw and wait
@@ -224,7 +253,7 @@ begin
224
253
  events << "#{Time.now.strftime(tfmt)} #{event}"
225
254
  # something happened, refresh current
226
255
  # we could be more intelligent here, maybe, but too much work.
227
- cur = YAML.load(c.req('current'))
256
+ cur = DTAS.yaml_load(c.req('current'))
228
257
  when $stdin
229
258
  # keybindings taken from mplayer / vi
230
259
  case key = Curses.getch
@@ -272,6 +301,9 @@ begin
272
301
  interval = 1.0 / 10 ** prec_nr
273
302
  end
274
303
  when 27 # TODO readline/edit mode?
304
+ when 'i'
305
+ show_info = !show_info
306
+ Curses.clear if !show_info
275
307
  else
276
308
  Curses.setpos(screen.maxy - 1, 0)
277
309
  Curses.clrtoeol
data/bin/dtas-msinkctl CHANGED
@@ -1,8 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
- # Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
2
+ # Copyright (C) all contributors <dtas-all@nongnu.org>
3
3
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
4
4
  # frozen_string_literal: true
5
- require 'yaml'
6
5
  require 'dtas/unix_client'
7
6
  usage = "#$0 <active-set|active-add|active-sub|nonblock|active> SINK"
8
7
  c = DTAS::UNIXClient.new
@@ -29,7 +28,7 @@ def filter(c, player_sinks, key)
29
28
  rv = []
30
29
  player_sinks.each do |name|
31
30
  buf = c.req("sink cat #{name}")
32
- sink = YAML.load(buf)
31
+ sink = DTAS.yaml_load(buf)
33
32
  rv << sink["name"] if sink[key]
34
33
  end
35
34
  rv
data/bin/dtas-partstats CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- # Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
2
+ # Copyright (C) all contributors <dtas-all@nongnu.org>
3
3
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
4
4
  # frozen_string_literal: true
5
5
  # TODO
@@ -8,17 +8,11 @@
8
8
  # - configurable output formatting
9
9
  # - Sequel/SQLite support
10
10
  require 'dtas/partstats'
11
+ require 'etc'
11
12
  infile = ARGV[0] or abort "usage: #$0 INFILE"
12
13
  ps = DTAS::PartStats.new(infile)
13
14
 
14
- def nproc
15
- require 'etc'
16
- Etc.nprocessors
17
- rescue NoMethodError
18
- `nproc 2>/dev/null || echo 2`.to_i
19
- end
20
-
21
- opts = { jobs: nproc }
15
+ opts = { jobs: Etc.nprocessors }
22
16
  stats = ps.run(opts)
23
17
 
24
18
  headers = ps.key_idx.to_a
data/bin/dtas-player CHANGED
@@ -1,9 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
- # Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
2
+ # Copyright (C) all contributors <dtas-all@nongnu.org>
3
3
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
4
4
  # frozen_string_literal: true
5
5
  Thread.abort_on_exception = $stderr.sync = $stdout.sync = true
6
- require 'yaml'
7
6
  require 'dtas/player'
8
7
  sock = (ENV["DTAS_PLAYER_SOCK"] || File.expand_path("~/.dtas/player.sock"))
9
8
  state = (ENV["DTAS_PLAYER_STATE"] ||
data/bin/dtas-readahead CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- # Copyright (C) 2015-2020 all contributors <dtas-all@nongnu.org>
2
+ # Copyright (C) all contributors <dtas-all@nongnu.org>
3
3
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
4
4
  # frozen_string_literal: true
5
5
  #
@@ -12,13 +12,11 @@ end
12
12
  @ffprobe = 'ffprobe'
13
13
  @avprobe = 'avprobe'
14
14
 
15
- require 'yaml'
16
15
  require 'io/wait'
17
16
  require 'dtas/unix_client'
18
17
  require 'dtas/process'
19
18
 
20
19
  include DTAS::Process
21
- include DTAS::SpawnFix
22
20
  trap(:CHLD) { DTAS::Process.reaper {} }
23
21
  trap(:INT) { exit(0) }
24
22
  trap(:TERM) { exit(0) }
@@ -30,18 +28,6 @@ null = DTAS.null
30
28
  @redir = { err: null, out: null, in: null }.freeze
31
29
  require 'pp'
32
30
 
33
- if RUBY_VERSION.to_r >= '2.3'.to_r
34
- # Old Rubies did FIONREAD, which breaks on SOCK_SEQPACKET
35
- def wait_read(w, timeout)
36
- w.to_io.wait_readable(timeout)
37
- end
38
- else
39
- def wait_read(w, timeout)
40
- r = IO.select([w], nil, nil, timeout)
41
- r ? r[0] : nil
42
- end
43
- end
44
-
45
31
  def seek_to_cur_pos(cur_pid, fp)
46
32
  cur_fd = []
47
33
  fpst = fp.stat
@@ -122,7 +108,7 @@ def do_ra(fp, pos, w)
122
108
  len -= n
123
109
 
124
110
  # stop reading immediately if there's an event
125
- if wait_read(w, 0)
111
+ if w.to_io.wait_readable(0)
126
112
  adj = @todo_ra
127
113
  pos += size
128
114
  break
@@ -141,8 +127,8 @@ def do_open(path)
141
127
  when "---\n"
142
128
  buf << fp.read(fp.size - 4)
143
129
  Dir.chdir(File.dirname(path)) do
144
- yml = YAML.load(buf)
145
- x = yml['infile'] and return File.open(File.expand_path(x).freeze)
130
+ yml = DTAS.yaml_load(buf)
131
+ x = yml['infile'] and return File.open(-File.expand_path(x))
146
132
  end
147
133
  end
148
134
  end
@@ -156,12 +142,12 @@ begin
156
142
  @todo_ra = @max_ra
157
143
  t0 = DTAS.now
158
144
  fp = nil
159
- cur = YAML.load(c.req('current'))
145
+ cur = DTAS.yaml_load(c.req('current'))
160
146
  while @todo_ra > 0 && fp.nil?
161
147
  if current = cur['current']
162
148
  track = current['infile']
163
149
  break unless track.kind_of?(String)
164
- track.freeze
150
+ track = -track
165
151
  fp = work[track] ||= do_open(track)
166
152
  cur_pid = current['pid']
167
153
  if fp
@@ -178,7 +164,7 @@ begin
178
164
  end
179
165
 
180
166
  # queue has priority, work on it, first
181
- queue = YAML.load(c.req('queue cat'))
167
+ queue = DTAS.yaml_load(c.req('queue cat'))
182
168
  while @todo_ra > 0 && track = queue.shift
183
169
  next unless track.kind_of?(String)
184
170
  fp = nil
@@ -198,7 +184,7 @@ begin
198
184
  repeat = c.req('tl repeat').split[-1]
199
185
  while @todo_ra > 0 && idx && (cid = ids[idx])
200
186
  fp = nil
201
- track = c.req("tl get #{cid}").sub!(/\A1 \d+=/, '').freeze
187
+ track = -(c.req("tl get #{cid}").sub!(/\A1 \d+=/, ''))
202
188
  begin
203
189
  fp = work[track] ||= do_open(track)
204
190
  rescue SystemCallError
@@ -210,7 +196,7 @@ begin
210
196
  end
211
197
  end
212
198
  idx or break
213
- cur = YAML.load(c.req('current'))
199
+ cur = DTAS.yaml_load(c.req('current'))
214
200
  current = cur['current'] or break
215
201
  end
216
202
  if current
@@ -220,10 +206,10 @@ begin
220
206
  timeout = 0 if timeout < 0
221
207
  else
222
208
  work.each_value(&:close).clear
223
- fp.close if fp && !fp.closed?
209
+ fp.close if fp
224
210
  fp = timeout = nil
225
211
  end
226
- r = wait_read(w, timeout)
212
+ r = w.to_io.wait_readable(timeout)
227
213
  p w.res_wait if r
228
214
  rescue EOFError
229
215
  abort "dtas-player exited"
data/bin/dtas-sinkedit CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- # Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
2
+ # Copyright (C) all contributors <dtas-all@nongnu.org>
3
3
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
4
4
  # frozen_string_literal: true
5
5
  require 'optparse'
@@ -36,10 +36,10 @@ st_in = $stdin.stat
36
36
 
37
37
  buf = c.req(%W(sink cat #{name}))
38
38
  abort(buf) if buf =~ /\AERR/
39
- orig = YAML.load(buf)
39
+ orig = DTAS.yaml_load(buf)
40
40
 
41
41
  commit_update = lambda do |buf|
42
- sink = YAML.load(buf)
42
+ sink = DTAS.yaml_load(buf)
43
43
  cmd = %W(sink ed #{name})
44
44
  update_cmd_env(cmd, orig, sink)
45
45
 
@@ -68,7 +68,6 @@ if st_in.file? || st_in.pipe?
68
68
  buf = $stdin.read
69
69
  commit_update.call(buf)
70
70
  else
71
- include DTAS::SpawnFix
72
71
  tmp = tmpyaml
73
72
  tmp_path = tmp.path
74
73
  do_update = lambda { commit_update.call(File.read(tmp_path)) }
data/bin/dtas-sourceedit CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- # Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
2
+ # Copyright (C) all contributors <dtas-all@nongnu.org>
3
3
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
4
4
  # frozen_string_literal: true
5
5
  require 'optparse'
@@ -36,10 +36,10 @@ st_in = $stdin.stat
36
36
 
37
37
  buf = c.req(%W(source cat #{name}))
38
38
  abort(buf) if buf =~ /\AERR/
39
- orig = YAML.load(buf)
39
+ orig = DTAS.yaml_load(buf)
40
40
 
41
41
  commit_update = lambda do |buf|
42
- source = YAML.load(buf)
42
+ source = DTAS.yaml_load(buf)
43
43
  cmd = %W(source ed #{name})
44
44
  update_cmd_env(cmd, orig, source)
45
45
 
@@ -55,7 +55,6 @@ if st_in.file? || st_in.pipe?
55
55
  buf = $stdin.read
56
56
  commit_update.call(buf)
57
57
  else
58
- include DTAS::SpawnFix
59
58
  tmp = tmpyaml
60
59
  tmp_path = tmp.path
61
60
  do_update = lambda { commit_update.call(File.read(tmp_path)) }
data/bin/dtas-splitfx CHANGED
@@ -1,19 +1,19 @@
1
1
  #!/usr/bin/env ruby
2
- # Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
2
+ # Copyright (C) all contributors <dtas-all@nongnu.org>
3
3
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
4
4
  # frozen_string_literal: true
5
- require 'yaml'
6
5
  require 'optparse'
7
6
  require 'dtas/splitfx'
8
7
  usage = "#$0 [-n|--dry-run][-j [JOBS]][-s|--silent] SPLITFX_FILE.yml [TARGET]"
9
8
  overrides = {} # FIXME: not tested
10
9
  default_target = "flac"
11
- opts = { jobs: 1 }
10
+ opts = { jobs: nil }
12
11
  OptionParser.new('', 24, ' ') do |op|
13
12
  op.banner = usage
14
13
  op.on('-n', '--dry-run') { opts[:dryrun] = true }
15
14
  op.on('-j', '--jobs [JOBS]', Integer) { |val| opts[:jobs] = val } # nil==inf
16
15
  op.on('-s', '--quiet', '--silent') { opts[:silent] = true }
16
+ op.on('-f', '--filter FILTER') { |val| (opts[:filter] ||= []) << val }
17
17
  op.on('-D', '--no-dither') { opts[:no_dither] = true }
18
18
  op.on('-O', '--outdir OUTDIR') { |val| opts[:outdir] = val }
19
19
  op.on('-C', '--compression FACTOR') { |val| opts[:compression] = val }
@@ -37,13 +37,18 @@ if opts[:sox_pipe] && opts[:err_suffix]
37
37
  abort '--err-suffix and --sox-pipe are mutually exclusive'
38
38
  end
39
39
 
40
+ if opts[:jobs].nil?
41
+ require 'etc'
42
+ opts[:jobs] = Etc.nprocessors
43
+ end
44
+
40
45
  args = []
41
46
  ARGV.each do |arg|
42
47
  case arg
43
48
  when %r{\A(\w+)=(.*)\z}
44
49
  key, val = $1, $2
45
50
  # only one that makes sense is infile=another_file
46
- overrides[key] = YAML.load(val)
51
+ overrides[key] = DTAS.yaml_load(val)
47
52
  when %r{\A(\w+)\.(\w+)=(.*)\z}
48
53
  # comments.ARTIST='blah'
49
54
  top, key, val = $1, $2, $3
@@ -58,5 +63,5 @@ trap(:INT) { exit 130 }
58
63
  file = args.shift or abort usage
59
64
  target = args.shift || default_target
60
65
  splitfx = DTAS::SplitFX.new
61
- splitfx.import(YAML.load(File.read(file)), overrides)
66
+ splitfx.import(DTAS.yaml_load(File.read(file)), overrides)
62
67
  splitfx.run(target, opts)