recording files moved to /tmp/ for cleanliness

This commit is contained in:
Luke Smith 2019-01-02 11:06:15 -05:00
parent cb6efb557f
commit bcbccce6c0
2 changed files with 10 additions and 10 deletions

View file

@ -3,7 +3,7 @@ separator_block_width=15
markup=pango markup=pango
[record] [record]
command=cat ~/.recordingicon command=cat /tmp/recordingicon
interval=once interval=once
signal=9 signal=9

View file

@ -10,15 +10,15 @@
# If there is already a running instance, user will be prompted to end it. # If there is already a running instance, user will be prompted to end it.
updateicon() { \ updateicon() { \
echo "$1" > ~/.recordingicon echo "$1" > /tmp/recordingicon
pkill -RTMIN+9 i3blocks pkill -RTMIN+9 i3blocks
} }
killrecording() { killrecording() {
recpid="$(cat ~/.recordingpid)" recpid="$(cat /tmp/recordingpid)"
# kill with SIGTERM, allowing finishing touches. # kill with SIGTERM, allowing finishing touches.
kill -15 "$recpid" kill -15 "$recpid"
rm -f ~/.recordingpid rm -f /tmp/recordingpid
updateicon "" updateicon ""
pkill -RTMIN+9 i3blocks pkill -RTMIN+9 i3blocks
# even after SIGTERM, ffmpeg may still run, so SIGKILL it. # even after SIGTERM, ffmpeg may still run, so SIGKILL it.
@ -37,7 +37,7 @@ screencast() { \
-r 30 \ -r 30 \
-c:v libx264rgb -crf 0 -preset ultrafast -c:a flac \ -c:v libx264rgb -crf 0 -preset ultrafast -c:a flac \
"$HOME/screencast-$(date '+%y%m%d-%H%M-%S').mkv" & "$HOME/screencast-$(date '+%y%m%d-%H%M-%S').mkv" &
echo $! > ~/.recordingpid echo $! > /tmp/recordingpid
updateicon "⏺️🎙️" updateicon "⏺️🎙️"
} }
@ -47,7 +47,7 @@ video() { ffmpeg \
-i :0.0 \ -i :0.0 \
-c:v libx264 -qp 0 -r 30 \ -c:v libx264 -qp 0 -r 30 \
"$HOME/video-$(date '+%y%m%d-%H%M-%S').mkv" & "$HOME/video-$(date '+%y%m%d-%H%M-%S').mkv" &
echo $! > ~/.recordingpid echo $! > /tmp/recordingpid
updateicon "⏺️" updateicon "⏺️"
} }
@ -56,7 +56,7 @@ webcamhidef() { ffmpeg \
-i /dev/video0 \ -i /dev/video0 \
-video_size 1920x1080 \ -video_size 1920x1080 \
"$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" & "$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" &
echo $! > ~/.recordingpid echo $! > /tmp/recordingpid
updateicon "🎥" updateicon "🎥"
} }
@ -65,7 +65,7 @@ webcam() { ffmpeg \
-i /dev/video0 \ -i /dev/video0 \
-video_size 640x480 \ -video_size 640x480 \
"$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" & "$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" &
echo $! > ~/.recordingpid echo $! > /tmp/recordingpid
updateicon "🎥" updateicon "🎥"
} }
@ -75,7 +75,7 @@ audio() { \
-f alsa -i default \ -f alsa -i default \
-c:a flac \ -c:a flac \
"$HOME/audio-$(date '+%y%m%d-%H%M-%S').flac" & "$HOME/audio-$(date '+%y%m%d-%H%M-%S').flac" &
echo $! > ~/.recordingpid echo $! > /tmp/recordingpid
updateicon "🎙️" updateicon "🎙️"
} }
@ -101,5 +101,5 @@ case "$1" in
audio) audio;; audio) audio;;
video) video;; video) video;;
kill) killrecording;; kill) killrecording;;
*) ([ -f ~/.recordingpid ] && asktoend && exit) || askrecording;; *) ([ -f /tmp/recordingpid ] && asktoend && exit) || askrecording;;
esac esac