diff options
| author | EuAndreh <eu@euandre.org> | 2021-01-22 23:20:53 -0300 |
|---|---|---|
| committer | EuAndreh <eu@euandre.org> | 2021-01-22 23:20:53 -0300 |
| commit | 60c45b7f6e65030b603799a18fe7ed3fa723e955 (patch) | |
| tree | 4c7b3eb370279a2ad4a59e4d8b1b5ff15f41313e /scripts/viddq | |
| parent | Rename files vlc -> vid (diff) | |
| download | dotfiles-60c45b7f6e65030b603799a18fe7ed3fa723e955.tar.gz dotfiles-60c45b7f6e65030b603799a18fe7ed3fa723e955.tar.xz | |
Add vid* scripts
Diffstat (limited to 'scripts/viddq')
| -rwxr-xr-x | scripts/viddq | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/scripts/viddq b/scripts/viddq new file mode 100755 index 00000000..eaabec21 --- /dev/null +++ b/scripts/viddq @@ -0,0 +1,17 @@ +#!/bin/sh +set -eu + +QUEUE="$HOME/archive/vid/queue.txt" +NEXT="$(head -n1 "$QUEUE")" +if [ -z "$NEXT" ]; then + echo 'Queue is empty!' +else + if mpv "$NEXT" 2>/dev/null | tail -n1 | grep '^Exiting\.\.\. (End of file)$'; then + echo "Finished playing '$NEXT', getting next on the queue." >&2 + NEW_QUEUE="$(mktemp)" + tail -n+2 "$QUEUE" > "$NEW_QUEUE" + mv "$NEW_QUEUE" "$QUEUE" + else + echo "Quit playing '$NEXT' without finishing, not removing it from the queue." + fi +fi |
