summaryrefslogtreecommitdiff
path: root/bin/dmscripts/dmvid
diff options
context:
space:
mode:
Diffstat (limited to 'bin/dmscripts/dmvid')
-rwxr-xr-xbin/dmscripts/dmvid17
1 files changed, 17 insertions, 0 deletions
diff --git a/bin/dmscripts/dmvid b/bin/dmscripts/dmvid
new file mode 100755
index 0000000..08dbb6b
--- /dev/null
+++ b/bin/dmscripts/dmvid
@@ -0,0 +1,17 @@
+#!/usr/bin/env bash
+
+find ${1:-~/movies ~/Downloads} 2> /dev/null | grep -E ".+\.(webm|mp4|mpeg|mkv)$" | sort > /tmp/dmvids
+choice="$(\
+ sed 's|^/home/aluc|\~| ; s|\([^/]\)[^/]*/|\1/|g' /tmp/dmvids \
+ | tr '\n' '\0' \
+ | xargs -0 -I {} echo " {}" \
+ | tr '\0' '\n' \
+ | awk '{printf "%-3s %s\n", NR ":", $0}' \
+ | dmenu -l 10 -g 1 -x -i \
+ | grep -zoE "^[0-9]+:" \
+)"
+if [ -z "$choice" ]; then
+ exit
+fi
+vid="$(sed -n "${choice::-1}p" /tmp/dmvids)"
+mpv "$vid"