my-beets/play.sh

16 lines
331 B
Bash
Raw Normal View History

2020-11-18 18:34:50 +00:00
#! /bin/bash
2020-11-18 20:39:57 +00:00
PLAYDIR="${PLAYDIR:-/tmp/beets_play}"
2020-11-18 18:34:50 +00:00
mkdir -p "$PLAYDIR"
2020-11-18 19:55:48 +00:00
cp "$1" "$PLAYDIR/play"
2020-11-18 20:39:57 +00:00
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
2020-11-18 18:34:50 +00:00
rm "$PLAYDIR"/*