my-beets/play.sh

16 lines
331 B
Bash
Executable File

#! /bin/bash
PLAYDIR="${PLAYDIR:-/tmp/beets_play}"
mkdir -p "$PLAYDIR"
cp "$1" "$PLAYDIR/play"
for f in "$@"; do
cp "$f" "$PLAYDIR/$(basename "$f")"
done
caddy file-server --listen :9999 --browse --root "$PLAYDIR" &
caddy_pid=$!
sleep 2
read -sr -n 1 -p "Press any key to stop server"
echo
kill -9 $caddy_pid
rm "$PLAYDIR"/*