X-Git-Url: https://git.madduck.net/code/pulserecorder.git/blobdiff_plain/92376471ab255fa21a70a02cb16e2436c8bd058e..015c7497293aa96ee5f389090c3b9645f199efaf:/pulserecorder?ds=inline diff --git a/pulserecorder b/pulserecorder index 7d3860e..ab0d471 100755 --- a/pulserecorder +++ b/pulserecorder @@ -152,13 +152,23 @@ 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 } -if false; then +if [ -n "${PAREC_PIPE:-}" ]; then # This would be great, but it does not work. For instance, trying this on # audible meant that audible would play at maximum speed (3h played in 3 # minutes), but the result would be full of skips, making me think that