* [PATCH 0/3] some splitfx-related enhancements
@ 2022-01-24 11:35 5% Eric Wong
2022-01-24 11:35 7% ` [PATCH 3/3] player: expire sox metadata cache on file st_ctime changes Eric Wong
0 siblings, 1 reply; 3+ results
From: Eric Wong @ 2022-01-24 11:35 UTC (permalink / raw)
To: dtas-all
1 and 2 make splitfx nicer-to-use, and 3/3 makes repeated splitfx
invocations interact better with dtas-player
Eric Wong (3):
splitfx: support per-track environment variables
splitfx: add --filter option to limit match to comments
player: expire sox metadata cache on file st_ctime changes
bin/dtas-splitfx | 1 +
lib/dtas/mcache.rb | 13 ++++++++++++-
lib/dtas/splitfx.rb | 9 +++++++++
test/test_mcache.rb | 20 +++++++++++++++-----
4 files changed, 37 insertions(+), 6 deletions(-)
^ permalink raw reply [relevance 5%]
* [PATCH 3/3] player: expire sox metadata cache on file st_ctime changes
2022-01-24 11:35 5% [PATCH 0/3] some splitfx-related enhancements Eric Wong
@ 2022-01-24 11:35 7% ` Eric Wong
0 siblings, 0 replies; 3+ results
From: Eric Wong @ 2022-01-24 11:35 UTC (permalink / raw)
To: dtas-all
We still need the TTL to deal with fuse.sshfs and maybe other weird
FSes which don't return the st_ctime properly.
---
lib/dtas/mcache.rb | 13 ++++++++++++-
test/test_mcache.rb | 20 +++++++++++++++-----
2 files changed, 27 insertions(+), 6 deletions(-)
diff --git a/lib/dtas/mcache.rb b/lib/dtas/mcache.rb
index 4f1e9e8..e0a39af 100644
--- a/lib/dtas/mcache.rb
+++ b/lib/dtas/mcache.rb
@@ -13,14 +13,25 @@ def initialize(shift = 8, ttl = 60)
def lookup(infile)
bucket = infile.hash & @mask
+ st = nil
if cur = @tbl[bucket]
if cur[:infile] == infile && (DTAS.now - cur[:btime]) < @ttl
- return cur
+ begin
+ st = File.stat(infile)
+ return cur if cur[:ctime] == st.ctime
+ rescue
+ end
end
end
return unless block_given?
@tbl[bucket] = begin
cur = cur ? cur.clear : {}
+ begin
+ st ||= File.stat(infile)
+ cur[:ctime] = st.ctime
+ rescue
+ return
+ end
if ret = yield(infile, cur)
ret[:infile] = infile.frozen? ? infile : -(infile.dup)
ret[:btime] = DTAS.now
diff --git a/test/test_mcache.rb b/test/test_mcache.rb
index 2bf0e98..983a69e 100644
--- a/test/test_mcache.rb
+++ b/test/test_mcache.rb
@@ -1,19 +1,29 @@
-# Copyright (C) 2016-2020 all contributors <dtas-all@nongnu.org>
+# Copyright (C) all contributors <dtas-all@nongnu.org>
# License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
# frozen_string_literal: true
require './test/helper'
require 'dtas/mcache'
+require 'tempfile'
class TestMcache < Testcase
def test_mcache
+ tmp = Tempfile.new(%W(tmp .sox))
+ fn = tmp.path
+ cmd = %W(sox -r 44100 -b 16 -c 2 -n #{fn} trim 0 1)
+ system(*cmd) or skip
mc = DTAS::Mcache.new
exist = nil
- mc.lookup('hello') { |infile, hash| exist = hash }
+ mc.lookup(fn) { |infile, hash|
+ hash[:ctime] = File.stat(infile).ctime
+ exist = hash
+ }
assert_kind_of Hash, exist
- assert_equal 'hello', exist[:infile]
+ assert_equal fn, exist[:infile]
assert_operator exist[:btime], :<=, DTAS.now
- assert_same exist, mc.lookup('hello')
+ assert_same exist, mc.lookup(fn)
assert_nil mc.lookup('HELLO')
- assert_same exist, mc.lookup('hello'), 'no change after miss'
+ assert_same exist, mc.lookup(fn), 'no change after miss'
+ ensure
+ tmp.close!
end
end
^ permalink raw reply related [relevance 7%]
* [ANN] dtas 0.20.0 - duct tape audio suite for *nix
@ 2022-02-03 5:15 5% Eric Wong
0 siblings, 0 replies; 3+ results
From: Eric Wong @ 2022-02-03 5:15 UTC (permalink / raw)
To: dtas-all, ruby-talk
Free Software command-line tools for audio playback, mastering, and
whatever else related to audio. dtas follows the worse-is-better
philosophy and acts as duct tape to combine existing command-line tools
for flexibility and ease-of-development. dtas is currently implemented
in Ruby, Perl5, and some embedded shell, but may use other languages in
the future.
Changes:
dtas 0.20.0 - ruby 3.1+ compatibility, splitfx improvements
This release catches up with Psych (YAML) changes in Ruby 3.1+
Ruby 2.3+ is now the minimum version, though keep in mind the
ruby-core team already dropped support for it long ago.
Most of the features are focused on audio engineering
capabilities of dtas-splitfx. dtas-splitfx gains the --filter
switch, along with per-track environment variables and comments.
These new features have made my workflow significantly better.
dtas-archive supports explicit comments, and omits the default
SoX comment. To better cope with temporary and modified files
during editing, dtas-player metadata now checks ctime before
reusing the cache, handy for frequently-modified files.
"dtas-tl prune" is now supported to cull temporary files from
the player tracklist.
There's a few dtas-console improvements, too.
28 changes since v0.19.0 (2021-09-05):
archive: support comments, default to none
splitfx: use Etc.nprocessors for jobs if unspecified
dtas-console: set X11 terminal title iff DISPLAY is set
dtas-console: add 'i' toggle to show comments (metadata)
splitfx: fix track_zpad with integer arg
doc: drop ordered map from examples
player: reduce syscalls when splicing to single target
dtas-console: support Wayland terminal titles, too
console: workaround safe warnings in outdated `curses' gem
require Ruby 2.3+
get rid of DTAS.dedupe_str wrapper
move dtas-graph into script/, support Perl for dtas.sh
use YAML.unsafe_load in Psych 4.x (Ruby 3.1+)
deduplicate and freeze pathnames + metadata
player: remove omap conversion
dtas: drop unnecessary "require 'yaml'" statements
dtas-tl prune: cull missing files from tracklist
dtas-tl: drop encoding hacks, use binary stdout+stderr
use IO#wait_readable consistently
get rid of DTAS::Nonblock wrapper for Ruby <= 2.0
unix_accepted: drop Ruby < 2.3 support code
do not check IO#closed? before calling IO#close
splitfx: support per-track environment variables
splitfx: add --filter option to limit match to comments
player: expire sox metadata cache on file st_ctime changes
readahead: do not call -@ on non-String
splitfx: disallow combining --trim and --filter
splitfx: document changes ahead of 0.20.0 release
* homepage: https://80x24.org/dtas/
* https://80x24.org/dtas/INSTALL
* https://80x24.org/dtas/dtas-player.txt
* https://80x24.org/dtas/NEWS.atom
* git clone https://80x24.org/dtas.git
* dtas-all@nongnu.org (plain-text only, no HTML mail, please)
* mail archives: https://80x24.org/dtas-all/
nntps://news.public-inbox.org/inbox.comp.audio.dtas
imaps://anon:mous@public-inbox.org/inbox.comp.audio.dtas.0
nntp://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/inbox.comp.audio.dtas
imap://anon:mous@7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/inbox.comp.audio.dtas.0
https://80x24.org/dtas-all/new.atom
note: .onion URLs require Tor: <https://www.torproject.org/>
^ permalink raw reply [relevance 5%]
Results 1-3 of 3 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2022-01-24 11:35 5% [PATCH 0/3] some splitfx-related enhancements Eric Wong
2022-01-24 11:35 7% ` [PATCH 3/3] player: expire sox metadata cache on file st_ctime changes Eric Wong
2022-02-03 5:15 5% [ANN] dtas 0.20.0 - duct tape audio suite for *nix Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/dtas.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).