improve licensing
[distro-setup] / clip-hc
1 #!/bin/bash
2 set -e; . /usr/local/lib/bash-bear; set +e
3
4 cd /a/bin/data/clips/hc
5
6 if pgrep mpv; then
7 pkill mpv
8 exit 0
9 fi
10
11 clip=$(find . -type f -printf '%f\n' | \
12 { if [[ -e /tmp/last-hc ]]; then
13 sed "/^$(cat /tmp/last-hc)\$/d"
14 else
15 cat
16 fi ; } | \
17 shuf | head -n1)
18 echo $clip >/tmp/last-hc
19 mpv --profile=a $clip