From ca51df8a58054f318bf7fcd8e467892e1e35262e Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Mon, 20 Sep 2021 09:23:03 +1200 Subject: [PATCH] Ensure that restore never intrudes on another recording --- pulserecorder | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pulserecorder b/pulserecorder index 7d3860e..58fdec7 100755 --- a/pulserecorder +++ b/pulserecorder @@ -152,8 +152,18 @@ load_module() { } move_source_to_sink() { - local c; + local c d; c=$(pactl list short sink-inputs | sed -rne "s,^${1}[[:space:]]+([[:digit:]]+).+,\1,p") + d="$(pactl list short sinks | sed -rne "s,^${c}[[:space:]]+([^[:space:]]+).+,\1,p")" + case "$d" in + (record-to-file-*) + # Never restore to a record-to-file destination, or it could botch + # another recording + c="@DEFAULT_SINK@" + ;; + (*) :;; + esac + echo >&2 "Moving input $1 to sink $2 (restore to $c) …" cleanup_hook pactl move-sink-input $1 $c pactl move-sink-input $1 $2 } -- 2.39.2