]> git.madduck.net Git - code/pulserecorder.git/blobdiff - pulserecorder

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Ensure that restore never intrudes on another recording
[code/pulserecorder.git] / pulserecorder
index 7d3860e56f3efcedcaee992a56bad6152cd5c297..58fdec76d01f63264f22ef3e169b9e13f32eef51 100755 (executable)
@@ -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
 }