blob: ca309fbf62887b1c5139f2899d2e392da4731d5c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#!/usr/bin/env sh
tmpfile="/tmp/dmvids"
dirs="${1:-$HOME/vids $HOME/dl}"
find -L $dirs 2> /dev/null |
grep ".\+\.\(webm\|mp4\|mpeg\|mkv\)$" |
sort > "$tmpfile"
if [ "$MENUCMD" = "tofi" ]
then
menucmd="tofi --width 30% --height 30% --matching-algorithm normal"
elif [ "$MENUCMD" = "dmenu" ]
then
menucmd="dmenu -l 10 -g 1 -x -i"
else
menucmd="fzf"
fi
choice="$(sed "s|^$HOME|\~| ; s|\([^/]\)[^/]*/|\1/|g" "$tmpfile" |
awk '{printf "%s %s\n", NR ":", $0}' |
$menucmd |
cut -f 1 -d ':')"
test -z "$choice" &&
exit 1
mpv "$(sed -n "${choice}p" "$tmpfile")"
|