From: martin f. krafft Date: Sun, 19 Sep 2021 21:23:03 +0000 (+1200) Subject: Ensure that restore never intrudes on another recording X-Git-Url: https://git.madduck.net/code/pulserecorder.git/commitdiff_plain/ca51df8a58054f318bf7fcd8e467892e1e35262e Ensure that restore never intrudes on another recording --- 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 }