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
[record]
command=cat ~/.recordingicon
command=cat /tmp/recordingicon
interval=once
signal=9

View file

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