#!/bin/bash set -e; . /usr/local/lib/bash-bear; set +e cd /a/bin/data/clips/up if pgrep mpv; then pkill mpv exit 0 fi if [[ ! -s /tmp/last-up ]]; then find . -type f -printf '%f\n' | shuf > /tmp/last-up fi clip=$(head -n1 /tmp/last-up) tail -n+2 /tmp/last-up | sponge /tmp/last-up # clip=$(ls -1 . | \ # { if [[ -e /tmp/last-up ]]; then # sed "/^$(cat /tmp/last-up)\$/d" # else # cat # fi ; } | \ # shuf | head -n1) # echo $clip >/tmp/last-up mpv --profile=a $clip