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