From 1dec8a7577d5ddffb0d2459a2eaddf4f65444507 Mon Sep 17 00:00:00 2001 From: Romain Beauxis Date: Tue, 7 Nov 2023 10:04:10 -0600 Subject: [PATCH] Add copy: protocol. --- CHANGES.md | 1 + src/libs/protocols.liq | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 0ef024f73f..ce3bd9af49 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -13,6 +13,7 @@ New: - Add `metadata.replaygain` method to extract unified replay gain value from metadata (#3438). - Add `compute` parameter to `file.replaygain` to control gain calculation (#3438). - Add `compute` parameter to `enable_replaygain_metadata` to control replay gain calculation (#3438). +- Add `copy:` protocol (##3506) Changed: diff --git a/src/libs/protocols.liq b/src/libs/protocols.liq index 4e708a1832..9f1e623d0f 100644 --- a/src/libs/protocols.liq +++ b/src/libs/protocols.liq @@ -662,6 +662,25 @@ protocol.add( syntax="stereo:" ) +# Copy + +# @flag hidden +def protocol.copy(~rlog=_, ~maxtime=_, arg) = + extname = file.extension(arg) + tmpfile = file.temp("tmp", extname) + file.copy(force=true, arg, tmpfile) + [tmpfile] +end + +protocol.add( + static=true, + "copy", + protocol.copy, + doc= + "Copy file to a temporary destination", + syntax="copy:/path/to/file.extname" +) + # Text2wave let settings.protocol.text2wave = settings.make.protocol("text2wave") let settings.protocol.text2wave.path =