dtas 0.18.1 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) 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/GNUmakefile +13 -1
  7. data/INSTALL +12 -11
  8. data/NEWS +90 -0
  9. data/README +5 -5
  10. data/bin/dtas-archive +6 -2
  11. data/bin/dtas-console +36 -4
  12. data/bin/dtas-msinkctl +2 -3
  13. data/bin/dtas-partstats +3 -9
  14. data/bin/dtas-player +1 -2
  15. data/bin/dtas-readahead +11 -25
  16. data/bin/dtas-sinkedit +3 -4
  17. data/bin/dtas-sourceedit +3 -4
  18. data/bin/dtas-splitfx +10 -5
  19. data/bin/dtas-tl +32 -27
  20. data/dtas.gemspec +3 -3
  21. data/dtas.sh +8 -0
  22. data/examples/splitfx.sample.yml +1 -1
  23. data/examples/tfx.sample.yml +1 -1
  24. data/lib/dtas/buffer/fiddle_splice.rb +2 -1
  25. data/lib/dtas/buffer/read_write.rb +1 -2
  26. data/lib/dtas/buffer/splice.rb +2 -1
  27. data/lib/dtas/buffer.rb +2 -2
  28. data/lib/dtas/edit_client.rb +2 -3
  29. data/lib/dtas/fadefx.rb +2 -2
  30. data/lib/dtas/mcache.rb +14 -3
  31. data/lib/dtas/mlib.rb +23 -13
  32. data/lib/dtas/partstats.rb +3 -5
  33. data/lib/dtas/pipe.rb +2 -3
  34. data/lib/dtas/pipeline.rb +1 -4
  35. data/lib/dtas/player/client_handler.rb +3 -3
  36. data/lib/dtas/player.rb +13 -12
  37. data/lib/dtas/process.rb +3 -5
  38. data/lib/dtas/rg_state.rb +2 -2
  39. data/lib/dtas/sigevent/fiddle_efd.rb +3 -4
  40. data/lib/dtas/sigevent/pipe.rb +2 -3
  41. data/lib/dtas/sink.rb +1 -2
  42. data/lib/dtas/source/av_ff_common.rb +4 -4
  43. data/lib/dtas/source/sox.rb +4 -4
  44. data/lib/dtas/source/splitfx.rb +2 -3
  45. data/lib/dtas/splitfx.rb +19 -9
  46. data/lib/dtas/state_file.rb +2 -2
  47. data/lib/dtas/track.rb +1 -1
  48. data/lib/dtas/unix_accepted.rb +12 -37
  49. data/lib/dtas/unix_client.rb +2 -2
  50. data/lib/dtas/unix_server.rb +2 -14
  51. data/lib/dtas/version.rb +1 -1
  52. data/lib/dtas/watchable/fiddle_ino.rb +3 -3
  53. data/lib/dtas/watchable.rb +1 -2
  54. data/lib/dtas.rb +6 -22
  55. data/man/dtas-archive.1 +1 -1
  56. data/man/dtas-console.1 +1 -1
  57. data/man/dtas-ctl.1 +1 -1
  58. data/man/dtas-cueedit.1 +1 -1
  59. data/man/dtas-enq.1 +1 -1
  60. data/man/dtas-env.7 +1 -1
  61. data/man/dtas-msinkctl.1 +1 -1
  62. data/man/dtas-player.1 +1 -1
  63. data/man/dtas-player_effects.7 +1 -1
  64. data/man/dtas-player_protocol.7 +1 -1
  65. data/man/dtas-player_sink_examples.7 +1 -1
  66. data/man/dtas-sinkedit.1 +1 -1
  67. data/man/dtas-sourceedit.1 +1 -1
  68. data/man/dtas-splitfx.1 +38 -13
  69. data/man/dtas-tl.1 +4 -2
  70. data/man/dtas-xdelay.1 +1 -1
  71. data/{perl → script}/dtas-graph +1 -1
  72. data/test/player_integration.rb +1 -2
  73. data/test/test_buffer.rb +2 -2
  74. data/test/test_encoding.rb +2 -3
  75. data/test/test_format_change.rb +2 -2
  76. data/test/test_mcache.rb +15 -5
  77. data/test/test_player_client_handler.rb +2 -2
  78. data/test/test_player_integration.rb +7 -8
  79. data/test/test_rg_integration.rb +9 -9
  80. data/test/test_sink.rb +2 -2
  81. data/test/test_splitfx.rb +2 -5
  82. data/test/test_tfx.rb +2 -3
  83. data/test/test_unixserver.rb +1 -1
  84. metadata +6 -8
  85. data/lib/dtas/compat_onenine.rb +0 -17
  86. data/lib/dtas/nonblock.rb +0 -24
  87. data/lib/dtas/spawn_fix.rb +0 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e243e5ce687818e957241adc639e6a0557d6b4caff54fe423241a30cfbd0368f
4
- data.tar.gz: 54d936c09a7ca62d97ce41f23e9c3db70b92765cea257cc34f7bbd21059ba938
3
+ metadata.gz: '08c87e61b5fe14796e7415b25cf1df9acaff5fbf280643b33745457dc97e72be'
4
+ data.tar.gz: fefae588f265012deaa56108c1c6f4fc9f930a1c8827a166fd58ed2b6a844540
5
5
  SHA512:
6
- metadata.gz: 937e5a36a9fcfe06011871c047a6cda9a8d402a3fea84a68a7214315e9228db03d8f7277d29adca0139ccc7358897a4985d606a96c156432ce53cba1a51fd801
7
- data.tar.gz: 9aaed956fd48e6b5c0d45c0ef91a440bd6c4f53def5bfa5390ea5bd2315686dc199e0c0c007e2c1d8c2992bf9c386d3991b7c6fd183577f4e00bda860c09cf36
6
+ metadata.gz: 8401be0d9a2a8c0e315c9b19964405dfe5bb515997546e6014bea370a96053d288d5597056839096cf1469b43094467680b206cb371133eefba48ef1fe6ca85b
7
+ data.tar.gz: 50d96fa7791a55aea522aaec18886fcfc330290bae169e41f4c754f04c60729f73f201d1d9172ff52a7978759a93c918b76b6f7d60db330d649b41a044b2ec0b
@@ -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.18.1
1
+ VERSION = 0.21.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.18.0"
8
+ DEF_VER = "v0.21.0"
9
9
  vn = DEF_VER
10
10
 
11
11
  # First see if there is a version file (included in release tarballs),
data/GNUmakefile CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
1
+ # Copyright (C) 2013-2021 all contributors <dtas-all@nongnu.org>
2
2
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
  all::
4
4
  pkg = dtas
@@ -74,5 +74,17 @@ $(pkgtgz): .tgz-manifest
74
74
 
75
75
  package: $(pkgtgz) $(pkggem)
76
76
 
77
+ # Install symlinks to ~/bin (which is hopefuly in PATH) which point to
78
+ # this source tree.
79
+ # prefix + bindir matches git.git Makefile:
80
+ prefix = $(HOME)
81
+ bindir = $(prefix)/bin
82
+ symlink-install :
83
+ mkdir -p $(bindir)
84
+ dtas=$(CURDIR)/dtas.sh && cd $(bindir) && \
85
+ for x in $(CURDIR)/bin/*; do \
86
+ ln -sf "$$dtas" $$(basename "$$x"); \
87
+ done
88
+
77
89
  .PHONY: all .FORCE-GIT-VERSION-FILE test $(test_units) NEWS
78
90
  .PHONY: check-warnings fix-perms
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,20 +26,20 @@ 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.18.1.tar.gz
33
+ https://80x24.org/dtas/2022/dtas-0.21.0.tar.gz
33
34
 
34
- $ tar zxvf dtas-0.18.1.tar.gz
35
- $ cd dtas-0.18.1
36
- $ sudo ruby setup.rb
35
+ $ tar zxvf dtas-0.21.0.tar.gz
36
+ $ cd dtas-0.21.0
37
37
 
38
- GNU/Linux users may optionally install the "sleepy_penguin" RubyGem
39
- for a tiny speed improvement over the default "fiddle" RubyGem.
38
+ # To install symlinks into ~/bin (assuming your Ruby executable is "ruby")
39
+ $ make symlink-install
40
40
 
41
- * sleepy_penguin - https://yhbt.net/sleepy_penguin/
41
+ # or using setup.rb:
42
+ $ sudo ruby setup.rb
42
43
 
43
44
  # CONTACT
44
45
 
@@ -50,5 +51,5 @@ No subscription is necessary to post to the mailing list.
50
51
 
51
52
  # COPYRIGHT
52
53
 
53
- Copyright 2013-2021 all contributors <dtas-all@nongnu.org>
54
+ Copyright all contributors <dtas-all@nongnu.org>
54
55
  License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
data/NEWS CHANGED
@@ -1,3 +1,93 @@
1
+ # 0.21.0 / 2022-09-06
2
+
3
+ dtas 0.21.0
4
+
5
+
6
+ There's two minor fixes for dtas-splitfx, and one for
7
+ dtas-player users using the rate=bypass optimization.
8
+
9
+ 3 changes since v0.20.0 (2022-02-03):
10
+
11
+ splitfx: fix error reporting of failed tracks
12
+ splitfx: warn on improper encodings for titles
13
+ player: drain sinks completely before changing sink rate
14
+
15
+ # 0.20.0 / 2022-02-03
16
+
17
+ dtas 0.20.0 - ruby 3.1+ compatibility, splitfx improvements
18
+
19
+
20
+ This release catches up with Psych (YAML) changes in Ruby 3.1+
21
+ Ruby 2.3+ is now the minimum version, though keep in mind the
22
+ ruby-core team already dropped support for it long ago.
23
+
24
+ Most of the features are focused on audio engineering
25
+ capabilities of dtas-splitfx. dtas-splitfx gains the --filter
26
+ switch, along with per-track environment variables and comments.
27
+ These new features have made my workflow significantly better.
28
+
29
+ dtas-archive supports explicit comments, and omits the default
30
+ SoX comment. To better cope with temporary and modified files
31
+ during editing, dtas-player metadata now checks ctime before
32
+ reusing the cache, handy for frequently-modified files.
33
+ "dtas-tl prune" is now supported to cull temporary files from
34
+ the player tracklist.
35
+
36
+ There's a few dtas-console improvements, too.
37
+
38
+ 28 changes since v0.19.0 (2021-09-05):
39
+
40
+ archive: support comments, default to none
41
+ splitfx: use Etc.nprocessors for jobs if unspecified
42
+ dtas-console: set X11 terminal title iff DISPLAY is set
43
+ dtas-console: add 'i' toggle to show comments (metadata)
44
+ splitfx: fix track_zpad with integer arg
45
+ doc: drop ordered map from examples
46
+ player: reduce syscalls when splicing to single target
47
+ dtas-console: support Wayland terminal titles, too
48
+ console: workaround safe warnings in outdated `curses' gem
49
+ require Ruby 2.3+
50
+ get rid of DTAS.dedupe_str wrapper
51
+ move dtas-graph into script/, support Perl for dtas.sh
52
+ use YAML.unsafe_load in Psych 4.x (Ruby 3.1+)
53
+ deduplicate and freeze pathnames + metadata
54
+ player: remove omap conversion
55
+ dtas: drop unnecessary "require 'yaml'" statements
56
+ dtas-tl prune: cull missing files from tracklist
57
+ dtas-tl: drop encoding hacks, use binary stdout+stderr
58
+ use IO#wait_readable consistently
59
+ get rid of DTAS::Nonblock wrapper for Ruby <= 2.0
60
+ unix_accepted: drop Ruby < 2.3 support code
61
+ do not check IO#closed? before calling IO#close
62
+ splitfx: support per-track environment variables
63
+ splitfx: add --filter option to limit match to comments
64
+ player: expire sox metadata cache on file st_ctime changes
65
+ readahead: do not call -@ on non-String
66
+ splitfx: disallow combining --trim and --filter
67
+ splitfx: document changes ahead of 0.20.0 release
68
+
69
+ # 0.19.0 / 2021-09-05
70
+
71
+ dtas 0.19.0 - odd pathname fixes
72
+
73
+
74
+ Non-UTF-8-encoded pathnames now handled properly by dtas-mlib.
75
+ Shell-unfriendly filenames are handled properly if they require
76
+ ffmpeg (they were always handled properly when using sox).
77
+
78
+ Some minor URL and doc updates, too, and there's a new
79
+ "make symlink-install" target for users who lack permissions
80
+ to install RubyGems.
81
+
82
+ 6 changes since v0.18.1 (2021-02-13):
83
+
84
+ mlib: pathnames may be blobs
85
+ README: replace NNTP URL with NNTPS
86
+ gemspec: allow building gem without setting VERSION
87
+ build: add "symlink-install" target
88
+ do not shell-quote filenames for environment
89
+ doc: use Tor v3 .onion URLs
90
+
1
91
  # 0.18.1 / 2021-02-13
2
92
 
3
93
  dtas 0.18.1
data/README CHANGED
@@ -81,18 +81,18 @@ Mailing list archives available at <https://80x24.org/dtas-all/> or
81
81
 
82
82
  No subscription is necessary to post to the mailing list.
83
83
  You may also read via:
84
- NNTP: <nntp://news.public-inbox.org/inbox.comp.audio.dtas>
85
- <nntp://ou63pmih66umazou.onion/inbox.comp.audio.dtas>
84
+ NNTP: <nntps://news.public-inbox.org/inbox.comp.audio.dtas>
85
+ <nntp://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/inbox.comp.audio.dtas>
86
86
  <nntp://news.gmane.io/gmane.comp.audio.dtas.general>
87
87
  IMAP: <imaps://anon:mous@public-inbox.org/inbox.comp.audio.dtas.0>
88
- <imap://anon:mous@ou63pmih66umazou.onion/inbox.comp.audio.dtas.0>
88
+ <imap://anon:mous@7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/inbox.comp.audio.dtas.0>
89
89
  Atom: <https://80x24.org/dtas-all/new.atom>
90
- <http://ou63pmih66umazou.onion/dtas-all/new.atom>
90
+ <http://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/dtas-all/new.atom>
91
91
  (.onion URLs require Tor: <https://www.torproject.org/>)
92
92
 
93
93
  ## Copyright
94
94
 
95
- Copyright 2013-2020 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)) }