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

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:

Use filename instead of UUID for sink name
authormartin f. krafft <madduck@madduck.net>
Sun, 19 Sep 2021 21:22:23 +0000 (09:22 +1200)
committermartin f. krafft <madduck@madduck.net>
Sun, 19 Sep 2021 21:22:23 +0000 (09:22 +1200)
pulserecorder

index 211c6d58895f4297d0e2d3450dd90b2497b8fba7..7d3860e56f3efcedcaee992a56bad6152cd5c297 100755 (executable)
@@ -91,6 +91,28 @@ pa_get_next_index() {
   }
 }
 
   }
 }
 
+uuidgen() {
+  hascmd() { command -v "$@" >/dev/null;}
+  if   hascmd uuid; then uuid
+  elif hascmd uuidgen; then uuidgen
+  elif hascmd python3; then
+    python3 -c 'import uuid; print(uuid.uuid1())'
+  elif hascmd python; then
+    python -c 'import uuid; print(uuid.uuid1())'
+  else
+    dd if=/dev/urandom bs=16 count=1 status=none | base64
+  fi
+}
+
+if [ -z "$outfile" ]; then
+  uuid=$(uuidgen)
+  outfile="${uuid}.ogg"
+fi
+
+if [ -f "$outfile" ] && [ $clobber -eq 0 ]; then
+  echo >&2 "E: file exists, and -f not given: $outfile"
+  exit 1
+fi
 case "$index" in
 
   (last)
 case "$index" in
 
   (last)
@@ -117,29 +139,7 @@ if [ -z "$index" ]; then
   exit 1
 fi
 
   exit 1
 fi
 
-uuidgen() {
-  hascmd() { command -v "$@" >/dev/null;}
-  if   hascmd uuid; then uuid
-  elif hascmd uuidgen; then uuidgen
-  elif hascmd python3; then
-    python3 -c 'import uuid; print(uuid.uuid1())'
-  elif hascmd python; then
-    python -c 'import uuid; print(uuid.uuid1())'
-  else
-    dd if=/dev/urandom bs=16 count=1 status=none | base64
-  fi
-}
-
-uuid=$(uuidgen)
-
-[ -n "$outfile" ] || outfile="${uuid}.ogg"
-
-if [ -f "$outfile" ] && [ $clobber -eq 0 ]; then
-  echo >&2 "E: file exists, and -f not given: $outfile"
-  exit 1
-fi
-
-devname="record-to-file-${uuid}"
+devname="record-to-file-$(echo -n ${outfile%.*} | tr -c '[:alnum:]' '_')"
 
 echo >&2 "Recording source $index to $outfile …"
 
 
 echo >&2 "Recording source $index to $outfile …"