diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-06-22 13:35:14 +0200 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-06-22 13:35:14 +0200 |
commit | ab76fc99422a9147f745c48e301dbbb1cd5db29d (patch) | |
tree | bcd8be8df5a04484a1d0701ce8dfdb41c15bc17c /bin/menuscripts | |
parent | 46773758b04ca4ece90214be75c44f88f5eb5507 (diff) |
use variable for tmpfile
Diffstat (limited to 'bin/menuscripts')
-rwxr-xr-x | bin/menuscripts/mvid | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/bin/menuscripts/mvid b/bin/menuscripts/mvid index 8d14c4b..ca309fb 100755 --- a/bin/menuscripts/mvid +++ b/bin/menuscripts/mvid @@ -1,10 +1,11 @@ #!/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 > /tmp/dmvids -cat /tmp/dmvids + sort > "$tmpfile" if [ "$MENUCMD" = "tofi" ] then @@ -16,11 +17,11 @@ else menucmd="fzf" fi -choice="$(sed 's|^/home/aluc|\~| ; s|\([^/]\)[^/]*/|\1/|g' /tmp/dmvids | +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" /tmp/dmvids)" +mpv "$(sed -n "${choice}p" "$tmpfile")" |