summaryrefslogtreecommitdiff
path: root/dmpv
diff options
context:
space:
mode:
authorzachir <zachir@librem.one>2022-08-12 04:30:51 -0500
committerzachir <zachir@librem.one>2022-08-12 04:30:51 -0500
commitc4d96716c05c41a3b18f2326cb588cd19246da5f (patch)
treeaa6b16c2e89ee63d37eb05e38577ec0b0bddea59 /dmpv
initial commit
Diffstat (limited to 'dmpv')
-rwxr-xr-xdmpv46
1 files changed, 46 insertions, 0 deletions
diff --git a/dmpv b/dmpv
new file mode 100755
index 0000000..f5742f5
--- /dev/null
+++ b/dmpv
@@ -0,0 +1,46 @@
+#!/sbin/sh
+
+cd ~/Videos
+case "$@" in
+ "-l")
+ LOOP="true"
+ ;;
+ "-h")
+ HELP="true"
+ ;;
+esac
+
+playvid () {
+ while true; do
+ VIDEO=$(printf ".\n%s\n" "$(ls)" | uniq | barmenu "$@")
+ [ -z $VIDEO ] && exit
+ if [ "$VIDEO" = "." ]; then
+ break;
+ fi
+ [ -d $VIDEO ] && cd $VIDEO && continue
+ [ -f "$VIDEO" ] && break
+ pwd
+ done
+ mpv "$VIDEO"
+}
+
+printhelp () {
+ printf \
+ "Usage: dmpv [-l] [-h]\n" \
+ "dmpv is a simple barmenu interface for playing content with mpv\n" \
+ "dmpv assumes videos are stored in ~/Videos\n" \
+ " -h\t\tprint this help message\n" \
+ " -l\t\trun the prompt again after mpv exits\n"
+}
+
+if [ -n "$HELP" ]; then
+ printhelp && exit 0
+elif [ -n "$LOOP" ]; then
+ while true; do
+ playvid || exit 0
+ done
+fi
+
+playvid
+ done
+fi